stream_win.c 349 Bytes
#include <string.h>

#include <scot/stream_win.h>
#include <scot/scot_int.h>
#include <scot/exception.h>
#include <scot/scot_types.h>

SSIZE_T win_file_read (HANDLE h, void * buf, SIZE_T count)
{
	DWORD got = 0;

	if (ReadFile (h, buf, count, &got, NULL) == 0)
		THROW (EXC (EXC_ERROR, GetLastError (), strerror (GetLastError ())));

	return got;
}