Fix debug event timeout feature + add extra check if the debuggee was terminated

Details: https://github.com/x64dbg/x64dbg/issues/2087
This commit is contained in:
Duncan Ogilvie 2018-12-28 16:26:43 +01:00
parent 50c0d90fcb
commit 7ad288f30e
No known key found for this signature in database
GPG Key ID: FC89E0AAA0C1AAD8
1 changed files with 17 additions and 1 deletions

View File

@ -77,7 +77,23 @@ __declspec(dllexport) void TITCALL DebugLoop()
while(!BreakDBG) //actual debug loop
{
WaitForDebugEvent(&DBGEvent, engineWaitForDebugEventTimeOut);
// Fix based on work by https://github.com/number201724
if(!WaitForDebugEvent(&DBGEvent, engineWaitForDebugEventTimeOut))
{
if(WaitForSingleObject(dbgProcessInformation.hProcess, 0) == WAIT_OBJECT_0)
{
DBGEvent.dwDebugEventCode = EXIT_PROCESS_DEBUG_EVENT;
DBGEvent.dwProcessId = dbgProcessInformation.dwProcessId;
DBGEvent.dwThreadId = dbgProcessInformation.dwThreadId;
if(!GetExitCodeProcess(dbgProcessInformation.hProcess, &DBGEvent.u.ExitProcess.dwExitCode))
DBGEvent.u.ExitProcess.dwExitCode = 0xFFFFFFFF;
}
else
{
continue;
}
}
if(engineExecutePluginCallBack)
{
ExtensionManagerPluginDebugCallBack(&DBGEvent, UE_PLUGIN_CALL_REASON_EXCEPTION);