| #include <windows.h> | |
| #include <nt.h> | |
| //#include <errno.h> | |
| #include <pathname.h> | |
| int unlink(const char *name) { | |
| UNICODE_STRING name1; | |
| RtlCreateUnicodeStringFromAsciiz(&name1, name); | |
| PATHNAME_UNIX2NT_UTF16_STRUCT(name1); | |
| OBJECT_ATTRIBUTES o = { sizeof(OBJECT_ATTRIBUTES), NULL, &name1, 0, NULL, NULL }; | |
| long int status = NtDeleteFile(&o); | |
| RtlFreeUnicodeString(&name1); | |
| //return ntstatus_to_errno(status) ? -1 : 0; | |
| return status ? -1 : 0; | |
| } |