diff --git a/patches/ntdll-MemoryWorkingSetExInformation/0002-ntdll-Stub-for-MemoryWorkingSetExInformation.patch b/patches/ntdll-MemoryWorkingSetExInformation/0002-ntdll-Stub-for-MemoryWorkingSetExInformation.patch new file mode 100644 index 00000000..28758017 --- /dev/null +++ b/patches/ntdll-MemoryWorkingSetExInformation/0002-ntdll-Stub-for-MemoryWorkingSetExInformation.patch @@ -0,0 +1,92 @@ +From fc6b868cee4657f9cb5b57a12cbb36a15faddd68 Mon Sep 17 00:00:00 2001 +From: Andrew Wesie +Date: Sat, 18 Aug 2018 15:48:10 -0500 +Subject: [PATCH] ntdll: Stub for MemoryWorkingSetExInformation. + +--- + dlls/ntdll/virtual.c | 22 ++++++++++++++++++++++ + include/winternl.h | 21 ++++++++++++++++++++- + 2 files changed, 42 insertions(+), 1 deletion(-) + +diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c +index 82b56b16..58563aaf 100644 +--- a/dlls/ntdll/virtual.c ++++ b/dlls/ntdll/virtual.c +@@ -3024,6 +3024,25 @@ found: + } + + ++static NTSTATUS get_working_set_ex( HANDLE process, LPCVOID addr, ++ MEMORY_WORKING_SET_EX_INFORMATION *info, ++ SIZE_T len, SIZE_T *res_len ) ++{ ++ MEMORY_WORKING_SET_EX_INFORMATION *p; ++ ++ for (p = info; (UINT_PTR)(p + 1) <= (UINT_PTR)info + len; p++) ++ { ++ FIXME("(VirtualAddress=%p) Unimplemented.\n", p->VirtualAddress); ++ /* FIXME Mark all addresses as invalid. */ ++ info->VirtualAttributes.Valid = 0; ++ } ++ ++ if (res_len) ++ *res_len = (UINT_PTR)p - (UINT_PTR)info; ++ return STATUS_SUCCESS; ++} ++ ++ + #define UNIMPLEMENTED_INFO_CLASS(c) \ + case c: \ + FIXME("(process=%p,addr=%p) Unimplemented information class: " #c "\n", process, addr); \ +@@ -3048,6 +3067,9 @@ NTSTATUS WINAPI NtQueryVirtualMemory( HANDLE process, LPCVOID addr, + case MemorySectionName: + return get_section_name( process, addr, buffer, len, res_len ); + ++ case MemoryWorkingSetExInformation: ++ return get_working_set_ex( process, addr, buffer, len, res_len ); ++ + UNIMPLEMENTED_INFO_CLASS(MemoryWorkingSetList); + UNIMPLEMENTED_INFO_CLASS(MemoryBasicVlmInformation); + +diff --git a/include/winternl.h b/include/winternl.h +index 46dac7e4..44c2f94a 100644 +--- a/include/winternl.h ++++ b/include/winternl.h +@@ -1042,7 +1042,8 @@ typedef enum _MEMORY_INFORMATION_CLASS { + MemoryBasicInformation, + MemoryWorkingSetList, + MemorySectionName, +- MemoryBasicVlmInformation ++ MemoryBasicVlmInformation, ++ MemoryWorkingSetExInformation, + } MEMORY_INFORMATION_CLASS; + + typedef struct _MEMORY_SECTION_NAME +@@ -1050,6 +1051,24 @@ typedef struct _MEMORY_SECTION_NAME + UNICODE_STRING SectionFileName; + } MEMORY_SECTION_NAME, *PMEMORY_SECTION_NAME; + ++typedef union _MEMORY_WORKING_SET_EX_BLOCK { ++ ULONG_PTR Flags; ++ struct { ++ ULONG_PTR Valid : 1; ++ ULONG_PTR ShareCount : 3; ++ ULONG_PTR Win32Protection : 11; ++ ULONG_PTR Shared : 1; ++ ULONG_PTR Node : 6; ++ ULONG_PTR Locked : 1; ++ ULONG_PTR LargePage : 1; ++ } DUMMYSTRUCTNAME; ++} MEMORY_WORKING_SET_EX_BLOCK, *PMEMORY_WORKING_SET_EX_BLOCK; ++ ++typedef struct _MEMORY_WORKING_SET_EX_INFORMATION { ++ PVOID VirtualAddress; ++ MEMORY_WORKING_SET_EX_BLOCK VirtualAttributes; ++} MEMORY_WORKING_SET_EX_INFORMATION, *PMEMORY_WORKING_SET_EX_INFORMATION; ++ + typedef enum _MUTANT_INFORMATION_CLASS + { + MutantBasicInformation +-- +2.20.1 + diff --git a/patches/ntdll-MemoryWorkingSetExInformation/definition b/patches/ntdll-MemoryWorkingSetExInformation/definition new file mode 100644 index 00000000..301dcc3e --- /dev/null +++ b/patches/ntdll-MemoryWorkingSetExInformation/definition @@ -0,0 +1,2 @@ +Fixes: [45667] League of Legends 8.15+ fails due to missing implementation of NtQueryVirtualMemory(MemoryWorkingSetExInformation) +Depends: ntdll-NtQueryVirtualMemory diff --git a/patches/ntdll-NtQueryVirtualMemory/0009-ntdll-Unsupported-stub-for-MemoryWorkingSetExInforma.patch b/patches/ntdll-NtQueryVirtualMemory/0009-ntdll-Unsupported-stub-for-MemoryWorkingSetExInforma.patch deleted file mode 100644 index 9bb80365..00000000 --- a/patches/ntdll-NtQueryVirtualMemory/0009-ntdll-Unsupported-stub-for-MemoryWorkingSetExInforma.patch +++ /dev/null @@ -1,41 +0,0 @@ -From cb8b12121ca11c88fcb78439ccd6b4f549e1895a Mon Sep 17 00:00:00 2001 -From: Andrew Wesie -Date: Mon, 23 Jul 2018 19:30:54 -0700 -Subject: [PATCH] ntdll: Unsupported stub for MemoryWorkingSetExInformation. - -Implemented in Windows Vista. This will cause programs to fail if Wine version -is higher than Windows XP / 2003. ---- - dlls/ntdll/virtual.c | 1 + - include/winternl.h | 3 ++- - 2 files changed, 3 insertions(+), 1 deletion(-) - -diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c -index 36f0aef..a39ca94 100644 ---- a/dlls/ntdll/virtual.c -+++ b/dlls/ntdll/virtual.c -@@ -3135,6 +3135,7 @@ NTSTATUS WINAPI NtQueryVirtualMemory( HANDLE process, LPCVOID addr, - - UNIMPLEMENTED_INFO_CLASS(MemoryWorkingSetList); - UNIMPLEMENTED_INFO_CLASS(MemoryBasicVlmInformation); -+ UNIMPLEMENTED_INFO_CLASS(MemoryWorkingSetExInformation); - - default: - FIXME("(%p,%p,info_class=%d,%p,%ld,%p) Unknown information class\n", -diff --git a/include/winternl.h b/include/winternl.h -index 2ea22ed..8924d76 100644 ---- a/include/winternl.h -+++ b/include/winternl.h -@@ -1038,7 +1038,8 @@ typedef enum _MEMORY_INFORMATION_CLASS { - MemoryBasicInformation, - MemoryWorkingSetList, - MemorySectionName, -- MemoryBasicVlmInformation -+ MemoryBasicVlmInformation, -+ MemoryWorkingSetExInformation - } MEMORY_INFORMATION_CLASS; - - typedef struct _MEMORY_SECTION_NAME --- -1.9.1 - diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 86d05c82..13f42e94 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -205,6 +205,7 @@ patch_enable_all () enable_ntdll_Junction_Points="$1" enable_ntdll_LDR_MODULE="$1" enable_ntdll_Manifest_Range="$1" + enable_ntdll_MemoryWorkingSetExInformation="$1" enable_ntdll_NtAccessCheck="$1" enable_ntdll_NtContinue="$1" enable_ntdll_NtDevicePath="$1" @@ -767,6 +768,9 @@ patch_enable () ntdll-Manifest_Range) enable_ntdll_Manifest_Range="$2" ;; + ntdll-MemoryWorkingSetExInformation) + enable_ntdll_MemoryWorkingSetExInformation="$2" + ;; ntdll-NtAccessCheck) enable_ntdll_NtAccessCheck="$2" ;; @@ -1934,20 +1938,6 @@ if test "$enable_ntdll_NtSuspendProcess" -eq 1; then enable_kernel32_K32GetPerformanceInfo=1 fi -if test "$enable_ntdll_NtQueryVirtualMemory" -eq 1; then - if test "$enable_ntdll_NtDevicePath" -gt 1; then - abort "Patchset ntdll-NtDevicePath disabled, but ntdll-NtQueryVirtualMemory depends on that." - fi - enable_ntdll_NtDevicePath=1 -fi - -if test "$enable_ntdll_NtDevicePath" -eq 1; then - if test "$enable_ntdll_Pipe_SpecialCharacters" -gt 1; then - abort "Patchset ntdll-Pipe_SpecialCharacters disabled, but ntdll-NtDevicePath depends on that." - fi - enable_ntdll_Pipe_SpecialCharacters=1 -fi - if test "$enable_ntdll_NtContinue" -eq 1; then if test "$enable_winebuild_Fake_Dlls" -gt 1; then abort "Patchset winebuild-Fake_Dlls disabled, but ntdll-NtContinue depends on that." @@ -1962,6 +1952,27 @@ if test "$enable_winebuild_Fake_Dlls" -eq 1; then enable_ntdll_User_Shared_Data=1 fi +if test "$enable_ntdll_MemoryWorkingSetExInformation" -eq 1; then + if test "$enable_ntdll_NtQueryVirtualMemory" -gt 1; then + abort "Patchset ntdll-NtQueryVirtualMemory disabled, but ntdll-MemoryWorkingSetExInformation depends on that." + fi + enable_ntdll_NtQueryVirtualMemory=1 +fi + +if test "$enable_ntdll_NtQueryVirtualMemory" -eq 1; then + if test "$enable_ntdll_NtDevicePath" -gt 1; then + abort "Patchset ntdll-NtDevicePath disabled, but ntdll-NtQueryVirtualMemory depends on that." + fi + enable_ntdll_NtDevicePath=1 +fi + +if test "$enable_ntdll_NtDevicePath" -eq 1; then + if test "$enable_ntdll_Pipe_SpecialCharacters" -gt 1; then + abort "Patchset ntdll-Pipe_SpecialCharacters disabled, but ntdll-NtDevicePath depends on that." + fi + enable_ntdll_Pipe_SpecialCharacters=1 +fi + if test "$enable_ntdll_Junction_Points" -eq 1; then if test "$enable_ntdll_NtQueryEaFile" -gt 1; then abort "Patchset ntdll-NtQueryEaFile disabled, but ntdll-Junction_Points depends on that." @@ -4565,6 +4576,90 @@ if test "$enable_ntdll_Manifest_Range" -eq 1; then ) >> "$patchlist" fi +# Patchset ntdll-Pipe_SpecialCharacters +# | +# | This patchset fixes the following Wine bugs: +# | * [#28995] Allow special characters in pipe names +# | +# | Modified files: +# | * dlls/kernel32/tests/pipe.c, dlls/ntdll/directory.c +# | +if test "$enable_ntdll_Pipe_SpecialCharacters" -eq 1; then + patch_apply ntdll-Pipe_SpecialCharacters/0001-ntdll-Allow-special-characters-in-pipe-names.patch + ( + printf '%s\n' '+ { "Michael Müller", "ntdll: Allow special characters in pipe names.", 1 },'; + ) >> "$patchlist" +fi + +# Patchset ntdll-NtDevicePath +# | +# | This patchset has the following (direct or indirect) dependencies: +# | * ntdll-Pipe_SpecialCharacters +# | +# | This patchset fixes the following Wine bugs: +# | * [#37487] Resolve \\SystemRoot\\ prefix when opening files +# | +# | Modified files: +# | * dlls/ntdll/directory.c, dlls/ntdll/tests/file.c +# | +if test "$enable_ntdll_NtDevicePath" -eq 1; then + patch_apply ntdll-NtDevicePath/0001-ntdll-Implement-opening-files-through-nt-device-path.patch + ( + printf '%s\n' '+ { "Michael Müller", "ntdll: Implement opening files through nt device paths.", 1 },'; + ) >> "$patchlist" +fi + +# Patchset ntdll-NtQueryVirtualMemory +# | +# | This patchset has the following (direct or indirect) dependencies: +# | * ntdll-Pipe_SpecialCharacters, ntdll-NtDevicePath +# | +# | This patchset fixes the following Wine bugs: +# | * [#23999] Implement MemorySectionName class in NtQueryVirtualMemory +# | * [#27248] Implement K32GetMappedFileName +# | +# | Modified files: +# | * dlls/kernel32/virtual.c, dlls/ntdll/directory.c, dlls/ntdll/ntdll_misc.h, dlls/ntdll/tests/info.c, dlls/ntdll/virtual.c, +# | dlls/psapi/tests/psapi_main.c, server/mapping.c, server/protocol.def +# | +if test "$enable_ntdll_NtQueryVirtualMemory" -eq 1; then + patch_apply ntdll-NtQueryVirtualMemory/0002-ntdll-Split-logic-for-MemoryBasicInformation-into-a-.patch + patch_apply ntdll-NtQueryVirtualMemory/0003-ntdll-Implement-NtQueryVirtualMemory-MemorySectionNa.patch + patch_apply ntdll-NtQueryVirtualMemory/0004-ntdll-tests-Add-tests-for-NtQueryVirtualMemory-Memor.patch + patch_apply ntdll-NtQueryVirtualMemory/0005-ntdll-tests-Add-test-to-ensure-section-name-is-full-.patch + patch_apply ntdll-NtQueryVirtualMemory/0006-ntdll-Allow-to-query-section-names-from-other-proces.patch + patch_apply ntdll-NtQueryVirtualMemory/0007-kernel32-Implement-K32GetMappedFileName.-v2.patch + patch_apply ntdll-NtQueryVirtualMemory/0008-ntdll-Resolve-drive-symlinks-before-returning-sectio.patch + ( + printf '%s\n' '+ { "Dmitry Timoshkov", "ntdll: Split logic for MemoryBasicInformation into a separate function.", 1 },'; + printf '%s\n' '+ { "Dmitry Timoshkov", "ntdll: Implement NtQueryVirtualMemory(MemorySectionName).", 3 },'; + printf '%s\n' '+ { "Dmitry Timoshkov", "ntdll/tests: Add tests for NtQueryVirtualMemory(MemorySectionName).", 1 },'; + printf '%s\n' '+ { "Sebastian Lackner", "ntdll/tests: Add test to ensure section name is full path.", 1 },'; + printf '%s\n' '+ { "Sebastian Lackner", "ntdll: Allow to query section names from other processes.", 2 },'; + printf '%s\n' '+ { "Dmitry Timoshkov", "kernel32: Implement K32GetMappedFileName.", 2 },'; + printf '%s\n' '+ { "Sebastian Lackner", "ntdll: Resolve drive symlinks before returning section name.", 1 },'; + ) >> "$patchlist" +fi + +# Patchset ntdll-MemoryWorkingSetExInformation +# | +# | This patchset has the following (direct or indirect) dependencies: +# | * ntdll-Pipe_SpecialCharacters, ntdll-NtDevicePath, ntdll-NtQueryVirtualMemory +# | +# | This patchset fixes the following Wine bugs: +# | * [#45667] League of Legends 8.15+ fails due to missing implementation of +# | NtQueryVirtualMemory(MemoryWorkingSetExInformation) +# | +# | Modified files: +# | * dlls/ntdll/virtual.c, include/winternl.h +# | +if test "$enable_ntdll_MemoryWorkingSetExInformation" -eq 1; then + patch_apply ntdll-MemoryWorkingSetExInformation/0002-ntdll-Stub-for-MemoryWorkingSetExInformation.patch + ( + printf '%s\n' '+ { "Andrew Wesie", "ntdll: Stub for MemoryWorkingSetExInformation.", 1 },'; + ) >> "$patchlist" +fi + # Patchset ntdll-NtAccessCheck # | # | Modified files: @@ -4644,39 +4739,6 @@ if test "$enable_ntdll_NtContinue" -eq 1; then ) >> "$patchlist" fi -# Patchset ntdll-Pipe_SpecialCharacters -# | -# | This patchset fixes the following Wine bugs: -# | * [#28995] Allow special characters in pipe names -# | -# | Modified files: -# | * dlls/kernel32/tests/pipe.c, dlls/ntdll/directory.c -# | -if test "$enable_ntdll_Pipe_SpecialCharacters" -eq 1; then - patch_apply ntdll-Pipe_SpecialCharacters/0001-ntdll-Allow-special-characters-in-pipe-names.patch - ( - printf '%s\n' '+ { "Michael Müller", "ntdll: Allow special characters in pipe names.", 1 },'; - ) >> "$patchlist" -fi - -# Patchset ntdll-NtDevicePath -# | -# | This patchset has the following (direct or indirect) dependencies: -# | * ntdll-Pipe_SpecialCharacters -# | -# | This patchset fixes the following Wine bugs: -# | * [#37487] Resolve \\SystemRoot\\ prefix when opening files -# | -# | Modified files: -# | * dlls/ntdll/directory.c, dlls/ntdll/tests/file.c -# | -if test "$enable_ntdll_NtDevicePath" -eq 1; then - patch_apply ntdll-NtDevicePath/0001-ntdll-Implement-opening-files-through-nt-device-path.patch - ( - printf '%s\n' '+ { "Michael Müller", "ntdll: Implement opening files through nt device paths.", 1 },'; - ) >> "$patchlist" -fi - # Patchset ntdll-NtQuerySection # | # | Modified files: @@ -4689,40 +4751,6 @@ if test "$enable_ntdll_NtQuerySection" -eq 1; then ) >> "$patchlist" fi -# Patchset ntdll-NtQueryVirtualMemory -# | -# | This patchset has the following (direct or indirect) dependencies: -# | * ntdll-Pipe_SpecialCharacters, ntdll-NtDevicePath -# | -# | This patchset fixes the following Wine bugs: -# | * [#23999] Implement MemorySectionName class in NtQueryVirtualMemory -# | * [#27248] Implement K32GetMappedFileName -# | -# | Modified files: -# | * dlls/kernel32/virtual.c, dlls/ntdll/directory.c, dlls/ntdll/ntdll_misc.h, dlls/ntdll/tests/info.c, dlls/ntdll/virtual.c, -# | dlls/psapi/tests/psapi_main.c, include/winternl.h, server/mapping.c, server/protocol.def -# | -if test "$enable_ntdll_NtQueryVirtualMemory" -eq 1; then - patch_apply ntdll-NtQueryVirtualMemory/0002-ntdll-Split-logic-for-MemoryBasicInformation-into-a-.patch - patch_apply ntdll-NtQueryVirtualMemory/0003-ntdll-Implement-NtQueryVirtualMemory-MemorySectionNa.patch - patch_apply ntdll-NtQueryVirtualMemory/0004-ntdll-tests-Add-tests-for-NtQueryVirtualMemory-Memor.patch - patch_apply ntdll-NtQueryVirtualMemory/0005-ntdll-tests-Add-test-to-ensure-section-name-is-full-.patch - patch_apply ntdll-NtQueryVirtualMemory/0006-ntdll-Allow-to-query-section-names-from-other-proces.patch - patch_apply ntdll-NtQueryVirtualMemory/0007-kernel32-Implement-K32GetMappedFileName.-v2.patch - patch_apply ntdll-NtQueryVirtualMemory/0008-ntdll-Resolve-drive-symlinks-before-returning-sectio.patch - patch_apply ntdll-NtQueryVirtualMemory/0009-ntdll-Unsupported-stub-for-MemoryWorkingSetExInforma.patch - ( - printf '%s\n' '+ { "Dmitry Timoshkov", "ntdll: Split logic for MemoryBasicInformation into a separate function.", 1 },'; - printf '%s\n' '+ { "Dmitry Timoshkov", "ntdll: Implement NtQueryVirtualMemory(MemorySectionName).", 3 },'; - printf '%s\n' '+ { "Dmitry Timoshkov", "ntdll/tests: Add tests for NtQueryVirtualMemory(MemorySectionName).", 1 },'; - printf '%s\n' '+ { "Sebastian Lackner", "ntdll/tests: Add test to ensure section name is full path.", 1 },'; - printf '%s\n' '+ { "Sebastian Lackner", "ntdll: Allow to query section names from other processes.", 2 },'; - printf '%s\n' '+ { "Dmitry Timoshkov", "kernel32: Implement K32GetMappedFileName.", 2 },'; - printf '%s\n' '+ { "Sebastian Lackner", "ntdll: Resolve drive symlinks before returning section name.", 1 },'; - printf '%s\n' '+ { "Andrew Wesie", "ntdll: Unsupported stub for MemoryWorkingSetExInformation.", 1 },'; - ) >> "$patchlist" -fi - # Patchset ntdll-NtSetLdtEntries # | # | Modified files: