- Improved gameloop unhandled exception handler to retrieve the line and source file (if PDB is available) and display in the fault screen instead of the location of the fault handler (by tazpn)

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5166 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Wanne
2012-04-06 08:39:16 +00:00
parent bfe4a7b08e
commit 3c1940a260
2 changed files with 237 additions and 10 deletions
+15 -5
View File
@@ -1862,15 +1862,25 @@ static void PopulateSectionFromCommandLine(vfs::PropertyContainer &oProps, vfs::
static LONG __stdcall SGPExceptionFilter(int exceptionCount, EXCEPTION_POINTERS* pExceptInfo)
{
#ifdef ENABLE_EXCEPTION_HANDLING
extern BOOL ERGetFirstModuleException(EXCEPTION_POINTERS*, HMODULE, LPSTR, INT, LPSTR, INT, INT *);
extern STR GetExceptionString( DWORD uiExceptionCode );
CHAR funcName[64], sourceName[MAX_PATH];
INT lineNum = 0;
if (exceptionCount >= 1)
{
// the exception handler writer can fail with exceptions too
__try
{
bool showAssert = true;
__try{
// the exception handler writer can fail with exceptions too
RecordExceptionInfo(pExceptInfo);
LPCSTR exceptMsg = GetExceptionString(pExceptInfo->ExceptionRecord->ExceptionCode);
if ( ERGetFirstModuleException(pExceptInfo, NULL, funcName, _countof(funcName), sourceName, _countof(sourceName), &lineNum ) )
{
_FailMessage(exceptMsg, lineNum, funcName, sourceName);
showAssert = false;
}
} __except (EXCEPTION_EXECUTE_HANDLER) {}
AssertMsg(FALSE, "Unhanded exception processing GameLoop unable to recover.");
if (showAssert) AssertMsg(FALSE, "Unhanded exception processing GameLoop unable to recover.");
}
#endif