Struct frida_gum::interceptor::Interceptor [−][src]
pub struct Interceptor<'a> { /* fields omitted */ }
Expand description
Function hooking engine interface.
Implementations
Obtain an Interceptor handle, ensuring that the runtime is properly initialized. This may be called as many times as needed, and results in a no-op if the Interceptor is already initialized.
pub fn attach<I: InvocationListener>(
&mut self,
f: NativePointer,
listener: &mut I
) -> NativePointer
This is supported on crate feature invocation-listener
only.
pub fn attach<I: InvocationListener>(
&mut self,
f: NativePointer,
listener: &mut I
) -> NativePointer
invocation-listener
only.Attach a listener to the beginning of a function address.
Safety
The provided address must point to the start of a function in a valid memory region.
This is supported on crate feature invocation-listener
only.
invocation-listener
only.Detach an attached listener.
Safety
The listener must have been attached with Interceptor::attach()
.
pub fn replace(
&mut self,
function: NativePointer,
replacement: NativePointer,
replacement_data: NativePointer
) -> Result<()>
pub fn replace(
&mut self,
function: NativePointer,
replacement: NativePointer,
replacement_data: NativePointer
) -> Result<()>
Replace a function with another function. The new function should have the same signature as the old one.
Safety
Assumes that the provided function and replacement addresses are valid and point to the start of valid functions
Reverts a function replacement for the given function, such that the implementation is the original function.
Safety
Assumes that function is the start of a real function previously replaced uisng
Interceptor::replace
.
This is supported on crate feature invocation-listener
only.
invocation-listener
only.Retrieve the current InvocationContext
.
Safety
Should only be called from within a hook or replacement function.
Begin an Interceptor
transaction. This may improve performance if
applying many hooks.
Safety
After placing hooks, the transaction must be ended with Interceptor::end_transaction()
.
End an Interceptor
transaction. This must be called after placing hooks
if in a transaction started with Interceptor::begin_transaction()
.