#ifndef HL2H_HOOKS_H #define HL2H_HOOKS_H #include // One patched vtable slot. `original` receives the untouched function pointer // (it may be null if the caller does not need it). struct VtablePatch { int slot; void *replacement; void **original; }; // Clone `iface`'s vtable (preserving the Itanium ABI header), apply all // patches, and install the clone on the object. All slots belong to the same // interface. Returns false and leaves the object untouched if cloning fails or // any slot is out of range. bool hooks_install_vtable(void *iface, size_t slots, const VtablePatch *patches, int count); // Restore every patched interface's original vtable in reverse install order. // Intended for tests and shutdown; the cheat normally lives as long as the // process does. void hooks_restore_all(); int hooks_installed_count(); #endif