diff options
| author | psbob <178673413+psbob@users.noreply.github.com> | 2025-04-27 15:42:15 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-27 14:42:15 +0000 |
| commit | d92649da80a526f2e2b2f220c05b81becf4fa627 (patch) | |
| tree | 36620fa425c5dbb0071b451df8c191f27849b495 /lib/std | |
| parent | b16c094926cf659e144cbcbed6c69cd820c5ff9f (diff) | |
| download | zig-d92649da80a526f2e2b2f220c05b81becf4fa627.tar.gz zig-d92649da80a526f2e2b2f220c05b81becf4fa627.zip | |
Update Windows ReadFile and WriteFile to recognise Access Denied error when a read or write is attempted on a disconnected virtual com port
Diffstat (limited to 'lib/std')
| -rw-r--r-- | lib/std/os/windows.zig | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/std/os/windows.zig b/lib/std/os/windows.zig index 5a9296e889..e24617645a 100644 --- a/lib/std/os/windows.zig +++ b/lib/std/os/windows.zig @@ -602,6 +602,9 @@ pub const ReadFileError = error{ OperationAborted, /// Unable to read file due to lock. LockViolation, + /// Known to be possible when: + /// - Unable to read from disconnected virtual com port (Windows) + AccessDenied, Unexpected, }; @@ -634,6 +637,7 @@ pub fn ReadFile(in_hFile: HANDLE, buffer: []u8, offset: ?u64) ReadFileError!usiz .HANDLE_EOF => return 0, .NETNAME_DELETED => return error.ConnectionResetByPeer, .LOCK_VIOLATION => return error.LockViolation, + .ACCESS_DENIED => return error.AccessDenied, else => |err| return unexpectedError(err), } } @@ -651,6 +655,9 @@ pub const WriteFileError = error{ LockViolation, /// The specified network name is no longer available. ConnectionResetByPeer, + /// Known to be possible when: + /// - Unable to write to disconnected virtual com port (Windows) + AccessDenied, Unexpected, }; @@ -687,6 +694,7 @@ pub fn WriteFile( .INVALID_HANDLE => return error.NotOpenForWriting, .LOCK_VIOLATION => return error.LockViolation, .NETNAME_DELETED => return error.ConnectionResetByPeer, + .ACCESS_DENIED => return error.AccessDenied, else => |err| return unexpectedError(err), } } |
