From aa23179c36aa03beff2b0946ce1849962f708e41 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sat, 5 Aug 2017 00:05:47 +0200 Subject: [PATCH] ntdll-NtQueryVirtualMemory: Update patchset. --- ...uery-section-names-from-other-proces.patch | 33 ++++++++++--------- patches/patchinstall.sh | 4 +-- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/patches/ntdll-NtQueryVirtualMemory/0006-ntdll-Allow-to-query-section-names-from-other-proces.patch b/patches/ntdll-NtQueryVirtualMemory/0006-ntdll-Allow-to-query-section-names-from-other-proces.patch index e6a938bd..c1ba1945 100644 --- a/patches/ntdll-NtQueryVirtualMemory/0006-ntdll-Allow-to-query-section-names-from-other-proces.patch +++ b/patches/ntdll-NtQueryVirtualMemory/0006-ntdll-Allow-to-query-section-names-from-other-proces.patch @@ -1,19 +1,19 @@ -From d98c5a09b04c6082a085e313284379e70bb108b5 Mon Sep 17 00:00:00 2001 +From c0db9637afab090e25c807c011c632affdeb3097 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sun, 28 May 2017 05:44:38 +0200 -Subject: ntdll: Allow to query section names from other processes. +Subject: ntdll: Allow to query section names from other processes. (v2) --- dlls/ntdll/ntdll_misc.h | 1 + - dlls/ntdll/server.c | 12 ++++++++++++ + dlls/ntdll/server.c | 13 +++++++++++++ dlls/ntdll/virtual.c | 18 ++++++++++++++---- dlls/psapi/tests/psapi_main.c | 19 +++++++++++++++++++ server/protocol.def | 13 +++++++++++++ server/thread.c | 9 +++++++++ - 6 files changed, 68 insertions(+), 4 deletions(-) + 6 files changed, 69 insertions(+), 4 deletions(-) diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h -index 5e4c39e8bd6..0e7749af4c3 100644 +index c97b1e1f73f..52809112ce8 100644 --- a/dlls/ntdll/ntdll_misc.h +++ b/dlls/ntdll/ntdll_misc.h @@ -161,6 +161,7 @@ extern NTSTATUS nt_to_unix_file_name_attr( const OBJECT_ATTRIBUTES *attr, ANSI_S @@ -25,16 +25,17 @@ index 5e4c39e8bd6..0e7749af4c3 100644 extern NTSTATUS virtual_create_builtin_view( void *base ) DECLSPEC_HIDDEN; extern NTSTATUS virtual_alloc_thread_stack( TEB *teb, SIZE_T reserve_size, SIZE_T commit_size ) DECLSPEC_HIDDEN; diff --git a/dlls/ntdll/server.c b/dlls/ntdll/server.c -index c02a12ab19a..fa2802beb6b 100644 +index c02a12ab19a..290d7582f65 100644 --- a/dlls/ntdll/server.c +++ b/dlls/ntdll/server.c -@@ -464,6 +464,18 @@ static BOOL invoke_apc( const apc_call_t *call, apc_result_t *result ) +@@ -464,6 +464,19 @@ static BOOL invoke_apc( const apc_call_t *call, apc_result_t *result ) } break; } + case APC_VIRTUAL_SECTION: + { + HANDLE mapping; ++ result->type = call->type; + addr = wine_server_get_ptr( call->virtual_section.addr ); + if ((ULONG_PTR)addr == call->virtual_section.addr) + { @@ -48,10 +49,10 @@ index c02a12ab19a..fa2802beb6b 100644 result->type = call->type; addr = wine_server_get_ptr( call->virtual_protect.addr ); diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c -index 60f5f2946ba..80700437a45 100644 +index 82cb384a825..0e7df59281a 100644 --- a/dlls/ntdll/virtual.c +++ b/dlls/ntdll/virtual.c -@@ -2242,7 +2242,7 @@ static int get_free_mem_state_callback( void *start, size_t size, void *arg ) +@@ -2329,7 +2329,7 @@ static int get_free_mem_state_callback( void *start, size_t size, void *arg ) /* get the section mapping handle */ @@ -60,7 +61,7 @@ index 60f5f2946ba..80700437a45 100644 { struct file_view *view; NTSTATUS status = STATUS_INVALID_ADDRESS; -@@ -2251,8 +2251,18 @@ static NTSTATUS get_section_mapping( HANDLE process, LPCVOID addr, HANDLE *mappi +@@ -2338,8 +2338,18 @@ static NTSTATUS get_section_mapping( HANDLE process, LPCVOID addr, HANDLE *mappi if (process != NtCurrentProcess()) { @@ -81,7 +82,7 @@ index 60f5f2946ba..80700437a45 100644 } base = ROUND_ADDR( addr, page_mask ); -@@ -2408,7 +2418,7 @@ static NTSTATUS get_section_name( HANDLE process, LPCVOID addr, +@@ -2495,7 +2505,7 @@ static NTSTATUS get_section_name( HANDLE process, LPCVOID addr, if (!addr || !info || !res_len) return STATUS_INVALID_PARAMETER; @@ -135,7 +136,7 @@ index 56bf11a9a85..23025eedab3 100644 CloseHandle(hmap); } diff --git a/server/protocol.def b/server/protocol.def -index 2f043bef50d..7f509dce29c 100644 +index ca54b448ebb..504362702b8 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -448,6 +448,7 @@ enum apc_type @@ -173,10 +174,10 @@ index 2f043bef50d..7f509dce29c 100644 unsigned int status; /* status returned by call */ client_ptr_t addr; /* resulting address */ diff --git a/server/thread.c b/server/thread.c -index 10a5bf14b62..dc3323fe4dc 100644 +index 903420bed3f..d3cbcc298c3 100644 --- a/server/thread.c +++ b/server/thread.c -@@ -1481,6 +1481,14 @@ DECL_HANDLER(select) +@@ -1484,6 +1484,14 @@ DECL_HANDLER(select) apc->result.create_thread.handle = handle; clear_error(); /* ignore errors from the above calls */ } @@ -191,7 +192,7 @@ index 10a5bf14b62..dc3323fe4dc 100644 else if (apc->result.type == APC_ASYNC_IO) { if (apc->owner) -@@ -1541,6 +1549,7 @@ DECL_HANDLER(queue_apc) +@@ -1544,6 +1552,7 @@ DECL_HANDLER(queue_apc) process = get_process_from_handle( req->handle, PROCESS_VM_OPERATION ); break; case APC_VIRTUAL_QUERY: @@ -200,5 +201,5 @@ index 10a5bf14b62..dc3323fe4dc 100644 break; case APC_MAP_VIEW: -- -2.12.2 +2.13.1 diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 2e5b8f22..08f40df3 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -52,7 +52,7 @@ usage() # Get the upstream commit sha upstream_commit() { - echo "2d9e894d285937716a4541c7fab9152fdf0b495f" + echo "7aa4a25bd3d23b57ff990a151296dddb337a5767" } # Show version information @@ -6395,7 +6395,7 @@ if test "$enable_ntdll_NtQueryVirtualMemory" -eq 1; then 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.", 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' '+ { "Michael Müller", "ntdll: Fix error code when querying too large memory address.", 1 },';