HydraHook
Direct3D and Core Audio hooking library for Windows
Loading...
Searching...
No Matches
CrashHandler.h File Reference

Internal crash handler installation and teardown. More...

Go to the source code of this file.

Functions

bool HydraHookCrashHandlerInstall (PHYDRAHOOK_ENGINE engine)
 Installs global crash handlers (ref-counted) for the given engine.
void HydraHookCrashHandlerUninstall (PHYDRAHOOK_ENGINE engine)
 Decrements the crash handler reference count.
void HydraHookCrashHandlerInstallThreadSEH ()
 Installs the per-thread SEH-to-C++ translator on the calling thread.
PHYDRAHOOK_ENGINE HydraHookCrashHandlerActiveOwnerForTest ()
 Test accessor. Returns the engine that owns the published crash snapshot.
bool HydraHookCrashHandlerReferencesEngine (PHYDRAHOOK_ENGINE engine)
 True when a published or deferred snapshot still names this engine. Destroy must not free the engine while this is true.

Detailed Description

Internal crash handler installation and teardown.

Provides process-wide (reference-counted) and per-thread crash handling for field debugging. Not part of the public API.

Definition in file CrashHandler.h.

Function Documentation

◆ HydraHookCrashHandlerActiveOwnerForTest()

PHYDRAHOOK_ENGINE HydraHookCrashHandlerActiveOwnerForTest ( )

Test accessor. Returns the engine that owns the published crash snapshot.

Definition at line 600 of file CrashHandler.cpp.

References HydraHookCrashHandlerActiveOwnerForTest(), CrashConfigSnapshot::OwnerEngine, s_installMutex, and s_snapshot.

Referenced by HydraHookCrashHandlerActiveOwnerForTest().

◆ HydraHookCrashHandlerInstall()

bool HydraHookCrashHandlerInstall ( PHYDRAHOOK_ENGINE engine)

Installs global crash handlers (ref-counted) for the given engine.

On first call: registers SetUnhandledExceptionFilter, set_terminate, _set_invalid_parameter_handler, and _set_purecall_handler. Subsequent calls increment the reference count without re-installing.

Parameters
engineEngine whose CrashHandler config controls dump output.
Returns
false when engine is null or the snapshot could not be registered.

Definition at line 490 of file CrashHandler.cpp.

References HydraHookCrashHandlerInstall(), HydraHookInvalidParameterHandler(), HydraHookPurecallHandler(), HydraHookTerminateHandler(), HydraHookUnhandledExceptionFilter(), MakeSnapshot(), ReapDeferredSnapshots(), RetireSnapshot(), s_installMutex, s_prevInvalidParamHandler, s_prevPurecallHandler, s_prevTerminateHandler, s_prevUnhandledFilter, s_refCount, s_registrations, and s_snapshot.

Referenced by HydraHookCrashHandlerInstall(), and HydraHookEngineCreate().

◆ HydraHookCrashHandlerInstallThreadSEH()

void HydraHookCrashHandlerInstallThreadSEH ( )

Installs the per-thread SEH-to-C++ translator on the calling thread.

Must be called from the engine worker thread. Bridges Win32 structured exceptions into HydraHook::Core::Exceptions::SehException so that existing try/catch blocks can catch hardware faults.

Definition at line 595 of file CrashHandler.cpp.

References HydraHookCrashHandlerInstallThreadSEH(), and HydraHookSehTranslator().

Referenced by HydraHookCrashHandlerInstallThreadSEH(), and HydraHookMainThread().

◆ HydraHookCrashHandlerReferencesEngine()

bool HydraHookCrashHandlerReferencesEngine ( PHYDRAHOOK_ENGINE engine)

True when a published or deferred snapshot still names this engine. Destroy must not free the engine while this is true.

Definition at line 607 of file CrashHandler.cpp.

References HydraHookCrashHandlerReferencesEngine(), CrashConfigSnapshot::OwnerEngine, ReapDeferredSnapshots(), s_deferredSnapshots, s_installMutex, and s_snapshot.

Referenced by DestroyEngine(), HydraHookCrashHandlerReferencesEngine(), and HydraHookEngineCreate().

◆ HydraHookCrashHandlerUninstall()

void HydraHookCrashHandlerUninstall ( PHYDRAHOOK_ENGINE engine)

Decrements the crash handler reference count.

If the uninstalling engine owns the active crash config snapshot, the next surviving registration is published. The previous snapshot is deleted only after in-flight dump writers have finished. When the last engine uninstalls, restores all previous handlers.

Parameters
engineThe engine that is being destroyed.

Definition at line 530 of file CrashHandler.cpp.

References HydraHookCrashHandlerUninstall(), ReapDeferredSnapshots(), RetireSnapshot(), s_installMutex, s_prevInvalidParamHandler, s_prevPurecallHandler, s_prevTerminateHandler, s_prevUnhandledFilter, s_refCount, s_registrations, and s_snapshot.

Referenced by DestroyEngine(), HydraHookCrashHandlerUninstall(), and HydraHookEngineCreate().