Add verification before start monitoring kernel process
This commit is contained in:
parent
90df98e5e6
commit
cdbd1aab50
|
@ -2319,8 +2319,28 @@ void WndMain::CrashMonitor()
|
||||||
DWORD dwProcessID_ExitCode = 0;
|
DWORD dwProcessID_ExitCode = 0;
|
||||||
GetWindowThreadProcessId(m_hwndChild, &dwProcessID_ExitCode);
|
GetWindowThreadProcessId(m_hwndChild, &dwProcessID_ExitCode);
|
||||||
|
|
||||||
|
// Did not received valid process ID, assume we do not have access or crashed in the process.
|
||||||
|
if (dwProcessID_ExitCode == 0) {
|
||||||
|
|
||||||
|
crashCleanup:
|
||||||
|
|
||||||
|
KillTimer(m_hwnd, TIMERID_FPS);
|
||||||
|
KillTimer(m_hwnd, TIMERID_LED);
|
||||||
|
DrawLedBitmap(m_hwnd, true);
|
||||||
|
m_hwndChild = NULL;
|
||||||
|
m_bIsStarted = false;
|
||||||
|
UpdateCaption();
|
||||||
|
RefreshMenus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
HANDLE hProcess = OpenProcess(SYNCHRONIZE | PROCESS_QUERY_INFORMATION, FALSE, dwProcessID_ExitCode);
|
HANDLE hProcess = OpenProcess(SYNCHRONIZE | PROCESS_QUERY_INFORMATION, FALSE, dwProcessID_ExitCode);
|
||||||
|
|
||||||
|
// Did not received valid handle, assume we do not have access or crashed in the process.
|
||||||
|
if (hProcess == NULL) {
|
||||||
|
goto crashCleanup;
|
||||||
|
}
|
||||||
|
|
||||||
WaitForSingleObject(hProcess, INFINITE);
|
WaitForSingleObject(hProcess, INFINITE);
|
||||||
dwProcessID_ExitCode = 0;
|
dwProcessID_ExitCode = 0;
|
||||||
GetExitCodeProcess(hProcess, &dwProcessID_ExitCode);
|
GetExitCodeProcess(hProcess, &dwProcessID_ExitCode);
|
||||||
|
@ -2333,16 +2353,7 @@ void WndMain::CrashMonitor()
|
||||||
return;
|
return;
|
||||||
} else { // that's a crash
|
} else { // that's a crash
|
||||||
CloseHandle(hProcess);
|
CloseHandle(hProcess);
|
||||||
if (m_bIsStarted) { // that's a hard crash, Dr Watson is invoked
|
goto crashCleanup;
|
||||||
KillTimer(m_hwnd, TIMERID_FPS);
|
|
||||||
KillTimer(m_hwnd, TIMERID_LED);
|
|
||||||
DrawLedBitmap(m_hwnd, true);
|
|
||||||
m_hwndChild = NULL;
|
|
||||||
m_bIsStarted = false;
|
|
||||||
UpdateCaption();
|
|
||||||
RefreshMenus();
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue