Open MassKlaus opened 3 months ago
Some info from some quick testing:
stdin
when there's no input returns 2
which is FILE_TYPE_CHAR
GetFileSizeEx
(which is what getEndPos
does on Windows) on a FILE_TYPE_CHAR
handle leads to Incorrect function.
and error.Unexpected
, as shown in the OPNtQueryInformationFile
(which is what File.stat
does) on a FILE_TYPE_CHAR
handle leads to NTSTATUS C0000010
which is STATUS_INVALID_DEVICE_REQUEST
(currently leads to error.Unexpected
)One possibility here would be to call NtQueryVolumeInformationFile
in getEndPos
/stat
/etc to determine if the handle is valid for the operation. Another option would be to catch and handle/return the relevant errors in getEndPos
/stat
/etc.
I would say expanding the error set would be the best way to handle this. Since similar errors could rise in different location throughout the winAPI and having the error enums be able to encapsulate the error is important.
Although, I'm quite new to most of the language so I might be off the mark.
Zig Version
0.12.0
Steps to Reproduce and Observed Output
Reproduction steps:
have this code anywhere in the code:
throws
Error code 1 meaning ERROR_INVALID_FUNCTION as the windows documentation says
Expected Output
No error