[PATCH v4 2/3] ntdll: Scan pages only once in get_basic_memory_info().
Paul Gofman
pgofman at codeweavers.com
Mon Sep 20 14:38:50 CDT 2021
Signed-off-by: Paul Gofman <pgofman at codeweavers.com>
---
dlls/ntdll/unix/virtual.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c
index 85739866ce1..fef66061d4a 100644
--- a/dlls/ntdll/unix/virtual.c
+++ b/dlls/ntdll/unix/virtual.c
@@ -4215,7 +4215,13 @@ static NTSTATUS get_basic_memory_info( HANDLE process, LPCVOID addr,
else
{
BYTE vprot;
- SIZE_T range_size = get_committed_size( view, base, &vprot );
+ SIZE_T range_size;
+
+ if (view->protect & SEC_RESERVE)
+ range_size = get_committed_size( view, base, &vprot );
+ else
+ range_size = view->size - (base - (char *)view->base);
+ info->RegionSize = get_vprot_range_size( base, range_size, ~VPROT_WRITEWATCH, &vprot );
info->State = (vprot & VPROT_COMMITTED) ? MEM_COMMIT : MEM_RESERVE;
info->Protect = (vprot & VPROT_COMMITTED) ? get_win32_prot( vprot, view->protect ) : 0;
@@ -4223,8 +4229,6 @@ static NTSTATUS get_basic_memory_info( HANDLE process, LPCVOID addr,
if (view->protect & SEC_IMAGE) info->Type = MEM_IMAGE;
else if (view->protect & (SEC_FILE | SEC_RESERVE | SEC_COMMIT)) info->Type = MEM_MAPPED;
else info->Type = MEM_PRIVATE;
-
- info->RegionSize = get_vprot_range_size( base, range_size, ~VPROT_WRITEWATCH, &vprot );
}
server_leave_uninterrupted_section( &virtual_mutex, &sigset );
--
2.31.1
More information about the wine-devel
mailing list