|
HydraHook
Direct3D and Core Audio hooking library for Windows
|
Core engine API for HydraHook - Direct3D and Core Audio hooking library. More...
Go to the source code of this file.
Classes | |
| struct | PHYDRAHOOK_EVT_PRE_EXTENSION |
| Extension data passed to pre-hook event callbacks (D3D11/12, Core Audio). More... | |
| struct | PHYDRAHOOK_EVT_POST_EXTENSION |
| Extension data passed to post-hook event callbacks (D3D11/12, Core Audio). More... | |
| struct | PHYDRAHOOK_ENGINE_CONFIG |
| Engine configuration passed to HydraHookEngineCreate. Initialize with HYDRAHOOK_ENGINE_CONFIG_INIT. New fields are appended so a caller can pass a larger config to an engine that knows only this layout. More... | |
Macros | |
| #define | HYDRAHOOK_API |
| #define | HYDRAHOOK_DEFINE_DLLMAIN(config_init) |
| Defines a compatible DllMain that bootstraps the HydraHook engine. | |
Typedefs | |
| typedef enum _HYDRAHOOK_D3D_VERSION * | PHYDRAHOOK_D3D_VERSION |
| typedef struct _HYDRAHOOK_ENGINE * | PHYDRAHOOK_ENGINE |
| Opaque handle to the HydraHook engine instance. | |
| typedef struct _HYDRAHOOK_D3D9_EVENT_CALLBACKS * | PHYDRAHOOK_D3D9_EVENT_CALLBACKS |
| typedef struct _HYDRAHOOK_D3D10_EVENT_CALLBACKS * | PHYDRAHOOK_D3D10_EVENT_CALLBACKS |
| typedef struct _HYDRAHOOK_D3D11_EVENT_CALLBACKS * | PHYDRAHOOK_D3D11_EVENT_CALLBACKS |
| typedef struct _HYDRAHOOK_D3D12_EVENT_CALLBACKS * | PHYDRAHOOK_D3D12_EVENT_CALLBACKS |
| typedef struct _HYDRAHOOK_ARC_EVENT_CALLBACKS * | PHYDRAHOOK_ARC_EVENT_CALLBACKS |
| typedef BOOL | EVT_HYDRAHOOK_CRASH_HANDLER(PHYDRAHOOK_ENGINE EngineHandle, DWORD ExceptionCode, struct _EXCEPTION_POINTERS *ExceptionInfo) |
| Crash handler callback invoked before a minidump is written. | |
| typedef EVT_HYDRAHOOK_CRASH_HANDLER * | PFN_HYDRAHOOK_CRASH_HANDLER |
| typedef VOID | EVT_HYDRAHOOK_GAME_HOOKED(PHYDRAHOOK_ENGINE EngineHandle, const HYDRAHOOK_D3D_VERSION GameVersion) |
| Callback invoked when a render API has been hooked successfully. | |
| typedef EVT_HYDRAHOOK_GAME_HOOKED * | PFN_HYDRAHOOK_GAME_HOOKED |
| typedef VOID | EVT_HYDRAHOOK_GAME_UNHOOKED(PHYDRAHOOK_ENGINE EngineHandle) |
| Callback invoked before or after unhooking the render API. | |
| typedef EVT_HYDRAHOOK_GAME_UNHOOKED * | PFN_HYDRAHOOK_GAME_UNHOOKED |
| typedef VOID | EVT_HYDRAHOOK_GAME_EXIT(PHYDRAHOOK_ENGINE EngineHandle) |
| Callback invoked when host process shutdown is detected. | |
| typedef EVT_HYDRAHOOK_GAME_EXIT * | PFN_HYDRAHOOK_GAME_EXIT |
Functions | |
| VOID | HYDRAHOOK_EVT_PRE_EXTENSION_INIT (PHYDRAHOOK_EVT_PRE_EXTENSION Extension, PHYDRAHOOK_ENGINE Engine, PVOID Context) |
| Initializes a pre-extension structure for event callbacks. | |
| VOID | HYDRAHOOK_EVT_POST_EXTENSION_INIT (PHYDRAHOOK_EVT_POST_EXTENSION Extension, PHYDRAHOOK_ENGINE Engine, PVOID Context) |
| Initializes a post-extension structure for event callbacks. | |
| VOID | HYDRAHOOK_ENGINE_CONFIG_INIT (PHYDRAHOOK_ENGINE_CONFIG EngineConfig) |
| HYDRAHOOK_ERROR | HydraHookEngineCreate (_In_ HMODULE HostInstance, _In_ PHYDRAHOOK_ENGINE_CONFIG EngineConfig, _Out_opt_ PHYDRAHOOK_ENGINE *Engine) |
| Creates and initializes the HydraHook engine. | |
| HYDRAHOOK_ERROR | HydraHookEngineDestroy (_In_ HMODULE HostInstance) |
| Destroys the engine and frees all resources. | |
| HYDRAHOOK_ERROR | HydraHookEngineUnhook (_In_ PHYDRAHOOK_ENGINE Engine) |
| Removes all render and audio hooks while keeping the DLL and engine loaded. | |
| HYDRAHOOK_ERROR | HydraHookEngineRehook (_In_ PHYDRAHOOK_ENGINE Engine) |
| Reinstalls hooks on an engine previously stopped with HydraHookEngineUnhook. | |
| HYDRAHOOK_ERROR | HydraHookEngineAllocCustomContext (_In_ PHYDRAHOOK_ENGINE Engine, _Out_ PVOID *Context, _In_ size_t ContextSize) |
| Allocates custom context memory accessible from all event callbacks. | |
| HYDRAHOOK_ERROR | HydraHookEngineFreeCustomContext (_In_ PHYDRAHOOK_ENGINE Engine) |
| Frees custom context memory for the engine. | |
| PVOID | HydraHookEngineGetCustomContext (_In_ PHYDRAHOOK_ENGINE Engine) |
| Returns pointer to custom context memory, or NULL if none allocated. | |
| BOOL | HydraHookEngineAreCallbacksDrained (_In_ PHYDRAHOOK_ENGINE Engine) |
| Reports whether all in-flight render callbacks were confirmed finished by the last unhook. | |
| VOID | HydraHookEngineSetD3D9EventCallbacks (_In_ PHYDRAHOOK_ENGINE Engine, _In_ PHYDRAHOOK_D3D9_EVENT_CALLBACKS Callbacks) |
| Registers Direct3D 9/9Ex render pipeline callbacks. | |
| VOID | HydraHookEngineSetD3D10EventCallbacks (_In_ PHYDRAHOOK_ENGINE Engine, _In_ PHYDRAHOOK_D3D10_EVENT_CALLBACKS Callbacks) |
| Registers Direct3D 10 render pipeline callbacks. | |
| VOID | HydraHookEngineSetD3D11EventCallbacks (_In_ PHYDRAHOOK_ENGINE Engine, _In_ PHYDRAHOOK_D3D11_EVENT_CALLBACKS Callbacks) |
| Registers Direct3D 11 render pipeline callbacks. | |
| VOID | HydraHookEngineSetARCEventCallbacks (_In_ PHYDRAHOOK_ENGINE Engine, _In_ PHYDRAHOOK_ARC_EVENT_CALLBACKS Callbacks) |
| Registers Core Audio (IAudioRenderClient) event callbacks. | |
| VOID | HydraHookEngineLogDebug (_In_ LPCSTR Format, _In_opt_ ...) |
| Logs a debug message (printf-style format). | |
| VOID | HydraHookEngineLogInfo (_In_ LPCSTR Format, _In_opt_ ...) |
| Logs an informational message (printf-style format). | |
| VOID | HydraHookEngineLogWarning (_In_ LPCSTR Format, _In_opt_ ...) |
| Logs a warning message (printf-style format). | |
| VOID | HydraHookEngineLogError (_In_ LPCSTR Format, _In_opt_ ...) |
| Logs an error message (printf-style format). | |
Core engine API for HydraHook - Direct3D and Core Audio hooking library.
This header defines the main engine interface, configuration structures, error codes, and lifecycle functions. Intended to be called from DllMain() at DLL_PROCESS_ATTACH and DLL_PROCESS_DETACH.
Definition in file HydraHookCore.h.
| #define HYDRAHOOK_API |
Definition at line 52 of file HydraHookCore.h.
Referenced by HydraHookD3D12ReadbackCreate(), HydraHookD3D12ReadbackCreate(), HydraHookD3D12ReadbackCreateRegion(), HydraHookD3D12ReadbackCreateRegion(), HydraHookD3D12ReadbackDestroy(), HydraHookD3D12ReadbackDestroy(), HydraHookD3D12ReadbackReleaseFrame(), HydraHookD3D12ReadbackReleaseFrame(), HydraHookD3D12ReadbackTryReadLatest(), HydraHookD3D12ReadbackTryReadLatest(), HydraHookD3D12ReadbackTrySubmit(), HydraHookD3D12ReadbackTrySubmit(), HydraHookEngineAllocCustomContext(), HydraHookEngineAllocCustomContext(), HydraHookEngineAreCallbacksDrained(), HydraHookEngineAreCallbacksDrained(), HydraHookEngineCreate(), HydraHookEngineCreate(), HydraHookEngineDeferD3D12Resize(), HydraHookEngineDeferD3D12Resize(), HydraHookEngineDestroy(), HydraHookEngineDestroy(), HydraHookEngineFreeCustomContext(), HydraHookEngineFreeCustomContext(), HydraHookEngineGetCustomContext(), HydraHookEngineGetCustomContext(), HydraHookEngineGetD3D12CommandQueue(), HydraHookEngineGetD3D12CommandQueue(), HydraHookEngineGetHandleFromD3D10SwapChain(), HydraHookEngineGetHandleFromD3D10SwapChain(), HydraHookEngineGetHandleFromD3D9Device(), HydraHookEngineGetHandleFromD3D9Device(), HydraHookEngineGetHandleFromD3D9ExDevice(), HydraHookEngineGetHandleFromD3D9ExDevice(), HydraHookEngineGetVerifiedD3D12CommandQueue(), HydraHookEngineGetVerifiedD3D12CommandQueue(), HydraHookEngineLogDebug(), HydraHookEngineLogDebug(), HydraHookEngineLogError(), HydraHookEngineLogError(), HydraHookEngineLogInfo(), HydraHookEngineLogInfo(), HydraHookEngineLogWarning(), HydraHookEngineLogWarning(), HydraHookEngineRehook(), HydraHookEngineRehook(), HydraHookEngineSetARCEventCallbacks(), HydraHookEngineSetARCEventCallbacks(), HydraHookEngineSetD3D10EventCallbacks(), HydraHookEngineSetD3D10EventCallbacks(), HydraHookEngineSetD3D11EventCallbacks(), HydraHookEngineSetD3D11EventCallbacks(), HydraHookEngineSetD3D12EventCallbacks(), HydraHookEngineSetD3D12EventCallbacks(), HydraHookEngineSetD3D9EventCallbacks(), HydraHookEngineSetD3D9EventCallbacks(), HydraHookEngineUnhook(), and HydraHookEngineUnhook().
| #define HYDRAHOOK_DEFINE_DLLMAIN | ( | config_init | ) |
Defines a compatible DllMain that bootstraps the HydraHook engine.
Use this macro in exactly one translation unit of your hosting DLL. Requires Windows.h (or equivalent) to be included before use.
| config_init | Block of statements that configure the engine config. The config variable is named cfg (HYDRAHOOK_ENGINE_CONFIG). Example: cfg.Direct3D.HookDirect3D11 = TRUE;
cfg.EvtHydraHookGameHooked = EvtHydraHookGameHooked;
cfg.CrashHandler.IsEnabled = TRUE;
)
#define HYDRAHOOK_DEFINE_DLLMAIN(config_init) Defines a compatible DllMain that bootstraps the HydraHook engine. Definition HydraHookCore.h:293 |
Definition at line 293 of file HydraHookCore.h.
| typedef BOOL EVT_HYDRAHOOK_CRASH_HANDLER(PHYDRAHOOK_ENGINE EngineHandle, DWORD ExceptionCode, struct _EXCEPTION_POINTERS *ExceptionInfo) |
Crash handler callback invoked before a minidump is written.
Definition at line 173 of file HydraHookCore.h.
| typedef VOID EVT_HYDRAHOOK_GAME_EXIT(PHYDRAHOOK_ENGINE EngineHandle) |
Callback invoked when host process shutdown is detected.
Definition at line 206 of file HydraHookCore.h.
| typedef VOID EVT_HYDRAHOOK_GAME_HOOKED(PHYDRAHOOK_ENGINE EngineHandle, const HYDRAHOOK_D3D_VERSION GameVersion) |
Callback invoked when a render API has been hooked successfully.
Definition at line 185 of file HydraHookCore.h.
| typedef VOID EVT_HYDRAHOOK_GAME_UNHOOKED(PHYDRAHOOK_ENGINE EngineHandle) |
Callback invoked before or after unhooking the render API.
Definition at line 196 of file HydraHookCore.h.
Definition at line 179 of file HydraHookCore.h.
Definition at line 210 of file HydraHookCore.h.
Definition at line 190 of file HydraHookCore.h.
Definition at line 200 of file HydraHookCore.h.
| typedef struct HYDRAHOOK_ARC_EVENT_CALLBACKS * PHYDRAHOOK_ARC_EVENT_CALLBACKS |
Core Audio callbacks.
Definition at line 99 of file HydraHookCore.h.
| typedef struct HYDRAHOOK_D3D10_EVENT_CALLBACKS * PHYDRAHOOK_D3D10_EVENT_CALLBACKS |
D3D10 callbacks.
Definition at line 96 of file HydraHookCore.h.
| typedef struct HYDRAHOOK_D3D11_EVENT_CALLBACKS * PHYDRAHOOK_D3D11_EVENT_CALLBACKS |
D3D11 callbacks.
Definition at line 97 of file HydraHookCore.h.
| typedef struct HYDRAHOOK_D3D12_EVENT_CALLBACKS * PHYDRAHOOK_D3D12_EVENT_CALLBACKS |
D3D12 callbacks.
Definition at line 98 of file HydraHookCore.h.
| typedef struct HYDRAHOOK_D3D9_EVENT_CALLBACKS * PHYDRAHOOK_D3D9_EVENT_CALLBACKS |
D3D9 callbacks.
Definition at line 95 of file HydraHookCore.h.
| typedef enum _HYDRAHOOK_D3D_VERSION * PHYDRAHOOK_D3D_VERSION |
| typedef struct _HYDRAHOOK_ENGINE* PHYDRAHOOK_ENGINE |
Opaque handle to the HydraHook engine instance.
Definition at line 93 of file HydraHookCore.h.
Bitmask of detected Direct3D API versions.
Definition at line 84 of file HydraHookCore.h.
| enum HYDRAHOOK_DUMP_TYPE |
Minidump verbosity levels for the crash handler.
| Enumerator | |
|---|---|
| HydraHookDumpTypeMinimal | Threads + stacks only (small). |
| HydraHookDumpTypeNormal |
|
| HydraHookDumpTypeFull | Full process memory (large). |
Definition at line 160 of file HydraHookCore.h.
| enum HYDRAHOOK_ERROR |
Error codes returned by HydraHook engine functions.
| Enumerator | |
|---|---|
| HYDRAHOOK_ERROR_NONE | Success. |
| HYDRAHOOK_ERROR_INVALID_ENGINE_HANDLE | Engine handle is NULL or invalid. |
| HYDRAHOOK_ERROR_CREATE_THREAD_FAILED | CreateThread failed for hook worker. |
| HYDRAHOOK_ERROR_ENGINE_ALLOCATION_FAILED | Failed to allocate engine structure. |
| HYDRAHOOK_ERROR_ENGINE_ALREADY_ALLOCATED | Engine already created for this HMODULE. |
| HYDRAHOOK_ERROR_INVALID_HMODULE_HANDLE | HMODULE not associated with an engine. |
| HYDRAHOOK_ERROR_GET_MODULE_HANDLE_FAILED | GetModuleHandleEx failed. |
| HYDRAHOOK_ERROR_REFERENCE_INCREMENT_FAILED |
|
| HYDRAHOOK_ERROR_CONTEXT_ALLOCATION_FAILED | Custom context allocation failed. |
| HYDRAHOOK_ERROR_CREATE_EVENT_FAILED | CreateEvent failed for cancellation. |
| HYDRAHOOK_ERROR_CREATE_LOGGER_FAILED | Failed to create fallback logger. |
| HYDRAHOOK_ERROR_NO_LOADER_LOCK | Initialization attempted outside of loader lock. |
| HYDRAHOOK_ERROR_UNHOOK_INCOMPLETE | Worker did not finish unhooking, or hook callbacks are still running; engine state is kept, retry later. |
| HYDRAHOOK_ERROR_INVALID_ENGINE_CONFIG | The engine config size is smaller than required. |
Definition at line 62 of file HydraHookCore.h.
|
inline |
Initialize an HYDRAHOOK_ENGINE_CONFIG structure with library defaults (logging enabled; fallback log path "%TEMP%\\HydraHook.log").
| [in,out] | EngineConfig | Pointer to the HYDRAHOOK_ENGINE_CONFIG to initialize. Must point to a writable structure. |
Definition at line 263 of file HydraHookCore.h.
References HYDRAHOOK_ENGINE_CONFIG_INIT(), and HydraHookDumpTypeNormal.
Referenced by HYDRAHOOK_ENGINE_CONFIG_INIT(), and HydraHookEngineCreate().
|
inline |
Initializes a post-extension structure for event callbacks.
| [in,out] | Extension | The extension structure to initialize. |
| [in] | Engine | The engine handle. |
| [in] | Context | Optional custom context pointer. |
Definition at line 145 of file HydraHookCore.h.
References HYDRAHOOK_EVT_POST_EXTENSION_INIT().
Referenced by HYDRAHOOK_EVT_POST_EXTENSION_INIT().
|
inline |
Initializes a pre-extension structure for event callbacks.
| [in,out] | Extension | The extension structure to initialize. |
| [in] | Engine | The engine handle. |
| [in] | Context | Optional custom context pointer. |
Definition at line 117 of file HydraHookCore.h.
References HYDRAHOOK_EVT_PRE_EXTENSION_INIT().
Referenced by HYDRAHOOK_EVT_PRE_EXTENSION_INIT().
| HYDRAHOOK_ERROR HydraHookEngineAllocCustomContext | ( | _In_ PHYDRAHOOK_ENGINE | Engine, |
| _Out_ PVOID * | Context, | ||
| _In_ size_t | ContextSize ) |
Allocates custom context memory accessible from all event callbacks.
Replaces any previously allocated context. Use HydraHookEngineGetCustomContext from callbacks to retrieve the pointer.
| [in] | Engine | Valid engine handle. |
| [out] | Context | Receives pointer to allocated memory. |
| [in] | ContextSize | Size in bytes. |
| HYDRAHOOK_ERROR_NONE | Success. |
| HYDRAHOOK_ERROR_INVALID_ENGINE_HANDLE | Engine is NULL. |
| HYDRAHOOK_ERROR_CONTEXT_ALLOCATION_FAILED | malloc failed. |
References HYDRAHOOK_API, and HydraHookEngineAllocCustomContext().
Referenced by HydraHookEngineAllocCustomContext(), and HydraHookEngineAllocCustomContext().
| BOOL HydraHookEngineAreCallbacksDrained | ( | _In_ PHYDRAHOOK_ENGINE | Engine | ) |
Reports whether all in-flight render callbacks were confirmed finished by the last unhook.
Query it from EvtHydraHookGamePostUnhook before destroying a custom context. When it returns FALSE, a callback may still hold a pointer obtained from the context; keep the context allocated. The engine releases it in HydraHookEngineDestroy after the callbacks have returned.
| [in] | Engine | Valid engine handle. |
Engine is NULL. References HYDRAHOOK_API, and HydraHookEngineAreCallbacksDrained().
Referenced by HydraHookEngineAreCallbacksDrained(), and HydraHookEngineAreCallbacksDrained().
| HYDRAHOOK_ERROR HydraHookEngineCreate | ( | _In_ HMODULE | HostInstance, |
| _In_ PHYDRAHOOK_ENGINE_CONFIG | EngineConfig, | ||
| _Out_opt_ PHYDRAHOOK_ENGINE * | Engine ) |
Creates and initializes the HydraHook engine.
Spawns a worker thread that detects and hooks the host process's render pipeline (Direct3D 9/10/11/12) and optionally Core Audio. Also hooks ExitProcess, PostQuitMessage, and FreeLibrary for graceful shutdown. Set Shutdown.DisableThreadQuitMonitoring to let a host thread quit independently. On FreeLibrary of the host module the hook destroys the engine before entering the loader, then calls FreeLibraryAndExitThread(hLibModule, TRUE) so remote-thread ejectors observe a TRUE BOOL result. Busy teardown returns FALSE with ERROR_BUSY and can be retried. Call from DllMain() at DLL_PROCESS_ATTACH.
| [in] | HostInstance | HMODULE of the injecting DLL (typically from DllMain). |
| [in] | EngineConfig | Configuration and callbacks initialized with HYDRAHOOK_ENGINE_CONFIG_INIT. |
| [out] | Engine | Optional; receives the engine handle on success. |
| HYDRAHOOK_ERROR_NONE | Success. |
| HYDRAHOOK_ERROR_ENGINE_ALREADY_ALLOCATED | Engine already exists for this HMODULE. |
| HYDRAHOOK_ERROR_GET_MODULE_HANDLE_FAILED | GetModuleHandleEx failed (deprecated alias: HYDRAHOOK_ERROR_REFERENCE_INCREMENT_FAILED). |
| HYDRAHOOK_ERROR_ENGINE_ALLOCATION_FAILED | malloc failed. |
| HYDRAHOOK_ERROR_CREATE_EVENT_FAILED | CreateEvent failed. |
| HYDRAHOOK_ERROR_CREATE_THREAD_FAILED | CreateThread failed. |
| HYDRAHOOK_ERROR_CREATE_LOGGER_FAILED | Fallback logger creation failed. |
| HYDRAHOOK_ERROR_INVALID_ENGINE_CONFIG | Configuration's Size is smaller than required. |
References HYDRAHOOK_API, and HydraHookEngineCreate().
Referenced by HydraHookEngineCreate(), and HydraHookEngineCreate().
| HYDRAHOOK_ERROR HydraHookEngineDestroy | ( | _In_ HMODULE | HostInstance | ) |
Destroys the engine and frees all resources.
Unhooks the render pipeline and invokes shutdown callbacks. Call from DllMain() at DLL_PROCESS_DETACH. This function does not wait, including on the lifecycle lock. It frees the engine, its cancellation event, and its thread handle only after the worker has exited and a current callback drain succeeds. Otherwise the engine stays allocated, the module that contains the worker is pinned for the rest of the process, and static Hook destructors do not detach.
| [in] | HostInstance | HMODULE passed to HydraHookEngineCreate. |
| HYDRAHOOK_ERROR_NONE | Success. |
| HYDRAHOOK_ERROR_INVALID_HMODULE_HANDLE | No engine for this HMODULE. |
| HYDRAHOOK_ERROR_UNHOOK_INCOMPLETE | The lifecycle lock is busy, or the worker or a hook callback is still running. The engine and its thread handle stay allocated. A DLL_PROCESS_DETACH caller cannot retry after the loader would have unmapped the module; the pin keeps that code mapped. |
References HYDRAHOOK_API, and HydraHookEngineDestroy().
Referenced by HydraHookEngineDestroy(), and HydraHookEngineDestroy().
| HYDRAHOOK_ERROR HydraHookEngineFreeCustomContext | ( | _In_ PHYDRAHOOK_ENGINE | Engine | ) |
Frees custom context memory for the engine.
| [in] | Engine | Valid engine handle. |
| HYDRAHOOK_ERROR_NONE | Success. |
| HYDRAHOOK_ERROR_INVALID_ENGINE_HANDLE | Engine is NULL. |
References HYDRAHOOK_API, and HydraHookEngineFreeCustomContext().
Referenced by HydraHookEngineAllocCustomContext(), HydraHookEngineFreeCustomContext(), and HydraHookEngineFreeCustomContext().
| PVOID HydraHookEngineGetCustomContext | ( | _In_ PHYDRAHOOK_ENGINE | Engine | ) |
Returns pointer to custom context memory, or NULL if none allocated.
| [in] | Engine | Valid engine handle. |
References HYDRAHOOK_API, and HydraHookEngineGetCustomContext().
Referenced by HydraHookEngineGetCustomContext(), and HydraHookEngineGetCustomContext().
| VOID HydraHookEngineLogDebug | ( | _In_ LPCSTR | Format, |
| _In_opt_ ... | ) |
Logs a debug message (printf-style format).
| [in] | Format | printf format string. |
| [in] | ... | Format arguments. |
References HYDRAHOOK_API, and HydraHookEngineLogDebug().
Referenced by HydraHookEngineLogDebug(), and HydraHookEngineLogDebug().
| VOID HydraHookEngineLogError | ( | _In_ LPCSTR | Format, |
| _In_opt_ ... | ) |
Logs an error message (printf-style format).
| [in] | Format | printf format string. |
| [in] | ... | Format arguments. |
References HYDRAHOOK_API, and HydraHookEngineLogError().
Referenced by HydraHookEngineLogError(), and HydraHookEngineLogError().
| VOID HydraHookEngineLogInfo | ( | _In_ LPCSTR | Format, |
| _In_opt_ ... | ) |
Logs an informational message (printf-style format).
| [in] | Format | printf format string. |
| [in] | ... | Format arguments. |
References HYDRAHOOK_API, and HydraHookEngineLogInfo().
Referenced by HydraHookEngineLogInfo(), and HydraHookEngineLogInfo().
| VOID HydraHookEngineLogWarning | ( | _In_ LPCSTR | Format, |
| _In_opt_ ... | ) |
Logs a warning message (printf-style format).
| [in] | Format | printf format string. |
| [in] | ... | Format arguments. |
References HYDRAHOOK_API, and HydraHookEngineLogWarning().
Referenced by HydraHookEngineLogWarning(), and HydraHookEngineLogWarning().
| HYDRAHOOK_ERROR HydraHookEngineRehook | ( | _In_ PHYDRAHOOK_ENGINE | Engine | ) |
Reinstalls hooks on an engine previously stopped with HydraHookEngineUnhook.
Clears the shutdown state, re-arms the once-per-hook announcements (so EvtHydraHookGameHooked fires again), restores the registered callback tables, and starts a new worker thread. Calling it on an engine whose worker is running succeeds.
Do not call while holding the loader lock (for example from DllMain), from a hook callback, or from the engine worker thread.
| [in] | Engine | Valid engine handle. |
| HYDRAHOOK_ERROR_NONE | Success or already hooked. |
| HYDRAHOOK_ERROR_INVALID_ENGINE_HANDLE | Engine is NULL. |
| HYDRAHOOK_ERROR_CREATE_THREAD_FAILED | CreateThread failed. |
| HYDRAHOOK_ERROR_UNHOOK_INCOMPLETE | Callbacks from the previous run are still active. |
References HYDRAHOOK_API, and HydraHookEngineRehook().
Referenced by HydraHookEngineRehook(), and HydraHookEngineRehook().
| VOID HydraHookEngineSetARCEventCallbacks | ( | _In_ PHYDRAHOOK_ENGINE | Engine, |
| _In_ PHYDRAHOOK_ARC_EVENT_CALLBACKS | Callbacks ) |
Registers Core Audio (IAudioRenderClient) event callbacks.
| [in] | Engine | Valid engine handle. |
| [in] | Callbacks | Callback collection; NULL pointers are ignored. |
References HYDRAHOOK_API, and HydraHookEngineSetARCEventCallbacks().
Referenced by HydraHookEngineSetARCEventCallbacks(), and HydraHookEngineSetARCEventCallbacks().
| VOID HydraHookEngineSetD3D10EventCallbacks | ( | _In_ PHYDRAHOOK_ENGINE | Engine, |
| _In_ PHYDRAHOOK_D3D10_EVENT_CALLBACKS | Callbacks ) |
Registers Direct3D 10 render pipeline callbacks.
| [in] | Engine | Valid engine handle. |
| [in] | Callbacks | Callback collection; NULL pointers are ignored. |
References HYDRAHOOK_API, and HydraHookEngineSetD3D10EventCallbacks().
Referenced by HydraHookEngineSetD3D10EventCallbacks(), and HydraHookEngineSetD3D10EventCallbacks().
| VOID HydraHookEngineSetD3D11EventCallbacks | ( | _In_ PHYDRAHOOK_ENGINE | Engine, |
| _In_ PHYDRAHOOK_D3D11_EVENT_CALLBACKS | Callbacks ) |
Registers Direct3D 11 render pipeline callbacks.
| [in] | Engine | Valid engine handle. |
| [in] | Callbacks | Callback collection; NULL pointers are ignored. |
References HYDRAHOOK_API, and HydraHookEngineSetD3D11EventCallbacks().
Referenced by HydraHookEngineSetD3D11EventCallbacks(), and HydraHookEngineSetD3D11EventCallbacks().
| VOID HydraHookEngineSetD3D9EventCallbacks | ( | _In_ PHYDRAHOOK_ENGINE | Engine, |
| _In_ PHYDRAHOOK_D3D9_EVENT_CALLBACKS | Callbacks ) |
Registers Direct3D 9/9Ex render pipeline callbacks.
| [in] | Engine | Valid engine handle. |
| [in] | Callbacks | Callback collection; NULL pointers are ignored. |
References HYDRAHOOK_API, and HydraHookEngineSetD3D9EventCallbacks().
Referenced by HydraHookEngineSetD3D9EventCallbacks(), and HydraHookEngineSetD3D9EventCallbacks().
| HYDRAHOOK_ERROR HydraHookEngineUnhook | ( | _In_ PHYDRAHOOK_ENGINE | Engine | ) |
Removes all render and audio hooks while keeping the DLL and engine loaded.
Invokes EvtHydraHookGamePreUnhook and EvtHydraHookGamePostUnhook, stops the worker thread, and clears the live callback tables. Callbacks registered through the HydraHookEngineSet*EventCallbacks functions are retained and restored by HydraHookEngineRehook. Calling it on an already unhooked engine succeeds.
Do not call while holding the loader lock (for example from DllMain), from a hook callback, or from the engine worker thread.
| [in] | Engine | Valid engine handle. |
| HYDRAHOOK_ERROR_NONE | Success or already unhooked. |
| HYDRAHOOK_ERROR_INVALID_ENGINE_HANDLE | Engine is NULL. |
| HYDRAHOOK_ERROR_UNHOOK_INCOMPLETE | The worker did not exit within 8 seconds, or a hook callback is still running. The worker is never terminated and the engine state is kept; call again later. Do not free resources used by callbacks yet. |
References HYDRAHOOK_API, and HydraHookEngineUnhook().
Referenced by HydraHookEngineUnhook(), and HydraHookEngineUnhook().