ntdll-NtQueryVirtualMemory: Skip get_dll_info wineserver call if address does not have VPROT_IMAGE permissions.

This commit is contained in:
Sebastian Lackner
2017-05-28 16:16:15 +02:00
parent f957d2a812
commit 033c4b149f
2 changed files with 57 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
From 9b91067e59331f33825d0a5bc3e1f86f67714830 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sun, 28 May 2017 16:14:03 +0200
Subject: ntdll: Skip get_dll_info wineserver call if address does not have
VPROT_IMAGE permissions.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
As suggested by Michael Müller.
---
dlls/ntdll/virtual.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
index a5c3ce69185..0d5150aaf93 100644
--- a/dlls/ntdll/virtual.c
+++ b/dlls/ntdll/virtual.c
@@ -2271,10 +2271,18 @@ NTSTATUS virtual_get_section_mapping( HANDLE process, LPCVOID addr, HANDLE *mapp
base = ROUND_ADDR( addr, page_mask );
server_enter_uninterrupted_section( &csVirtual, &sigset );
- if ((view = VIRTUAL_FindView( base, 0 )) && view->mapping)
+ if ((view = VIRTUAL_FindView( base, 0 )))
{
- status = NtDuplicateObject( NtCurrentProcess(), view->mapping, NtCurrentProcess(),
- mapping, 0, 0, DUP_HANDLE_SAME_ACCESS );
+ if (view->mapping)
+ {
+ status = NtDuplicateObject( NtCurrentProcess(), view->mapping, NtCurrentProcess(),
+ mapping, 0, 0, DUP_HANDLE_SAME_ACCESS );
+ }
+ else if (view->protect & VPROT_IMAGE)
+ {
+ *mapping = NULL;
+ status = STATUS_SUCCESS;
+ }
}
server_leave_uninterrupted_section( &csVirtual, &sigset );
return status;
@@ -2424,7 +2432,10 @@ static NTSTATUS get_section_name( HANDLE process, LPCVOID addr,
if (!addr || !info || !res_len) return STATUS_INVALID_PARAMETER;
- if (!(status = virtual_get_section_mapping( process, addr, &mapping )))
+ if ((status = virtual_get_section_mapping( process, addr, &mapping )))
+ return status;
+
+ if (mapping)
{
status = server_get_unix_name( mapping, &unix_name );
close_handle( mapping );
--
2.12.2