From ed6ab3222ede03fa090ac17e1abd868f7e99f87f Mon Sep 17 00:00:00 2001 From: Francois Gouget Date: Tue, 7 Mar 2023 15:40:26 +0100 Subject: [PATCH] dbghelp/tests: Let the tests run on Windows 7, 8 and 10 <= 1607. Provide a fallback if IsWow64Process2() is not available. Wine-Bug: https://bugs.winehq.org//show_bug.cgi?id=54605 --- dlls/dbghelp/tests/dbghelp.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/dlls/dbghelp/tests/dbghelp.c b/dlls/dbghelp/tests/dbghelp.c index 3a0ad20dadd..f68ca8281de 100644 --- a/dlls/dbghelp/tests/dbghelp.c +++ b/dlls/dbghelp/tests/dbghelp.c @@ -564,10 +564,21 @@ enum process_kind static enum process_kind get_process_kind(HANDLE process) { - const BOOL is_win64 = sizeof(void*) == 8; + HMODULE mod; USHORT m1, m2; + BOOL (WINAPI *pIsWow64Process2)(HANDLE,USHORT*,USHORT*); + const BOOL is_win64 = sizeof(void*) == 8; - if (!IsWow64Process2(process, &m1, &m2)) return PCSKIND_ERROR; + mod = GetModuleHandleA("kernel32"); + pIsWow64Process2 = (void*)GetProcAddress(mod, "IsWow64Process2"); + if (!pIsWow64Process2) + { + BOOL is_wow64; + return is_win64 ? PCSKIND_64BIT : + IsWow64Process(process, &is_wow64) && is_wow64 ? PCSKIND_WOW64 : + PCSKIND_32BIT; + } + if (!pIsWow64Process2(process, &m1, &m2)) return PCSKIND_ERROR; if (m1 == IMAGE_FILE_MACHINE_UNKNOWN && get_machine_bitness(m2) == 32) return PCSKIND_32BIT; if (m1 == IMAGE_FILE_MACHINE_UNKNOWN && get_machine_bitness(m2) == 64) return PCSKIND_64BIT; if (get_machine_bitness(m1) == 32 && get_machine_bitness(m2) == 64) -- 2.11.4.GIT