[PATCH] dbghelp: Only check process architecture if we are actually given a process.

Zebediah Figura z.figura12 at gmail.com
Mon Nov 19 11:27:49 CST 2018


Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45407
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 dlls/dbghelp/dbghelp.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/dlls/dbghelp/dbghelp.c b/dlls/dbghelp/dbghelp.c
index a085cd140e..92ef86f24c 100644
--- a/dlls/dbghelp/dbghelp.c
+++ b/dlls/dbghelp/dbghelp.c
@@ -308,16 +308,10 @@ BOOL WINAPI SymInitializeW(HANDLE hProcess, PCWSTR UserSearchPath, BOOL fInvadeP
         return TRUE;
     }
 
-    IsWow64Process(GetCurrentProcess(), &wow64);
-
-    if (!IsWow64Process(hProcess, &child_wow64))
-        return FALSE;
-
     pcs = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*pcs));
     if (!pcs) return FALSE;
 
     pcs->handle = hProcess;
-    pcs->is_64bit = (sizeof(void *) == 8 || wow64) && !child_wow64;
 
     if (UserSearchPath)
     {
@@ -361,6 +355,14 @@ BOOL WINAPI SymInitializeW(HANDLE hProcess, PCWSTR UserSearchPath, BOOL fInvadeP
     
     if (check_live_target(pcs))
     {
+        IsWow64Process(GetCurrentProcess(), &wow64);
+        if (!IsWow64Process(pcs->handle, &child_wow64))
+        {
+            SymCleanup(pcs->handle);
+            return FALSE;
+        }
+        pcs->is_64bit = (sizeof(void *) == 8 || wow64) && !child_wow64;
+
         if (fInvadeProcess)
             EnumerateLoadedModulesW64(hProcess, process_invade_cb, hProcess);
         elf_synchronize_module_list(pcs);
-- 
2.14.1




More information about the wine-devel mailing list