blob: 95a37ff58f84f1b5b77b211619768958d1cf1c89 [file] [log] [blame] [raw]
#include <windows.h>
#include <nt.h>
//#include <errno.h>
int dup(int oldfd) {
void *r;
long int status = NtDuplicateObject((void *)-1, (void *)oldfd, (void *)-1, &r, 0, 0, DUPLICATE_SAME_ATTRIBUTES | DUPLICATE_SAME_ACCESS);
//return ntstatus_to_errno(status) ? -1 : (int)r;
return status ? -1 : (int)r; // TODO: implemente the errno
}