kernelbase: Use RtlWow64GetProcessMachines() to get native system information.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
4f8ede8e76
commit
9b0a8f5f49
|
@ -74,14 +74,21 @@ SIZE_T WINAPI GetLargePageMinimum(void)
|
|||
*/
|
||||
void WINAPI DECLSPEC_HOTPATCH GetNativeSystemInfo( SYSTEM_INFO *si )
|
||||
{
|
||||
USHORT current_machine, native_machine;
|
||||
|
||||
GetSystemInfo( si );
|
||||
if (!is_wow64) return;
|
||||
switch (si->u.s.wProcessorArchitecture)
|
||||
RtlWow64GetProcessMachines( GetCurrentProcess(), ¤t_machine, &native_machine );
|
||||
if (!current_machine) return;
|
||||
switch (native_machine)
|
||||
{
|
||||
case PROCESSOR_ARCHITECTURE_INTEL:
|
||||
case PROCESSOR_ARCHITECTURE_AMD64:
|
||||
si->u.s.wProcessorArchitecture = PROCESSOR_ARCHITECTURE_AMD64;
|
||||
si->dwProcessorType = PROCESSOR_AMD_X8664;
|
||||
break;
|
||||
case PROCESSOR_ARCHITECTURE_ARM64:
|
||||
si->u.s.wProcessorArchitecture = PROCESSOR_ARCHITECTURE_ARM64;
|
||||
si->dwProcessorType = 0;
|
||||
break;
|
||||
default:
|
||||
FIXME( "Add the proper information for %d in wow64 mode\n", si->u.s.wProcessorArchitecture );
|
||||
}
|
||||
|
|
|
@ -952,70 +952,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH IsProcessorFeaturePresent ( DWORD feature )
|
|||
*/
|
||||
BOOL WINAPI DECLSPEC_HOTPATCH IsWow64Process2( HANDLE process, USHORT *machine, USHORT *native_machine )
|
||||
{
|
||||
BOOL wow64;
|
||||
SYSTEM_INFO si;
|
||||
|
||||
TRACE( "(%p,%p,%p)\n", process, machine, native_machine );
|
||||
|
||||
if (!IsWow64Process( process, &wow64 ))
|
||||
return FALSE;
|
||||
|
||||
if (wow64)
|
||||
{
|
||||
if (process != GetCurrentProcess())
|
||||
{
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
*machine = IMAGE_FILE_MACHINE_I386;
|
||||
#else
|
||||
FIXME("not implemented for other process\n");
|
||||
*machine = IMAGE_FILE_MACHINE_UNKNOWN;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
IMAGE_NT_HEADERS *nt;
|
||||
nt = RtlImageNtHeader( NtCurrentTeb()->Peb->ImageBaseAddress );
|
||||
*machine = nt->FileHeader.Machine;
|
||||
}
|
||||
|
||||
if (!native_machine) return TRUE;
|
||||
|
||||
GetNativeSystemInfo( &si );
|
||||
}
|
||||
else
|
||||
{
|
||||
*machine = IMAGE_FILE_MACHINE_UNKNOWN;
|
||||
|
||||
if (!native_machine) return TRUE;
|
||||
|
||||
#ifdef _WIN64
|
||||
GetSystemInfo( &si );
|
||||
#else
|
||||
GetNativeSystemInfo( &si );
|
||||
#endif
|
||||
}
|
||||
|
||||
switch (si.u.s.wProcessorArchitecture)
|
||||
{
|
||||
case PROCESSOR_ARCHITECTURE_INTEL:
|
||||
*native_machine = IMAGE_FILE_MACHINE_I386;
|
||||
break;
|
||||
case PROCESSOR_ARCHITECTURE_ARM:
|
||||
*native_machine = IMAGE_FILE_MACHINE_ARMNT;
|
||||
break;
|
||||
case PROCESSOR_ARCHITECTURE_AMD64:
|
||||
*native_machine = IMAGE_FILE_MACHINE_AMD64;
|
||||
break;
|
||||
case PROCESSOR_ARCHITECTURE_ARM64:
|
||||
*native_machine = IMAGE_FILE_MACHINE_ARM64;
|
||||
break;
|
||||
default:
|
||||
FIXME("unknown architecture %u\n", si.u.s.wProcessorArchitecture);
|
||||
*native_machine = IMAGE_FILE_MACHINE_UNKNOWN;
|
||||
break;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return set_ntstatus( RtlWow64GetProcessMachines( process, machine, native_machine ));
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue