Skip to main content

HookWith

Struct HookWith 

Source
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>

Source

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 scan errors, for a hook built with Hook::scan.
  • Error::AlreadyHooked if 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 what Hook::scan finds) must be a function with signature F, 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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.