Module: wine Branch: master Commit: 572cc841a60a5cc0219b8dbf7cb614a0ee6f3456 URL: https://gitlab.winehq.org/wine/wine/-/commit/572cc841a60a5cc0219b8dbf7cb614a...
Author: Alexandre Julliard julliard@winehq.org Date: Thu Aug 17 13:54:02 2023 +0200
ntdll/tests: Add some more tests for the contents of the WOW64INFO structure.
---
dlls/ntdll/tests/wow64.c | 22 ++++++++++++++++++++++ include/winternl.h | 16 +++++++++------- 2 files changed, 31 insertions(+), 7 deletions(-)
diff --git a/dlls/ntdll/tests/wow64.c b/dlls/ntdll/tests/wow64.c index 300494849b9..0689e7a530a 100644 --- a/dlls/ntdll/tests/wow64.c +++ b/dlls/ntdll/tests/wow64.c @@ -414,6 +414,28 @@ static void test_peb_teb(void) } ok( i < limit, "wow64info not found in PEB\n" ); } + if (wow64info->SectionHandle && wow64info->CrossProcessWorkList) + { + HANDLE handle; + void *data, *addr = NULL; + SIZE_T size = 0; + + ret = DuplicateHandle( pi.hProcess, (HANDLE)(ULONG_PTR)wow64info->SectionHandle, + GetCurrentProcess(), &handle, 0, FALSE, DUPLICATE_SAME_ACCESS ); + ok( ret, "DuplicateHandle failed %lu\n", GetLastError() ); + status = NtMapViewOfSection( handle, GetCurrentProcess(), &addr, 0, 0, NULL, + &size, ViewShare, 0, PAGE_READWRITE ); + ok( !status, "NtMapViewOfSection failed %lx\n", status ); + data = malloc( size ); + ret = ReadProcessMemory( pi.hProcess, (void *)(ULONG_PTR)wow64info->CrossProcessWorkList, + data, size, &size ); + ok( ret, "ReadProcessMemory failed %lu\n", GetLastError() ); + ok( !memcmp( data, addr, size ), "wrong data\n" ); + free( data ); + UnmapViewOfFile( addr ); + CloseHandle( handle ); + } + else trace( "no WOW64INFO section handle\n" ); } else win_skip( "RtlWow64GetSharedInfoProcess not supported\n" );
diff --git a/include/winternl.h b/include/winternl.h index 62ccdd6c95a..4b58d481603 100644 --- a/include/winternl.h +++ b/include/winternl.h @@ -4103,14 +4103,16 @@ typedef struct _WOW64_CPU_AREA_INFO
typedef struct _WOW64INFO { - ULONG NativeSystemPageSize; - ULONG CpuFlags; - ULONG Wow64ExecuteFlags; - ULONG unknown[5]; - USHORT NativeMachineType; - USHORT EmulatedMachineType; - ULONG unknown2; + ULONG NativeSystemPageSize; + ULONG CpuFlags; + ULONG Wow64ExecuteFlags; + ULONG unknown; + ULONGLONG SectionHandle; + ULONGLONG CrossProcessWorkList; + USHORT NativeMachineType; + USHORT EmulatedMachineType; } WOW64INFO; +C_ASSERT( sizeof(WOW64INFO) == 40 );
#define WOW64_CPUFLAGS_MSFT64 0x01 #define WOW64_CPUFLAGS_SOFTWARE 0x02