#include <windows.h> | |
#include <nt.h> | |
//#include <errno.h> | |
int read(int fd, void *buffer, size_t count) { | |
IO_STATUS_BLOCK io_status; | |
long int status = NtReadFile((void *)fd, NULL, NULL, NULL, &io_status, buffer, count, NULL, NULL); | |
//printf("nativelibc debug: read: status = 0x%lx\n", status); | |
//if(ntstatus_to_errno(status)) return -1; | |
if(status && status != STATUS_PENDING) return -1; // TODO: implemente the errno | |
return io_status.Information; | |
} |