Module: wine Branch: master Commit: 168ce9164faf4ce768e9f9f1f5f8415f5c097ca7 URL: https://gitlab.winehq.org/wine/wine/-/commit/168ce9164faf4ce768e9f9f1f5f8415...
Author: Alexandre Julliard julliard@winehq.org Date: Tue Jul 11 15:37:14 2023 +0200
wow64: Use ProcessWow64Information to retrieve the 32-bit PEB.
---
dlls/wow64/syscall.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/dlls/wow64/syscall.c b/dlls/wow64/syscall.c index 0f8135859bc..e741654a056 100644 --- a/dlls/wow64/syscall.c +++ b/dlls/wow64/syscall.c @@ -873,7 +873,7 @@ static const WCHAR *get_cpu_dll_name(void) */ static DWORD WINAPI process_init( RTL_RUN_ONCE *once, void *param, void **context ) { - TEB32 *teb32 = (TEB32 *)((char *)NtCurrentTeb() + NtCurrentTeb()->WowTebOffset); + PEB32 *peb32; HMODULE module, ntdll; UNICODE_STRING str = RTL_CONSTANT_STRING( L"ntdll.dll" ); SYSTEM_BASIC_INFORMATION info; @@ -884,7 +884,8 @@ static DWORD WINAPI process_init( RTL_RUN_ONCE *once, void *param, void **contex NtQuerySystemInformation( SystemEmulationBasicInformation, &info, sizeof(info), NULL ); highest_user_address = (ULONG_PTR)info.HighestUserAddress; default_zero_bits = (ULONG_PTR)info.HighestUserAddress | 0x7fffffff; - wow64info = (WOW64INFO *)((PEB32 *)ULongToPtr( teb32->Peb ) + 1); + NtQueryInformationProcess( GetCurrentProcess(), ProcessWow64Information, &peb32, sizeof(peb32), NULL ); + wow64info = (WOW64INFO *)(peb32 + 1); wow64info->NativeSystemPageSize = 0x1000; wow64info->NativeMachineType = native_machine; wow64info->EmulatedMachineType = current_machine;