| int symlink(const char *oldpath, const char *newpath) { |
| RtlCreateUnicodeStringFromAsciiz(&old_path, oldpath); |
| RtlCreateUnicodeStringFromAsciiz(&new_path, newpath); |
| PATHNAME_UNIX2NT_UTF16_STRUCT(old_path); |
| PATHNAME_UNIX2NT_UTF16_STRUCT(new_path); |
| OBJECT_ATTRIBUTES new_object = { sizeof(OBJECT_ATTRIBUTES), NULL, &new_path, 0, NULL, NULL }; |
| long int status = NtCreateSymbolicLinkObject(&handle, SYMBOLIC_LINK_ALL_ACCESS, &new_object, &old_path); |
| RtlFreeUnicodeString(&old_path); |
| RtlFreeUnicodeString(&new_path); |
| //printf("nativelibc debug: symlink: status = 0x%lx\n", status); |
| //if(ntstatus_to_errno(status)) return -1; |
| //if(ntstatus_to_errno(NtClose(handle))) return -1; |
| if(NtClose(handle)) return -1; |