Struct ilhook::x86::Hooker[][src]

pub struct Hooker { /* fields omitted */ }

The entry struct in ilhook. Please read the main doc to view usage.

Implementations

impl Hooker[src]

pub fn new(
    addr: usize,
    hook_type: HookType,
    thread_cb: CallbackOption,
    flags: HookFlags
) -> Self
[src]

Create a new Hooker.

Arguments

  • addr - The being-hooked address.
  • hook_type - The hook type and callback routine.
  • thread_cb - The callbacks before and after hooking.
  • flags - Hook flags

pub unsafe fn hook(self) -> Result<HookPoint, HookError>[src]

Consumes self and execute hooking. Return the HookPoint.

Safety

Process may crash (instead of panic!) if:

  1. addr is not an accessible memory address, or is not long enough.
  2. addr points to an incorrect position. (At the middle of an instruction, or where after it other instructions may jump to)
  3. Wrong Retn-val if hook_type is HookType::Retn. i.e. A cdecl function with non-zero retn-val, or a stdcall function with wrong retn-val.
  4. Set NOT_MODIFY_MEMORY_PROTECT where it should not be set.
  5. hook or unhook from 2 or more threads at the same time without HookFlags::NOT_MODIFY_MEMORY_PROTECT. Because of memory protection colliding.
  6. Other unpredictable errors.

Auto Trait Implementations

impl !RefUnwindSafe for Hooker

impl !Send for Hooker

impl !Sync for Hooker

impl Unpin for Hooker

impl !UnwindSafe for Hooker

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.