VTable
Hook a c++ vtable.
Constructor
address: int
- the base address of the vtable.
Drop
When this is deleted, it will automatically reset all hooks.
Methods
hook
Hooks a vtable by index.
This function is unsafe π
index
must be a valid vtable index.dst
must point to axr
function with the same signature as the original (abi, parameters, and return).
index: int
- the index to hook.dst: int
- the function address to redirect the vtable entry to.
Exceptions
If virtual protect fails.
unhook
Unhooks a vtable by index.
This function is unsafe π
index
must be a valid previously hooked vtable index.
index: int
- the index to unhook.
Exceptions
If virtual protect fails.
get_original
Get a pointer to the original function stored at a previously hooked index.
This function is safe
index: int
- the index to unhook.
Return Value
Returns an int
representing a ptr to the original vtable function if index was previously hooked, otherwise returns None
.
reset
Resets all previously hooked vtable entries back to their original functions.
This function is unsafe π
Exceptions
If virtual protect fails.