kernel32: Return the correct processor arch and type in wow64 mode.
This commit is contained in:
parent
57ddceea34
commit
f3b4bd2bbc
|
@ -170,13 +170,24 @@ VOID WINAPI GetSystemInfo(
|
|||
VOID WINAPI GetNativeSystemInfo(
|
||||
LPSYSTEM_INFO si /* [out] Destination for system information, may not be NULL */)
|
||||
{
|
||||
static BOOL reported = FALSE;
|
||||
if (!reported) {
|
||||
FIXME("(%p) using GetSystemInfo()\n", si);
|
||||
reported = TRUE;
|
||||
} else
|
||||
TRACE("(%p) using GetSystemInfo()\n", si);
|
||||
BOOL is_wow64;
|
||||
|
||||
GetSystemInfo(si);
|
||||
|
||||
IsWow64Process(GetCurrentProcess(), &is_wow64);
|
||||
if (is_wow64)
|
||||
{
|
||||
if (si->u.s.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL)
|
||||
{
|
||||
si->u.s.wProcessorArchitecture = PROCESSOR_ARCHITECTURE_AMD64;
|
||||
si->dwProcessorType = PROCESSOR_AMD_X8664;
|
||||
}
|
||||
else
|
||||
{
|
||||
FIXME("Add the proper information for %d in wow64 mode\n",
|
||||
si->u.s.wProcessorArchitecture);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
|
|
@ -55,6 +55,8 @@
|
|||
} while (0)
|
||||
|
||||
static HINSTANCE hkernel32;
|
||||
static void (WINAPI *pGetNativeSystemInfo)(LPSYSTEM_INFO);
|
||||
static BOOL (WINAPI *pIsWow64Process)(HANDLE,PBOOL);
|
||||
static LPVOID (WINAPI *pVirtualAllocEx)(HANDLE, LPVOID, SIZE_T, DWORD, DWORD);
|
||||
static BOOL (WINAPI *pVirtualFreeEx)(HANDLE, LPVOID, SIZE_T, DWORD);
|
||||
static BOOL (WINAPI *pQueryFullProcessImageNameA)(HANDLE hProcess, DWORD dwFlags, LPSTR lpExeName, PDWORD lpdwSize);
|
||||
|
@ -194,6 +196,8 @@ static int init(void)
|
|||
if ((p = strrchr(exename, '/')) != NULL) exename = p + 1;
|
||||
|
||||
hkernel32 = GetModuleHandleA("kernel32");
|
||||
pGetNativeSystemInfo = (void *) GetProcAddress(hkernel32, "GetNativeSystemInfo");
|
||||
pIsWow64Process = (void *) GetProcAddress(hkernel32, "IsWow64Process");
|
||||
pVirtualAllocEx = (void *) GetProcAddress(hkernel32, "VirtualAllocEx");
|
||||
pVirtualFreeEx = (void *) GetProcAddress(hkernel32, "VirtualFreeEx");
|
||||
pQueryFullProcessImageNameA = (void *) GetProcAddress(hkernel32, "QueryFullProcessImageNameA");
|
||||
|
@ -1767,6 +1771,44 @@ static void test_Handles(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
static void test_SystemInfo(void)
|
||||
{
|
||||
SYSTEM_INFO si, nsi;
|
||||
BOOL is_wow64;
|
||||
|
||||
if (!pGetNativeSystemInfo)
|
||||
{
|
||||
win_skip("GetNativeSystemInfo is not available\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!pIsWow64Process || !pIsWow64Process( GetCurrentProcess(), &is_wow64 )) is_wow64 = FALSE;
|
||||
|
||||
GetSystemInfo(&si);
|
||||
pGetNativeSystemInfo(&nsi);
|
||||
if (is_wow64)
|
||||
{
|
||||
if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL)
|
||||
{
|
||||
ok(nsi.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64,
|
||||
"Expected PROCESSOR_ARCHITECTURE_AMD64, got %d\n",
|
||||
nsi.wProcessorArchitecture);
|
||||
ok(nsi.dwProcessorType == PROCESSOR_AMD_X8664,
|
||||
"Expected PROCESSOR_AMD_X8664, got %d\n",
|
||||
nsi.dwProcessorType);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ok(si.wProcessorArchitecture == nsi.wProcessorArchitecture,
|
||||
"Expected no difference for wProcessorArchitecture, got %d and %d\n",
|
||||
si.wProcessorArchitecture, nsi.wProcessorArchitecture);
|
||||
ok(si.dwProcessorType == nsi.dwProcessorType,
|
||||
"Expected no difference for dwProcessorType, got %d and %d\n",
|
||||
si.dwProcessorType, nsi.dwProcessorType);
|
||||
}
|
||||
}
|
||||
|
||||
START_TEST(process)
|
||||
{
|
||||
int b = init();
|
||||
|
@ -1791,6 +1833,7 @@ START_TEST(process)
|
|||
test_ProcessNameA();
|
||||
test_ProcessName();
|
||||
test_Handles();
|
||||
test_SystemInfo();
|
||||
/* things that can be tested:
|
||||
* lookup: check the way program to be executed is searched
|
||||
* handles: check the handle inheritance stuff (+sec options)
|
||||
|
|
Loading…
Reference in New Issue