From 18ac961ac9d97e0ae0495e24ff7a5860282648d3 Mon Sep 17 00:00:00 2001 From: Jamie Reece Wilson Date: Wed, 13 Sep 2023 03:30:54 +0100 Subject: [PATCH] [*] (dwFlags & 0x4ffff7) && (!pCreateFile2) check [*] (dwAttributes & 0xFFB00008) && (!pCreateFile2) --- Source/AuProcAddresses.NT.cpp | 36 ++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/Source/AuProcAddresses.NT.cpp b/Source/AuProcAddresses.NT.cpp index 8868f9c6..a6f18ff3 100644 --- a/Source/AuProcAddresses.NT.cpp +++ b/Source/AuProcAddresses.NT.cpp @@ -313,22 +313,26 @@ namespace Aurora attrs.nLength = sizeof(attrs); attrs.bInheritHandle = bInherit ? TRUE : FALSE; + if ((dwFlags & 0x4ffff7) && + (!pCreateFile2)) + { + SysPushErrorFeatureMissing("Do not use Windows8+ attributes/flags under Win32Open"); + return INVALID_HANDLE_VALUE; + } + + if ((dwAttributes & 0xFFB00008) && + (!pCreateFile2)) + { + SysPushErrorFeatureMissing("Do not use Windows8+ attributes/flags under Win32Open"); + return INVALID_HANDLE_VALUE; + } + if (!dwAttributes) { dwAttributes = FILE_ATTRIBUTE_NORMAL; } - if (pCreateFileW) - { - return pCreateFileW(lpFileName, - dwDesiredAccess, - dwShareMode, - &attrs, - dwCreationDisposition, - dwFlags | dwAttributes, - NULL); - } - else if (pCreateFile2) + if (pCreateFile2) { _CREATEFILE2_EXTENDED_PARAMETERS params {}; @@ -350,6 +354,16 @@ namespace Aurora dwCreationDisposition, ¶ms); } + else if (pCreateFileW) + { + return pCreateFileW(lpFileName, + dwDesiredAccess, + dwShareMode, + &attrs, + dwCreationDisposition, + dwFlags | dwAttributes, + NULL); + } else { return INVALID_HANDLE_VALUE;