Update PhDeleteFile flags for RS5
@@ -2823,6 +2823,23 @@ NTSTATUS PhSetFileSize(
NTSTATUS PhDeleteFile(
_In_ HANDLE FileHandle
)
+{
+ if (WindowsVersion >= WINDOWS_10_RS5)
+ {
+ FILE_DISPOSITION_INFO_EX dispositionInfoEx;
+ IO_STATUS_BLOCK isb;
+
+ dispositionInfoEx.Flags = FILE_DISPOSITION_FLAG_DELETE | FILE_DISPOSITION_FLAG_IGNORE_READONLY_ATTRIBUTE;
+
+ return NtSetInformationFile(
+ FileHandle,
+ &isb,
+ &dispositionInfoEx,
+ sizeof(FILE_DISPOSITION_INFO_EX),
+ FileDispositionInformationEx
+ );
+ }
+ else
{
FILE_DISPOSITION_INFORMATION dispositionInfo;
IO_STATUS_BLOCK isb;
@@ -2837,6 +2854,7 @@ NTSTATUS PhDeleteFile(
FileDispositionInformation
);
}
+}
NTSTATUS PhGetFileHandleName(
_In_ HANDLE FileHandle,
@@ -7699,7 +7717,7 @@ static BOOLEAN PhpDeleteDirectoryCallback(
}
else
{
- if (Information->FileAttributes & FILE_ATTRIBUTE_READONLY)
+ if (WindowsVersion < WINDOWS_10_RS5 && (Information->FileAttributes & FILE_ATTRIBUTE_READONLY))
{
HANDLE fileHandle;
