From e6cdf018d301e9fb26f2ff26f6d8f1e6dc5cb945 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Fri, 22 Jan 2016 17:43:29 +0100 Subject: [PATCH] Added patch to implement SystemRecommendedSharedDataAlignment class in NtQuerySystemInformation. --- ...-constants-to-SYSTEM_INFORMATION_CLA.patch | 70 +++++++++++++++++++ ...SystemRecommendedSharedDataAlignment.patch | 70 +++++++++++++++++++ .../definition | 1 + patches/patchinstall.sh | 18 +++++ 4 files changed, 159 insertions(+) create mode 100644 patches/ntdll-SystemRecommendedSharedDataAlignment/0001-include-Add-more-constants-to-SYSTEM_INFORMATION_CLA.patch create mode 100644 patches/ntdll-SystemRecommendedSharedDataAlignment/0002-ntdll-Implement-SystemRecommendedSharedDataAlignment.patch create mode 100644 patches/ntdll-SystemRecommendedSharedDataAlignment/definition diff --git a/patches/ntdll-SystemRecommendedSharedDataAlignment/0001-include-Add-more-constants-to-SYSTEM_INFORMATION_CLA.patch b/patches/ntdll-SystemRecommendedSharedDataAlignment/0001-include-Add-more-constants-to-SYSTEM_INFORMATION_CLA.patch new file mode 100644 index 00000000..feb3607b --- /dev/null +++ b/patches/ntdll-SystemRecommendedSharedDataAlignment/0001-include-Add-more-constants-to-SYSTEM_INFORMATION_CLA.patch @@ -0,0 +1,70 @@ +From 8ffb502a5289e9bd56ae02d292f19c67b94e2b19 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Michael=20M=C3=BCller?= +Date: Thu, 21 Jan 2016 00:28:15 +0100 +Subject: include: Add more constants to SYSTEM_INFORMATION_CLASS. + +--- + include/winternl.h | 46 +++++++++++++++++++++++++++------------------- + 1 file changed, 27 insertions(+), 19 deletions(-) + +diff --git a/include/winternl.h b/include/winternl.h +index 3494c00..e665a47 100644 +--- a/include/winternl.h ++++ b/include/winternl.h +@@ -822,26 +822,34 @@ typedef enum _SYSTEM_INFORMATION_CLASS { + SystemVerifierInformation = 51, + SystemAddVerifier = 52, + SystemSessionProcessesInformation = 53, +- Unknown54, +- Unknown55, +- Unknown56, +- Unknown57, +- Unknown58, +- Unknown59, +- Unknown60, +- Unknown61, +- Unknown62, +- Unknown63, +- Unknown64, +- Unknown65, +- Unknown66, +- Unknown67, +- Unknown68, +- Unknown69, +- Unknown70, +- Unknown71, +- Unknown72, ++ SystemLoadGdiDriverInSystemSpace = 54, ++ SystemNumaProcessorMap = 55, ++ SystemPrefetcherInformation = 56, ++ SystemExtendedProcessInformation = 57, ++ SystemRecommendedSharedDataAlignment = 58, ++ SystemComPlusPackage = 59, ++ SystemNumaAvailableMemory = 60, ++ SystemProcessorPowerInformation = 61, ++ SystemEmulationBasicInformation = 62, ++ SystemEmulationProcessorInformation = 63, ++ SystemExtendedHandleInformation = 64, ++ SystemLostDelayedWriteInformation = 65, ++ SystemBigPoolInformation = 66, ++ SystemSessionPoolTagInformation = 67, ++ SystemSessionMappedViewInformation = 68, ++ SystemHotpatchInformation = 69, ++ SystemObjectSecurityMode = 70, ++ SystemWatchdogTimerHandler = 71, ++ SystemWatchdogTimerInformation = 72, + SystemLogicalProcessorInformation = 73, ++ SystemWow64SharedInformation = 74, ++ SystemRegisterFirmwareTableInformationHandler = 75, ++ SystemFirmwareTableInformation = 76, ++ SystemModuleInformationEx = 77, ++ SystemVerifierTriageInformation = 78, ++ SystemSuperfetchInformation = 79, ++ SystemMemoryListInformation = 80, ++ SystemFileCacheInformationEx = 81, + SystemLogicalProcessorInformationEx = 107, + SystemInformationClassMax + } SYSTEM_INFORMATION_CLASS, *PSYSTEM_INFORMATION_CLASS; +-- +2.6.4 + diff --git a/patches/ntdll-SystemRecommendedSharedDataAlignment/0002-ntdll-Implement-SystemRecommendedSharedDataAlignment.patch b/patches/ntdll-SystemRecommendedSharedDataAlignment/0002-ntdll-Implement-SystemRecommendedSharedDataAlignment.patch new file mode 100644 index 00000000..0df4b19e --- /dev/null +++ b/patches/ntdll-SystemRecommendedSharedDataAlignment/0002-ntdll-Implement-SystemRecommendedSharedDataAlignment.patch @@ -0,0 +1,70 @@ +From f5437d47185217d5c82ae09301ad92a6d22e55c9 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Michael=20M=C3=BCller?= +Date: Thu, 21 Jan 2016 00:30:31 +0100 +Subject: ntdll: Implement SystemRecommendedSharedDataAlignment class in + NtQuerySystemInformation. + +--- + dlls/ntdll/nt.c | 11 +++++++++++ + dlls/ntdll/tests/info.c | 16 ++++++++++++++++ + 2 files changed, 27 insertions(+) + +diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c +index 9ee1923..e28b21f 100644 +--- a/dlls/ntdll/nt.c ++++ b/dlls/ntdll/nt.c +@@ -2155,6 +2155,17 @@ NTSTATUS WINAPI NtQuerySystemInformation( + RtlFreeHeap(GetProcessHeap(), 0, buf); + } + break; ++ case SystemRecommendedSharedDataAlignment: ++ { ++ len = sizeof(DWORD); ++ if (Length >= len) ++ { ++ if (!SystemInformation) ret = STATUS_ACCESS_VIOLATION; ++ else *((DWORD *)SystemInformation) = 64; ++ } ++ else ret = STATUS_INFO_LENGTH_MISMATCH; ++ } ++ break; + default: + FIXME("(0x%08x,%p,0x%08x,%p) stub\n", + SystemInformationClass,SystemInformation,Length,ResultLength); +diff --git a/dlls/ntdll/tests/info.c b/dlls/ntdll/tests/info.c +index 252736e..e8ad0bf 100644 +--- a/dlls/ntdll/tests/info.c ++++ b/dlls/ntdll/tests/info.c +@@ -1929,6 +1929,19 @@ static void test_thread_start_address(void) + CloseHandle(thread); + } + ++static void test_query_data_alignment(void) ++{ ++ ULONG ReturnLength; ++ NTSTATUS status; ++ DWORD value; ++ ++ value = 0xdeadbeef; ++ status = pNtQuerySystemInformation(SystemRecommendedSharedDataAlignment, &value, sizeof(value), &ReturnLength); ++ ok(status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status); ++ ok(sizeof(value) == ReturnLength, "Inconsistent length %u\n", ReturnLength); ++ ok(value == 64, "Expected 64, got %u\n", value); ++} ++ + START_TEST(info) + { + char **argv; +@@ -1995,6 +2008,9 @@ START_TEST(info) + test_query_logicalproc(); + test_query_logicalprocex(); + ++ trace("Starting test_query_data_alignment()\n"); ++ test_query_data_alignment(); ++ + /* NtPowerInformation */ + + /* 0xb ProcessorInformation */ +-- +2.6.4 + diff --git a/patches/ntdll-SystemRecommendedSharedDataAlignment/definition b/patches/ntdll-SystemRecommendedSharedDataAlignment/definition new file mode 100644 index 00000000..7ca7ce3c --- /dev/null +++ b/patches/ntdll-SystemRecommendedSharedDataAlignment/definition @@ -0,0 +1 @@ +Fixes: Implement SystemRecommendedSharedDataAlignment class in NtQuerySystemInformation diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 230f5147..8db60cd8 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -221,6 +221,7 @@ patch_enable_all () enable_ntdll_Status_Mapping="$1" enable_ntdll_Syscall_Wrappers="$1" enable_ntdll_SystemInterruptInformation="$1" + enable_ntdll_SystemRecommendedSharedDataAlignment="$1" enable_ntdll_SystemRoot_Symlink="$1" enable_ntdll_ThreadTime="$1" enable_ntdll_Threading="$1" @@ -801,6 +802,9 @@ patch_enable () ntdll-SystemInterruptInformation) enable_ntdll_SystemInterruptInformation="$2" ;; + ntdll-SystemRecommendedSharedDataAlignment) + enable_ntdll_SystemRecommendedSharedDataAlignment="$2" + ;; ntdll-SystemRoot_Symlink) enable_ntdll_SystemRoot_Symlink="$2" ;; @@ -4824,6 +4828,20 @@ if test "$enable_ntdll_SystemInterruptInformation" -eq 1; then ) >> "$patchlist" fi +# Patchset ntdll-SystemRecommendedSharedDataAlignment +# | +# | Modified files: +# | * dlls/ntdll/nt.c, dlls/ntdll/tests/info.c, include/winternl.h +# | +if test "$enable_ntdll_SystemRecommendedSharedDataAlignment" -eq 1; then + patch_apply ntdll-SystemRecommendedSharedDataAlignment/0001-include-Add-more-constants-to-SYSTEM_INFORMATION_CLA.patch + patch_apply ntdll-SystemRecommendedSharedDataAlignment/0002-ntdll-Implement-SystemRecommendedSharedDataAlignment.patch + ( + echo '+ { "Michael Müller", "include: Add more constants to SYSTEM_INFORMATION_CLASS.", 1 },'; + echo '+ { "Michael Müller", "ntdll: Implement SystemRecommendedSharedDataAlignment class in NtQuerySystemInformation.", 1 },'; + ) >> "$patchlist" +fi + # Patchset ntdll-SystemRoot_Symlink # | # | This patchset has the following (direct or indirect) dependencies: