aboutsummaryrefslogtreecommitdiff
path: root/src/windows_sdk.cpp
diff options
context:
space:
mode:
authorRyan Liptak <squeek502@hotmail.com>2023-07-22 23:27:11 -0700
committerRyan Liptak <squeek502@hotmail.com>2023-07-23 01:26:26 -0700
commit1ae378e7a253ec845d8ee8d52b5505c9aa177369 (patch)
tree9870995f852bef3b240fd3375edfdecdba1eb855 /src/windows_sdk.cpp
parent1bf16b1723445ba307ca556dc050d6d13bb0ebff (diff)
downloadzig-1ae378e7a253ec845d8ee8d52b5505c9aa177369.tar.gz
zig-1ae378e7a253ec845d8ee8d52b5505c9aa177369.zip
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
Diffstat (limited to 'src/windows_sdk.cpp')
0 files changed, 0 insertions, 0 deletions