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