From ced0f965148ba499d2d241fc223ee6879ad6e704 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 26 Nov 2019 14:53:46 +0300 Subject: [PATCH] ntdll-RtlGetNativeSystemInformation: Add patch. --- ...lGetNativeSystemInformation-function.patch | 62 +++++++++++++++++++ .../definition | 2 + patches/patchinstall.sh | 19 ++++++ 3 files changed, 83 insertions(+) create mode 100644 patches/ntdll-RtlGetNativeSystemInformation/0001-ntdll-Export-RtlGetNativeSystemInformation-function.patch create mode 100644 patches/ntdll-RtlGetNativeSystemInformation/definition diff --git a/patches/ntdll-RtlGetNativeSystemInformation/0001-ntdll-Export-RtlGetNativeSystemInformation-function.patch b/patches/ntdll-RtlGetNativeSystemInformation/0001-ntdll-Export-RtlGetNativeSystemInformation-function.patch new file mode 100644 index 00000000..ae280a89 --- /dev/null +++ b/patches/ntdll-RtlGetNativeSystemInformation/0001-ntdll-Export-RtlGetNativeSystemInformation-function.patch @@ -0,0 +1,62 @@ +From e0d94123b434f62e83bce3b4cfee2aef5ba0a9b9 Mon Sep 17 00:00:00 2001 +From: Paul Gofman +Date: Wed, 13 Nov 2019 11:01:13 +0300 +Subject: [PATCH] ntdll: Export RtlGetNativeSystemInformation() function. + +Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=40334 +--- + dlls/ntdll/ntdll.spec | 2 +- + dlls/ntdll/tests/info.c | 10 ++++++++++ + 2 files changed, 11 insertions(+), 1 deletion(-) + +diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec +index 93ebd31d57..3bb7f2e1f6 100644 +--- a/dlls/ntdll/ntdll.spec ++++ b/dlls/ntdll/ntdll.spec +@@ -699,7 +699,7 @@ + # Yes, Microsoft really misspelled this one! + # @ stub RtlGetLengthWithoutTrailingPathSeperators + @ stdcall RtlGetLongestNtPathLength() +-# @ stub RtlGetNativeSystemInformation ++@ stdcall -private RtlGetNativeSystemInformation(long ptr long ptr) NtQuerySystemInformation + # @ stub RtlGetNextRange + @ stdcall RtlGetNtGlobalFlags() + @ stdcall RtlGetNtProductType(ptr) +diff --git a/dlls/ntdll/tests/info.c b/dlls/ntdll/tests/info.c +index f19cb27439..7aae03cbc5 100644 +--- a/dlls/ntdll/tests/info.c ++++ b/dlls/ntdll/tests/info.c +@@ -24,6 +24,7 @@ + + static NTSTATUS (WINAPI * pRtlDowncaseUnicodeString)(UNICODE_STRING *, const UNICODE_STRING *, BOOLEAN); + static NTSTATUS (WINAPI * pNtQuerySystemInformation)(SYSTEM_INFORMATION_CLASS, PVOID, ULONG, PULONG); ++static NTSTATUS (WINAPI * pRtlGetNativeSystemInformation)(SYSTEM_INFORMATION_CLASS, PVOID, ULONG, PULONG); + static NTSTATUS (WINAPI * pNtQuerySystemInformationEx)(SYSTEM_INFORMATION_CLASS, void*, ULONG, void*, ULONG, ULONG*); + static NTSTATUS (WINAPI * pNtPowerInformation)(POWER_INFORMATION_LEVEL, PVOID, ULONG, PVOID, ULONG); + static NTSTATUS (WINAPI * pNtQueryInformationProcess)(HANDLE, PROCESSINFOCLASS, PVOID, ULONG, PULONG); +@@ -77,6 +78,7 @@ static BOOL InitFunctionPtrs(void) + + NTDLL_GET_PROC(RtlDowncaseUnicodeString); + NTDLL_GET_PROC(NtQuerySystemInformation); ++ NTDLL_GET_PROC(RtlGetNativeSystemInformation); + NTDLL_GET_PROC(NtPowerInformation); + NTDLL_GET_PROC(NtQueryInformationProcess); + NTDLL_GET_PROC(NtQueryInformationThread); +@@ -155,6 +157,14 @@ static void test_query_basic(void) + /* Check if we have some return values */ + trace("Number of Processors : %d\n", sbi.NumberOfProcessors); + ok( sbi.NumberOfProcessors > 0, "Expected more than 0 processors, got %d\n", sbi.NumberOfProcessors); ++ ++ memset(&sbi, 0, sizeof(sbi)); ++ status = pRtlGetNativeSystemInformation(SystemBasicInformation, &sbi, sizeof(sbi), &ReturnLength); ++ ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status); ++ ok( sizeof(sbi) == ReturnLength, "Inconsistent length %d\n", ReturnLength); ++ ++ trace("Number of Processors : %d\n", sbi.NumberOfProcessors); ++ ok( sbi.NumberOfProcessors > 0, "Expected more than 0 processors, got %d\n", sbi.NumberOfProcessors); + } + + static void test_query_cpu(void) +-- +2.23.0 + diff --git a/patches/ntdll-RtlGetNativeSystemInformation/definition b/patches/ntdll-RtlGetNativeSystemInformation/definition new file mode 100644 index 00000000..016344fe --- /dev/null +++ b/patches/ntdll-RtlGetNativeSystemInformation/definition @@ -0,0 +1,2 @@ +Fixes: [40334] AION - Wine /Unhandled exception: page fault on read access to 0x00000000 in 64-bit code (0x0000000000000000) + diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index c6d9ba94..079b5555 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -208,6 +208,7 @@ patch_enable_all () enable_ntdll_Pipe_SpecialCharacters="$1" enable_ntdll_ProcessQuotaLimits="$1" enable_ntdll_RtlCreateUserThread="$1" + enable_ntdll_RtlGetNativeSystemInformation="$1" enable_ntdll_RtlIpv4StringToAddress="$1" enable_ntdll_RtlQueryPackageIdentity="$1" enable_ntdll_Serial_Port_Detection="$1" @@ -747,6 +748,9 @@ patch_enable () ntdll-RtlCreateUserThread) enable_ntdll_RtlCreateUserThread="$2" ;; + ntdll-RtlGetNativeSystemInformation) + enable_ntdll_RtlGetNativeSystemInformation="$2" + ;; ntdll-RtlIpv4StringToAddress) enable_ntdll_RtlIpv4StringToAddress="$2" ;; @@ -4932,6 +4936,21 @@ if test "$enable_ntdll_ProcessQuotaLimits" -eq 1; then ) >> "$patchlist" fi +# Patchset ntdll-RtlGetNativeSystemInformation +# | +# | This patchset fixes the following Wine bugs: +# | * [#40334] AION - Wine /Unhandled exception: page fault on read access to 0x00000000 in 64-bit code (0x0000000000000000) +# | +# | Modified files: +# | * dlls/ntdll/ntdll.spec, dlls/ntdll/tests/info.c +# | +if test "$enable_ntdll_RtlGetNativeSystemInformation" -eq 1; then + patch_apply ntdll-RtlGetNativeSystemInformation/0001-ntdll-Export-RtlGetNativeSystemInformation-function.patch + ( + printf '%s\n' '+ { "Paul Gofman", "ntdll: Export RtlGetNativeSystemInformation() function.", 1 },'; + ) >> "$patchlist" +fi + # Patchset ntdll-RtlIpv4StringToAddress # | # | This patchset fixes the following Wine bugs: