Class NativeHook
- Namespace
- MonoMod.RuntimeDetour
- Assembly
- MonoMod.RuntimeDetour.dll
A single hook from a native function to a target delegate, optionally allowing the target to call the original function.
public sealed class NativeHook
- Inheritance
-
NativeHook
Remarks
NativeHooks, like other kinds of detours, are automatically undone when the garbage collector collects the object,
or the object is disposed. Use DetourInfo to get an object which represents the hook without
extending its lifetime.
Constructors
- NativeHook(nint, Delegate)
- Constructs a NativeHook of
function
, detouring it tohook
.
- NativeHook(nint, Delegate, IDetourFactory, DetourConfig?, bool)
- Constructs a NativeHook of
function
, detouring it tohook
using the provided config and detour factory.
- NativeHook(nint, Delegate, DetourConfig?)
- Constructs a NativeHook of
function
, detouring it tohook
using the provided config.
- NativeHook(nint, Delegate, DetourConfig?, bool)
- Constructs a NativeHook of
function
, detouring it tohook
using the provided config.
- NativeHook(nint, Delegate, bool)
- Constructs a NativeHook of
function
, detouring it tohook
.
Properties
- Config
- Gets the DetourConfig associated with this NativeHook, if any.
- DetourInfo
- Gets the NativeDetourInfo representing this hook.
- Function
- Gets a pointer to the function which this NativeHook hooks.
- IsApplied
- Gets whether or not this hook is currently applied.
- IsValid
- Gets whether or not this hook is valid.
Methods
- Apply()
- Applies the hook, if it was not already applied.
- Dispose()
- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
- ~NativeHook()
- Cleans up and undoes the hook, if needed.
- Undo()
- Undoes the hook, if it was applied.