hook

Function hook 

Source
pub fn hook<A: Architecture>(
    target: usize,
    detour: usize,
) -> Result<HookGuard<A>>
Expand description

install an inline hook with native architecture

this is the simplest way to install a hook. returns a guard that automatically restores the original function when dropped.

§Arguments

  • target - address of the function to hook
  • detour - address of the detour function

§Returns

HookGuard that restores the original on drop

§Example

let guard = hook::<NativeArch>(target, detour)?;
let trampoline = guard.trampoline().unwrap();