pub unsafe fn vmt_hook(
object: *const (),
index: usize,
detour: usize,
) -> Result<VmtHook>Expand description
hook a virtual function in an object’s VMT
§Safety
Object must be a valid C++ object with a vtable.
§Arguments
object- pointer to the C++ objectindex- vtable index of the functiondetour- address of the detour function
§Example
ⓘ
let hook = unsafe { vmt_hook(object_ptr, 5, my_detour as usize)? };
let original: fn() = unsafe { std::mem::transmute(hook.original()) };