fixed WriteFile segfault
parent
6b7f3d01ae
commit
54f7d58722
|
@ -52,7 +52,8 @@ pub const WriteError = error{
|
|||
};
|
||||
|
||||
pub fn windowsWrite(handle: windows.HANDLE, bytes: []const u8) WriteError!void {
|
||||
if (windows.WriteFile(handle, bytes.ptr, @intCast(u32, bytes.len), null, null) == 0) {
|
||||
var bytes_written: windows.DWORD = undefined;
|
||||
if (windows.WriteFile(handle, bytes.ptr, @intCast(u32, bytes.len), &bytes_written, null) == 0) {
|
||||
const err = windows.GetLastError();
|
||||
return switch (err) {
|
||||
windows.ERROR.INVALID_USER_BUFFER => WriteError.SystemResources,
|
||||
|
|
Loading…
Reference in New Issue