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

Internal shutdown origin and cleanup for HydraHook engine. More...

Go to the source code of this file.

Enumerations

enum class  ShutdownOrigin {
  ExitProcessHook , PostQuitMessageHook , FreeLibraryHook , DllMainProcessDetach ,
  ManualUnhook
}
 Origin of the shutdown request; determines what is safe to call. More...

Functions

void PerformShutdownCleanup (PHYDRAHOOK_ENGINE engine, ShutdownOrigin origin)
 Performs pre-exit cleanup based on shutdown origin.

Detailed Description

Internal shutdown origin and cleanup for HydraHook engine.

Defines ShutdownOrigin enum and PerformShutdownCleanup for consolidated pre-exit handling. Internal use only; not part of public API.

Definition in file Shutdown.h.

Enumeration Type Documentation

◆ ShutdownOrigin

enum class ShutdownOrigin
strong

Origin of the shutdown request; determines what is safe to call.

Enumerator
ExitProcessHook 
PostQuitMessageHook 
FreeLibraryHook 
DllMainProcessDetach 
ManualUnhook 

Definition at line 19 of file Shutdown.h.

Function Documentation

◆ PerformShutdownCleanup()

void PerformShutdownCleanup ( PHYDRAHOOK_ENGINE engine,
ShutdownOrigin origin )

Performs pre-exit cleanup based on shutdown origin.

For ExitProcessHook and PostQuitMessageHook: removes the other hook, invokes EvtHydraHookGamePreExit, signals the engine thread, and waits for it to finish. For FreeLibraryHook: removes ExitProcess and PostQuitMessage hooks, invokes EvtHydraHookGamePreExit, signals and waits. For DllMainProcessDetach: skips user callbacks and uses remove_nothrow (loader lock); optionally signals and does a brief wait. For ManualUnhook (HydraHookEngineUnhook): skips EvtHydraHookGamePreExit, signals the worker, which removes every hook itself and exits without unloading the DLL, and waits for it.

Parameters
engineEngine instance to clean up.
originShutdown origin for decision making.

Definition at line 315 of file Game.cpp.

References DllMainProcessDetach, engine, ExitProcessHook, FreeLibraryHook, g_exitProcessHook, g_freeLibraryHook, g_postQuitMessageHook, HydraHookCloneRegisteredLogger(), HydraHookIpcPublish(), HydraHookIpcStateShuttingDown, IpcShutdownOrigin(), ManualUnhook, PerformShutdownCleanup(), and PostQuitMessageHook.

Referenced by DestroyEngine(), HydraHookEngineUnhook(), HydraHookMainThread(), and PerformShutdownCleanup().