Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49716 Signed-off-by: Dmitry Timoshkov dmitry@baikal.ru --- dlls/kernel32/tests/process.c | 15 +++++++++++++++ dlls/kernelbase/process.c | 11 ++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/dlls/kernel32/tests/process.c b/dlls/kernel32/tests/process.c index eaa5da2e95..3162ba3c53 100644 --- a/dlls/kernel32/tests/process.c +++ b/dlls/kernel32/tests/process.c @@ -2238,6 +2238,12 @@ static void test_IsWow64Process2(void) ok(machine == IMAGE_FILE_MACHINE_UNKNOWN, "got %#x\n", 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); ok(ret, "TerminateProcess error\n");
@@ -2263,6 +2269,15 @@ static void test_IsWow64Process2(void) ok(machine == IMAGE_FILE_MACHINE_UNKNOWN, "got %#x\n", 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) diff --git a/dlls/kernelbase/process.c b/dlls/kernelbase/process.c index 58fba52415..cb7488f0e4 100644 --- a/dlls/kernelbase/process.c +++ b/dlls/kernelbase/process.c @@ -898,8 +898,6 @@ BOOL WINAPI DECLSPEC_HOTPATCH IsWow64Process2( HANDLE process, USHORT *machine,
if (wow64) { - GetNativeSystemInfo( &si ); - if (process != GetCurrentProcess()) { #if defined(__i386__) || defined(__x86_64__) @@ -915,15 +913,22 @@ BOOL WINAPI DECLSPEC_HOTPATCH IsWow64Process2( HANDLE process, USHORT *machine, 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 - *machine = IMAGE_FILE_MACHINE_UNKNOWN; }
switch (si.u.s.wProcessorArchitecture)
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=77284
Your paranoid android.
=== debiant (32 bit Chinese:China report) ===
kernel32: process.c:1608: Test failed: Console:winRight expected 79, but got 80