authorgravatar for squeek502@hotmail.comRyan Liptak <squeek502@hotmail.com> 2023-03-08 00:57:39-08:00
committergravatar for squeek502@hotmail.comRyan Liptak <squeek502@hotmail.com> 2023-03-08 04:26:50-08:00
log6d74c0d1b41b52bca3d66092a48660f2ee4ae4f8
treeb55da23e3755311c92e40675ffa97cf2b82f004f
parente3cf9d165081533524927cebf8a92ac6fee097f2

Add comments explaining BUFFER_OVERFLOW during NtQueryInformationFile calls


1 files changed, 6 insertions(+), 0 deletions(-)

lib/std/fs/file.zig+6
......@@ -379,6 +379,9 @@ pub const File = struct {
379379 const rc = windows.ntdll.NtQueryInformationFile(self.handle, &io_status_block, &info, @sizeOf(windows.FILE_ALL_INFORMATION), .FileAllInformation);
380380 switch (rc) {
381381 .SUCCESS => {},
382 // Buffer overflow here indicates that there is more information available than was able to be stored in the buffer
383 // size provided. This is treated as success because the type of variable-length information that this would be relevant for
384 // (name, volume name, etc) we don't care about.
382385 .BUFFER_OVERFLOW => {},
383386 .INVALID_PARAMETER => unreachable,
384387 .ACCESS_DENIED => return error.AccessDenied,
......@@ -830,6 +833,9 @@ pub const File = struct {
830833 const rc = windows.ntdll.NtQueryInformationFile(self.handle, &io_status_block, &info, @sizeOf(windows.FILE_ALL_INFORMATION), .FileAllInformation);
831834 switch (rc) {
832835 .SUCCESS => {},
836 // Buffer overflow here indicates that there is more information available than was able to be stored in the buffer
837 // size provided. This is treated as success because the type of variable-length information that this would be relevant for
838 // (name, volume name, etc) we don't care about.
833839 .BUFFER_OVERFLOW => {},
834840 .INVALID_PARAMETER => unreachable,
835841 .ACCESS_DENIED => return error.AccessDenied,