ntdll: Implement RtlWow64IsWowGuestMachineSupported().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
6c2f19c0a7
commit
4f8ede8e76
|
@ -1071,6 +1071,7 @@
|
|||
@ stdcall RtlWow64GetCurrentMachine()
|
||||
@ stdcall RtlWow64GetProcessMachines(long ptr ptr)
|
||||
@ stdcall -arch=x86_64 RtlWow64GetThreadContext(long ptr)
|
||||
@ stdcall RtlWow64IsWowGuestMachineSupported(long ptr)
|
||||
@ stdcall -arch=x86_64 RtlWow64SetThreadContext(long ptr)
|
||||
@ stub RtlWriteMemoryStream
|
||||
@ stdcall RtlWriteRegistryValue(long ptr ptr long ptr long)
|
||||
|
|
|
@ -86,6 +86,28 @@ NTSTATUS WINAPI RtlWow64GetProcessMachines( HANDLE process, USHORT *current_ret,
|
|||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* RtlWow64IsWowGuestMachineSupported (NTDLL.@)
|
||||
*/
|
||||
NTSTATUS WINAPI RtlWow64IsWowGuestMachineSupported( USHORT machine, BOOLEAN *supported )
|
||||
{
|
||||
ULONG i, machines[8];
|
||||
HANDLE process = 0;
|
||||
NTSTATUS status;
|
||||
|
||||
status = NtQuerySystemInformationEx( SystemSupportedProcessorArchitectures, &process, sizeof(process),
|
||||
machines, sizeof(machines), NULL );
|
||||
if (status) return status;
|
||||
*supported = FALSE;
|
||||
for (i = 0; machines[i]; i++)
|
||||
{
|
||||
if (HIWORD(machines[i]) & 4 /* native machine */) continue;
|
||||
if (machine == LOWORD(machines[i])) *supported = TRUE;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* RtlCreateUserProcess (NTDLL.@)
|
||||
*/
|
||||
|
|
|
@ -27,6 +27,7 @@ static NTSTATUS (WINAPI * pNtSetSystemInformation)(SYSTEM_INFORMATION_CLASS, PVO
|
|||
static NTSTATUS (WINAPI * pRtlGetNativeSystemInformation)(SYSTEM_INFORMATION_CLASS, PVOID, ULONG, PULONG);
|
||||
static USHORT (WINAPI * pRtlWow64GetCurrentMachine)(void);
|
||||
static NTSTATUS (WINAPI * pRtlWow64GetProcessMachines)(HANDLE,WORD*,WORD*);
|
||||
static NTSTATUS (WINAPI * pRtlWow64IsWowGuestMachineSupported)(USHORT,BOOLEAN*);
|
||||
static NTSTATUS (WINAPI * pNtQuerySystemInformationEx)(SYSTEM_INFORMATION_CLASS, void*, ULONG, void*, ULONG, ULONG*);
|
||||
static NTSTATUS (WINAPI * pNtPowerInformation)(POWER_INFORMATION_LEVEL, PVOID, ULONG, PVOID, ULONG);
|
||||
static NTSTATUS (WINAPI * pNtQueryInformationProcess)(HANDLE, PROCESSINFOCLASS, PVOID, ULONG, PULONG);
|
||||
|
@ -86,6 +87,7 @@ static BOOL InitFunctionPtrs(void)
|
|||
NTDLL_GET_PROC(RtlGetNativeSystemInformation);
|
||||
NTDLL_GET_PROC(RtlWow64GetCurrentMachine);
|
||||
NTDLL_GET_PROC(RtlWow64GetProcessMachines);
|
||||
NTDLL_GET_PROC(RtlWow64IsWowGuestMachineSupported);
|
||||
NTDLL_GET_PROC(NtPowerInformation);
|
||||
NTDLL_GET_PROC(NtQueryInformationProcess);
|
||||
NTDLL_GET_PROC(NtQueryInformationThread);
|
||||
|
@ -3017,6 +3019,30 @@ static void test_query_architectures(void)
|
|||
USHORT machine = pRtlWow64GetCurrentMachine();
|
||||
ok( machine == current_machine, "wrong machine %x / %x\n", machine, current_machine );
|
||||
}
|
||||
if (pRtlWow64IsWowGuestMachineSupported)
|
||||
{
|
||||
BOOLEAN ret = 0xcc;
|
||||
status = pRtlWow64IsWowGuestMachineSupported( IMAGE_FILE_MACHINE_I386, &ret );
|
||||
ok( !status, "failed %x\n", status );
|
||||
ok( ret == (native_machine == IMAGE_FILE_MACHINE_AMD64 ||
|
||||
native_machine == IMAGE_FILE_MACHINE_ARM64), "wrong result %u\n", ret );
|
||||
ret = 0xcc;
|
||||
status = pRtlWow64IsWowGuestMachineSupported( IMAGE_FILE_MACHINE_ARMNT, &ret );
|
||||
ok( !status, "failed %x\n", status );
|
||||
ok( ret == (native_machine == IMAGE_FILE_MACHINE_ARM64), "wrong result %u\n", ret );
|
||||
ret = 0xcc;
|
||||
status = pRtlWow64IsWowGuestMachineSupported( IMAGE_FILE_MACHINE_AMD64, &ret );
|
||||
ok( !status, "failed %x\n", status );
|
||||
ok( !ret, "wrong result %u\n", ret );
|
||||
ret = 0xcc;
|
||||
status = pRtlWow64IsWowGuestMachineSupported( IMAGE_FILE_MACHINE_ARM64, &ret );
|
||||
ok( !status, "failed %x\n", status );
|
||||
ok( !ret, "wrong result %u\n", ret );
|
||||
ret = 0xcc;
|
||||
status = pRtlWow64IsWowGuestMachineSupported( 0xdead, &ret );
|
||||
ok( !status, "failed %x\n", status );
|
||||
ok( !ret, "wrong result %u\n", ret );
|
||||
}
|
||||
}
|
||||
|
||||
static void test_thread_lookup(void)
|
||||
|
|
|
@ -4258,6 +4258,7 @@ NTSYSAPI NTSTATUS WINAPI RtlWow64GetProcessMachines(HANDLE,USHORT*,USHORT*);
|
|||
NTSYSAPI NTSTATUS WINAPI RtlWow64GetThreadContext(HANDLE, WOW64_CONTEXT *);
|
||||
NTSYSAPI NTSTATUS WINAPI RtlWow64SetThreadContext(HANDLE, const WOW64_CONTEXT *);
|
||||
#endif
|
||||
NTSYSAPI NTSTATUS WINAPI RtlWow64IsWowGuestMachineSupported(USHORT,BOOLEAN*);
|
||||
NTSYSAPI NTSTATUS WINAPI RtlWriteRegistryValue(ULONG,PCWSTR,PCWSTR,ULONG,PVOID,ULONG);
|
||||
NTSYSAPI NTSTATUS WINAPI RtlZombifyActivationContext(HANDLE);
|
||||
NTSYSAPI NTSTATUS WINAPI RtlpNtCreateKey(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES*,ULONG,const UNICODE_STRING*,ULONG,PULONG);
|
||||
|
|
Loading…
Reference in New Issue