blob: 1a993ff39ea2a8741dcaf8666f582c6424022d21 [file] [log] [blame] [raw]
#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;
}