From 20ecde678adfcc6ce3c4a4730e43d4f360912b82 Mon Sep 17 00:00:00 2001 From: baldurk Date: Wed, 21 Sep 2016 10:53:43 +0200 Subject: [PATCH] Add more informative error for processes dying in startup. Refs #358 --- renderdoc/os/win32/win32_process.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/renderdoc/os/win32/win32_process.cpp b/renderdoc/os/win32/win32_process.cpp index 80cfc95b1..48a5fc6ec 100644 --- a/renderdoc/os/win32/win32_process.cpp +++ b/renderdoc/os/win32/win32_process.cpp @@ -309,7 +309,27 @@ uintptr_t FindRemoteDLL(DWORD pid, wstring libName) if(ret == 0) { - RDCERR("Couldn't find module '%ls' among %d modules", libName.c_str(), numModules); + HANDLE h = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, pid); + + DWORD exitCode = 0; + + if(h) + GetExitCodeProcess(h, &exitCode); + + if(h == NULL || exitCode != STILL_ACTIVE) + { + RDCERR( + "Error injecting into remote process with PID %u which is no longer available.\n" + "Possibly the process has crashed during early startup?", + pid); + } + else + { + RDCERR("Couldn't find module '%ls' among %d modules", libName.c_str(), numModules); + } + + if(h) + CloseHandle(h); } CloseHandle(hModuleSnap);