Add more informative error for processes dying in startup. Refs #358

This commit is contained in:
baldurk
2016-09-21 10:53:43 +02:00
parent c43bbe05b8
commit 20ecde678a
+21 -1
View File
@@ -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);