pub struct HookWith<F: Function> { /* private fields */ }Expand description
A hook builder holding the target and detour, returned by
HookBuilder::redirect and HookScan::redirect.
Implementations§
Source§impl<F: Function> HookWith<F>
impl<F: Function> HookWith<F>
Sourcepub unsafe fn install(self) -> Result<Hook<F>>
pub unsafe fn install(self) -> Result<Hook<F>>
Installs the hook, disabled; enable it with Hook::enable.
Only calls that reach the target are redirected; copies inlined into callers are not.
§Errors
- The
scanerrors, for a hook built withHook::scan. Error::AlreadyHookedif a detour or injection already holds the address.- Otherwise an error naming the target if it can’t be patched.
§Safety
- The target (the address given to
Hook::at, or whatHook::scanfinds) must be a function with signatureF, not one the compiler may have inlined into all its callers. - The detour must match that signature and calling convention.
Auto Trait Implementations§
impl<F> !Send for HookWith<F>
impl<F> !Sync for HookWith<F>
impl<F> Freeze for HookWith<F>where
F: Freeze,
impl<F> RefUnwindSafe for HookWith<F>where
F: RefUnwindSafe,
impl<F> Unpin for HookWith<F>where
F: Unpin,
impl<F> UnsafeUnpin for HookWith<F>where
F: UnsafeUnpin,
impl<F> UnwindSafe for HookWith<F>where
F: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more