#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 | |
} |