mirror of
https://github.com/alliedmodders/hl2sdk.git
synced 2025-09-20 20:46:03 +08:00
Update from SDK 2013
This commit is contained in:

committed by
Nicholas Hastings

parent
6d5c024820
commit
94b660e16e
@ -1,61 +1,61 @@
|
||||
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================//
|
||||
|
||||
#include <windows.h>
|
||||
#include "tier0/minidump.h"
|
||||
#include "tools_minidump.h"
|
||||
|
||||
|
||||
static bool g_bToolsWriteFullMinidumps = false;
|
||||
static ToolsExceptionHandler g_pCustomExceptionHandler = NULL;
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------- //
|
||||
// Internal helpers.
|
||||
// --------------------------------------------------------------------------------- //
|
||||
|
||||
static LONG __stdcall ToolsExceptionFilter( struct _EXCEPTION_POINTERS *ExceptionInfo )
|
||||
{
|
||||
// Non VMPI workers write a minidump and show a crash dialog like normal.
|
||||
int iType = MiniDumpNormal;
|
||||
if ( g_bToolsWriteFullMinidumps )
|
||||
iType = MiniDumpWithDataSegs | MiniDumpWithIndirectlyReferencedMemory;
|
||||
|
||||
WriteMiniDumpUsingExceptionInfo( ExceptionInfo->ExceptionRecord->ExceptionCode, ExceptionInfo, (MINIDUMP_TYPE)iType );
|
||||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
}
|
||||
|
||||
|
||||
static LONG __stdcall ToolsExceptionFilter_Custom( struct _EXCEPTION_POINTERS *ExceptionInfo )
|
||||
{
|
||||
// Run their custom handler.
|
||||
g_pCustomExceptionHandler( ExceptionInfo->ExceptionRecord->ExceptionCode, ExceptionInfo );
|
||||
return EXCEPTION_EXECUTE_HANDLER; // (never gets here anyway)
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------- //
|
||||
// Interface functions.
|
||||
// --------------------------------------------------------------------------------- //
|
||||
|
||||
void EnableFullMinidumps( bool bFull )
|
||||
{
|
||||
g_bToolsWriteFullMinidumps = bFull;
|
||||
}
|
||||
|
||||
|
||||
void SetupDefaultToolsMinidumpHandler()
|
||||
{
|
||||
SetUnhandledExceptionFilter( ToolsExceptionFilter );
|
||||
}
|
||||
|
||||
|
||||
void SetupToolsMinidumpHandler( ToolsExceptionHandler fn )
|
||||
{
|
||||
g_pCustomExceptionHandler = fn;
|
||||
SetUnhandledExceptionFilter( ToolsExceptionFilter_Custom );
|
||||
}
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================//
|
||||
|
||||
#include <windows.h>
|
||||
#include <dbghelp.h>
|
||||
#include "tier0/minidump.h"
|
||||
#include "tools_minidump.h"
|
||||
|
||||
static bool g_bToolsWriteFullMinidumps = false;
|
||||
static ToolsExceptionHandler g_pCustomExceptionHandler = NULL;
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------- //
|
||||
// Internal helpers.
|
||||
// --------------------------------------------------------------------------------- //
|
||||
|
||||
static LONG __stdcall ToolsExceptionFilter( struct _EXCEPTION_POINTERS *ExceptionInfo )
|
||||
{
|
||||
// Non VMPI workers write a minidump and show a crash dialog like normal.
|
||||
int iType = MiniDumpNormal;
|
||||
if ( g_bToolsWriteFullMinidumps )
|
||||
iType = MiniDumpWithDataSegs | MiniDumpWithIndirectlyReferencedMemory;
|
||||
|
||||
WriteMiniDumpUsingExceptionInfo( ExceptionInfo->ExceptionRecord->ExceptionCode, ExceptionInfo, (MINIDUMP_TYPE)iType );
|
||||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
}
|
||||
|
||||
|
||||
static LONG __stdcall ToolsExceptionFilter_Custom( struct _EXCEPTION_POINTERS *ExceptionInfo )
|
||||
{
|
||||
// Run their custom handler.
|
||||
g_pCustomExceptionHandler( ExceptionInfo->ExceptionRecord->ExceptionCode, ExceptionInfo );
|
||||
return EXCEPTION_EXECUTE_HANDLER; // (never gets here anyway)
|
||||
}
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------- //
|
||||
// Interface functions.
|
||||
// --------------------------------------------------------------------------------- //
|
||||
|
||||
void EnableFullMinidumps( bool bFull )
|
||||
{
|
||||
g_bToolsWriteFullMinidumps = bFull;
|
||||
}
|
||||
|
||||
|
||||
void SetupDefaultToolsMinidumpHandler()
|
||||
{
|
||||
SetUnhandledExceptionFilter( ToolsExceptionFilter );
|
||||
}
|
||||
|
||||
|
||||
void SetupToolsMinidumpHandler( ToolsExceptionHandler fn )
|
||||
{
|
||||
g_pCustomExceptionHandler = fn;
|
||||
SetUnhandledExceptionFilter( ToolsExceptionFilter_Custom );
|
||||
}
|
||||
|
Reference in New Issue
Block a user