wow64: Use ProcessWow64Information to retrieve the 32-bit PEB.

This commit is contained in:
Alexandre Julliard 2023-07-11 15:37:14 +02:00
parent 7261aca185
commit 168ce9164f

View file

@ -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;