From d10e9e239fd0bfd2f02140a3ea736b767ad5c487 Mon Sep 17 00:00:00 2001 From: baldurk Date: Sun, 27 Jul 2014 22:24:12 +0100 Subject: [PATCH] On x86 windows IsWow64 returns false always. Closes #66 * On x64 windows IsWow64 returns true for 32bit programs, but on x86 windows there is no such thing as Wow64 so it returns false. Detect this by checking our own processes Wow64 nature (which should always return true if Wow64 is a thing). --- renderdoc/os/win32/win32_process.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/renderdoc/os/win32/win32_process.cpp b/renderdoc/os/win32/win32_process.cpp index 4e5d5048d..42198c49a 100644 --- a/renderdoc/os/win32/win32_process.cpp +++ b/renderdoc/os/win32/win32_process.cpp @@ -216,7 +216,21 @@ uint32_t Process::InjectIntoProcess(uint32_t pid, const wchar_t *logfile, const } #if !defined(WIN64) - if(!isWow64) + BOOL selfWow64 = FALSE; + + HANDLE hSelfProcess = GetCurrentProcess(); + + success = IsWow64Process(hSelfProcess, &selfWow64); + + CloseHandle(hSelfProcess); + + if(!success) + { + RDCERR("Couldn't determine bitness of self"); + return 0; + } + + if(selfWow64 && !isWow64) { RDCERR("Can't capture x64 process with x86 renderdoc"); CloseHandle(hProcess);