zig/lib/std/os
Ryan Liptak 1ae378e7a2 windows.DeleteFile: Use FileDispositionInformationEx if possible, but fallback if not
Using FileDispositionInformationEx (and therefore flags like FILE_DISPOSITION_POSIX_SEMANTICS and FILE_DISPOSITION_IGNORE_READONLY_ATTRIBUTE) is only supported on NTFS, so the comptime Windows version range check is not enough to determine whether or not the NtSetInformationFile will succeed.

This commit makes DeleteFile always try using FileDispositionInformationEx first, but if INVALID_PARAMETER is received (which is the status that occurs when the filesystem doesn't support FileDispositionInformationEx), then it will fallback and try calling NtSetInformationFile with FileDispositionInformation.

This keeps NTFS as fast as it was before, since it will do at most 1 NtSetInformationFile call, but on non-NTFS filesystems (e.g. FAT32), DeleteFile may need to do 2 NtSetInformationFile calls.

Closes #16497
2023-07-23 01:26:26 -07:00
..
linux linux: rework getcontext to closer match the specification (saved IP/SP match the state after it would return) 2023-07-20 22:58:14 -04:00
plan9 all: zig fmt and rename "@XToY" to "@YFromX" 2023-06-19 12:34:42 -07:00
uefi more UEFI alignment fixes 2023-07-20 12:46:33 -07:00
windows debug: fix reading -gdwarf generated debug sections in COFF files 2023-07-20 22:58:14 -04:00
linux.zig debug: fix initialization of the optional fields on StackIterator 2023-07-20 22:58:15 -04:00
plan9.zig all: migrate code to new cast builtin syntax 2023-06-24 16:56:39 -07:00
test.zig all: migrate code to new cast builtin syntax 2023-06-24 16:56:39 -07:00
uefi.zig std.os.uefi: use std.os.uefi.cc instead of .C as calling convention 2023-07-08 17:32:36 -04:00
wasi.zig all: migrate code to new cast builtin syntax 2023-06-24 16:56:39 -07:00
windows.zig windows.DeleteFile: Use FileDispositionInformationEx if possible, but fallback if not 2023-07-23 01:26:26 -07:00