mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-28 15:02:01 +00:00
Fix crash reporter for 64 bit
(cherry picked from commit 3a0de8b0c714507823edaa24875bc97b39c76ab6)
This commit is contained in:
parent
dc82c19901
commit
2854e1fe03
1 changed files with 15 additions and 5 deletions
|
@ -1184,6 +1184,11 @@ void CALLBACK ExitFatally (ULONG_PTR dummy)
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
CONTEXT MainThreadContext;
|
||||||
|
}
|
||||||
|
|
||||||
LONG WINAPI CatchAllExceptions (LPEXCEPTION_POINTERS info)
|
LONG WINAPI CatchAllExceptions (LPEXCEPTION_POINTERS info)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
|
@ -1208,11 +1213,7 @@ LONG WINAPI CatchAllExceptions (LPEXCEPTION_POINTERS info)
|
||||||
// Otherwise, put the crashing thread to sleep and signal the main thread to clean up.
|
// Otherwise, put the crashing thread to sleep and signal the main thread to clean up.
|
||||||
if (GetCurrentThreadId() == MainThreadID)
|
if (GetCurrentThreadId() == MainThreadID)
|
||||||
{
|
{
|
||||||
#ifndef _M_X64
|
*info->ContextRecord = MainThreadContext;
|
||||||
info->ContextRecord->Eip = (DWORD_PTR)ExitFatally;
|
|
||||||
#else
|
|
||||||
info->ContextRecord->Rip = (DWORD_PTR)ExitFatally;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1304,6 +1305,15 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE nothing, LPSTR cmdline, int n
|
||||||
if (MainThread != INVALID_HANDLE_VALUE)
|
if (MainThread != INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
SetUnhandledExceptionFilter (CatchAllExceptions);
|
SetUnhandledExceptionFilter (CatchAllExceptions);
|
||||||
|
|
||||||
|
static bool setJumpResult = false;
|
||||||
|
RtlCaptureContext(&MainThreadContext);
|
||||||
|
if (setJumpResult)
|
||||||
|
{
|
||||||
|
ExitFatally(0);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
setJumpResult = true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue