std.Io.Threaded: ntReadFileResult handles EOF + bytes available

This commit is contained in:
Andrew Kelley 2026-01-29 13:31:44 -08:00
parent 4dd7fe90a2
commit 8f8aa8346a

View file

@ -8709,8 +8709,10 @@ fn ntReadFileResult(io_status_block: *const windows.IO_STATUS_BLOCK) !usize {
.PENDING => unreachable,
.CANCELLED => unreachable,
.SUCCESS => return io_status_block.Information,
.END_OF_FILE => return error.EndOfStream,
.PIPE_BROKEN => return error.EndOfStream,
.END_OF_FILE, .PIPE_BROKEN => {
if (io_status_block.Information == 0) return error.EndOfStream;
return io_status_block.Information;
},
.INVALID_DEVICE_REQUEST => return error.IsDir,
.LOCK_NOT_GRANTED => return error.LockViolation,
.ACCESS_DENIED => return error.AccessDenied,