Commit 3786462a authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

kernelbase: Native machine is optional for IsWow64Process2.

parent cd9f30f3
...@@ -2238,6 +2238,12 @@ static void test_IsWow64Process2(void) ...@@ -2238,6 +2238,12 @@ static void test_IsWow64Process2(void)
ok(machine == IMAGE_FILE_MACHINE_UNKNOWN, "got %#x\n", machine); ok(machine == IMAGE_FILE_MACHINE_UNKNOWN, "got %#x\n", machine);
ok(native_machine == expect_native, "got %#x\n", native_machine); ok(native_machine == expect_native, "got %#x\n", native_machine);
SetLastError(0xdeadbeef);
machine = 0xdead;
ret = pIsWow64Process2(pi.hProcess, &machine, NULL);
ok(ret, "IsWow64Process2 error %u\n", GetLastError());
ok(machine == IMAGE_FILE_MACHINE_UNKNOWN, "got %#x\n", machine);
ret = TerminateProcess(pi.hProcess, 0); ret = TerminateProcess(pi.hProcess, 0);
ok(ret, "TerminateProcess error\n"); ok(ret, "TerminateProcess error\n");
...@@ -2263,6 +2269,15 @@ static void test_IsWow64Process2(void) ...@@ -2263,6 +2269,15 @@ static void test_IsWow64Process2(void)
ok(machine == IMAGE_FILE_MACHINE_UNKNOWN, "got %#x\n", machine); ok(machine == IMAGE_FILE_MACHINE_UNKNOWN, "got %#x\n", machine);
ok(native_machine == expect_native, "got %#x\n", native_machine); ok(native_machine == expect_native, "got %#x\n", native_machine);
} }
SetLastError(0xdeadbeef);
machine = 0xdead;
ret = pIsWow64Process2(GetCurrentProcess(), &machine, NULL);
ok(ret, "IsWow64Process2 error %u\n", GetLastError());
if (is_wow64)
ok(machine == IMAGE_FILE_MACHINE_I386, "got %#x\n", machine);
else
ok(machine == IMAGE_FILE_MACHINE_UNKNOWN, "got %#x\n", machine);
} }
static void test_SystemInfo(void) static void test_SystemInfo(void)
......
...@@ -899,8 +899,6 @@ BOOL WINAPI DECLSPEC_HOTPATCH IsWow64Process2( HANDLE process, USHORT *machine, ...@@ -899,8 +899,6 @@ BOOL WINAPI DECLSPEC_HOTPATCH IsWow64Process2( HANDLE process, USHORT *machine,
if (wow64) if (wow64)
{ {
GetNativeSystemInfo( &si );
if (process != GetCurrentProcess()) if (process != GetCurrentProcess())
{ {
#if defined(__i386__) || defined(__x86_64__) #if defined(__i386__) || defined(__x86_64__)
...@@ -916,15 +914,22 @@ BOOL WINAPI DECLSPEC_HOTPATCH IsWow64Process2( HANDLE process, USHORT *machine, ...@@ -916,15 +914,22 @@ BOOL WINAPI DECLSPEC_HOTPATCH IsWow64Process2( HANDLE process, USHORT *machine,
nt = RtlImageNtHeader( NtCurrentTeb()->Peb->ImageBaseAddress ); nt = RtlImageNtHeader( NtCurrentTeb()->Peb->ImageBaseAddress );
*machine = nt->FileHeader.Machine; *machine = nt->FileHeader.Machine;
} }
if (!native_machine) return TRUE;
GetNativeSystemInfo( &si );
} }
else else
{ {
*machine = IMAGE_FILE_MACHINE_UNKNOWN;
if (!native_machine) return TRUE;
#ifdef _WIN64 #ifdef _WIN64
GetSystemInfo( &si ); GetSystemInfo( &si );
#else #else
GetNativeSystemInfo( &si ); GetNativeSystemInfo( &si );
#endif #endif
*machine = IMAGE_FILE_MACHINE_UNKNOWN;
} }
switch (si.u.s.wProcessorArchitecture) switch (si.u.s.wProcessorArchitecture)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment