Skip to content

Commit a395845

Browse files
committed
Add unhandled exception filter for WorldBuilders
1 parent 7dd4c86 commit a395845

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

Generals/Code/Tools/WorldBuilder/src/WorldBuilder.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
//
2121

2222
#include "StdAfx.h"
23-
#include <eh.h>
2423
#include "WorldBuilder.h"
2524
#include "euladialog.h"
2625
#include "MainFrm.h"
@@ -259,6 +258,14 @@ CWorldBuilderApp::~CWorldBuilderApp()
259258
}
260259
}
261260

261+
/////////////////////////////////////////////////////////////////////////////
262+
// Handler for unhandled win32 exceptions.
263+
264+
static LONG WINAPI UnHandledExceptionFilter(struct _EXCEPTION_POINTERS* e_info)
265+
{
266+
DumpExceptionInfo(e_info->ExceptionRecord->ExceptionCode, e_info);
267+
return EXCEPTION_EXECUTE_HANDLER;
268+
}
262269

263270
/////////////////////////////////////////////////////////////////////////////
264271
// CWorldBuilderApp initialization
@@ -272,7 +279,7 @@ BOOL CWorldBuilderApp::InitInstance()
272279
}
273280

274281
// initialization
275-
_set_se_translator( DumpExceptionInfo ); // Hook that allows stack trace.
282+
SetUnhandledExceptionFilter(UnHandledExceptionFilter);
276283

277284
// initialize the memory manager early
278285
initMemoryManager();

GeneralsMD/Code/Tools/WorldBuilder/src/WorldBuilder.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
//
2121

2222
#include "StdAfx.h"
23-
#include <eh.h>
2423
#include "WorldBuilder.h"
2524
#include "euladialog.h"
2625
#include "MainFrm.h"
@@ -261,6 +260,14 @@ CWorldBuilderApp::~CWorldBuilderApp()
261260
_exit(0);
262261
}
263262

263+
/////////////////////////////////////////////////////////////////////////////
264+
// Handler for unhandled win32 exceptions.
265+
266+
static LONG WINAPI UnHandledExceptionFilter(struct _EXCEPTION_POINTERS* e_info)
267+
{
268+
DumpExceptionInfo(e_info->ExceptionRecord->ExceptionCode, e_info);
269+
return EXCEPTION_EXECUTE_HANDLER;
270+
}
264271

265272
/////////////////////////////////////////////////////////////////////////////
266273
// CWorldBuilderApp initialization
@@ -278,7 +285,7 @@ BOOL CWorldBuilderApp::InitInstance()
278285
ApplicationHWnd = GetDesktopWindow();
279286

280287
// initialization
281-
_set_se_translator( DumpExceptionInfo ); // Hook that allows stack trace.
288+
SetUnhandledExceptionFilter(UnHandledExceptionFilter);
282289

283290
// initialize the memory manager early
284291
initMemoryManager();

0 commit comments

Comments
 (0)