3 #include <msp/core/systemerror.h>
5 #include "handle_private.h"
12 void sys_set_blocking(Handle &, bool)
16 void sys_set_inherit(Handle &, bool)
20 size_t sys_read(Handle &handle, char *buf, size_t size)
22 if(size>numeric_limits<DWORD>::max())
23 throw invalid_argument("IO::sys_read");
26 if(ReadFile(*handle, buf, size, &ret, nullptr)==0)
27 throw system_error("ReadFile");
32 size_t sys_write(Handle &handle, const char *buf, size_t size)
34 if(size>numeric_limits<DWORD>::max())
35 throw invalid_argument("IO::sys_write");
38 if(WriteFile(*handle, buf, size, &ret, nullptr)==0)
39 throw system_error("WriteFile");
44 void sys_close(Handle &handle)
49 *handle = INVALID_HANDLE_VALUE;