From: Paul Gofman pgofman@codeweavers.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=58531 --- dlls/ntdll/tests/virtual.c | 4 ++-- dlls/ntdll/unix/virtual.c | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/dlls/ntdll/tests/virtual.c b/dlls/ntdll/tests/virtual.c index a8fe5b7ed40..b103f264e63 100644 --- a/dlls/ntdll/tests/virtual.c +++ b/dlls/ntdll/tests/virtual.c @@ -2734,7 +2734,7 @@ static void test_query_region_information(void) ok(!info.MappedPageFile, "Unexpected flag %d.\n", info.MappedPageFile); ok(!info.MappedPhysical, "Unexpected flag %d.\n", info.MappedPhysical); ok(!info.DirectMapped, "Unexpected flag %d.\n", info.DirectMapped); - todo_wine ok(info.RegionSize == 0x10000, "Unexpected region size %#Ix.\n", info.RegionSize); + ok(info.RegionSize == 0x10000, "Unexpected region size %#Ix.\n", info.RegionSize);
status = NtQueryVirtualMemory(NtCurrentProcess(), (char *)ptr + 0x1000, MemoryRegionInformation, &info, sizeof(info), &len); ok(status == STATUS_SUCCESS, "Unexpected status %08lx.\n", status); @@ -2746,7 +2746,7 @@ static void test_query_region_information(void) ok(!info.MappedPageFile, "Unexpected flag %d.\n", info.MappedPageFile); ok(!info.MappedPhysical, "Unexpected flag %d.\n", info.MappedPhysical); ok(!info.DirectMapped, "Unexpected flag %d.\n", info.DirectMapped); - todo_wine ok(info.RegionSize == 0x10000, "Unexpected region size %#Ix.\n", info.RegionSize); + ok(info.RegionSize == 0x10000, "Unexpected region size %#Ix.\n", info.RegionSize);
size = 0; status = NtFreeVirtualMemory(NtCurrentProcess(), &ptr, &size, MEM_RELEASE); diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index 246539940cd..64a60eca24a 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -5407,7 +5407,7 @@ NTSTATUS WINAPI NtProtectVirtualMemory( HANDLE process, PVOID *addr_ptr, SIZE_T }
-static unsigned int fill_basic_memory_info( const void *addr, MEMORY_BASIC_INFORMATION *info ) +static unsigned int fill_basic_memory_info( const void *addr, MEMORY_BASIC_INFORMATION *info, ULONG_PTR *view_size ) { char *base, *alloc_base = 0, *alloc_end = working_set_limit; struct wine_rb_entry *ptr; @@ -5439,6 +5439,7 @@ static unsigned int fill_basic_memory_info( const void *addr, MEMORY_BASIC_INFOR { alloc_base = view->base; alloc_end = (char *)view->base + view->size; + if (view_size) *view_size = view->size; break; } } @@ -5563,7 +5564,7 @@ static unsigned int get_basic_memory_info( HANDLE process, LPCVOID addr, return result.virtual_query.status; }
- if ((status = fill_basic_memory_info( addr, info ))) return status; + if ((status = fill_basic_memory_info( addr, info, NULL ))) return status;
if (res_len) *res_len = sizeof(*info); return STATUS_SUCCESS; @@ -5573,6 +5574,7 @@ static unsigned int get_memory_region_info( HANDLE process, LPCVOID addr, MEMORY SIZE_T len, SIZE_T *res_len ) { MEMORY_BASIC_INFORMATION basic_info; + ULONG_PTR view_size = 0; unsigned int status;
if (len < FIELD_OFFSET(MEMORY_REGION_INFORMATION, CommitSize)) @@ -5584,14 +5586,14 @@ static unsigned int get_memory_region_info( HANDLE process, LPCVOID addr, MEMORY return STATUS_NOT_IMPLEMENTED; }
- if ((status = fill_basic_memory_info( addr, &basic_info ))) return status; + if ((status = fill_basic_memory_info( addr, &basic_info, &view_size ))) return status; if (basic_info.State == MEM_FREE) return STATUS_INVALID_ADDRESS;
info->AllocationBase = basic_info.AllocationBase; info->AllocationProtect = basic_info.AllocationProtect; info->RegionType = 0; /* FIXME */ if (len >= FIELD_OFFSET(MEMORY_REGION_INFORMATION, CommitSize)) - info->RegionSize = basic_info.RegionSize; + info->RegionSize = view_size; if (len >= FIELD_OFFSET(MEMORY_REGION_INFORMATION, PartitionId)) info->CommitSize = basic_info.State == MEM_COMMIT ? basic_info.RegionSize : 0;