Class AsmHook
Manages a hook which can be used to intercept a call to native function. This class is basically a thin wrapper around the LocalHook type to provide helper functions.
Inheritance
Inherited Members
Namespace: Dalamud.Hooking
Assembly: Dalamud.dll
Syntax
public sealed class AsmHook : IDisposable, IDalamudHook
Constructors
| Improve this Doc View SourceAsmHook(IntPtr, Byte[], String, AsmHookBehaviour)
Initializes a new instance of the AsmHook class. This is an assembly hook and should not be used for except under unique circumstances. Hook is not activated until Enable() method is called.
Declaration
public AsmHook(IntPtr address, byte[] assembly, string name, AsmHookBehaviour asmHookBehaviour = AsmHookBehaviour.ExecuteFirst)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IntPtr | address | A memory address to install a hook. |
| System.Byte[] | assembly | Assembly code representing your hook. |
| System.String | name | The name of what you are hooking, since a delegate is not required. |
| AsmHookBehaviour | asmHookBehaviour | How the hook is inserted into the execution flow. |
AsmHook(IntPtr, String[], String, AsmHookBehaviour)
Initializes a new instance of the AsmHook class. This is an assembly hook and should not be used for except under unique circumstances. Hook is not activated until Enable() method is called.
Declaration
public AsmHook(IntPtr address, string[] assembly, string name, AsmHookBehaviour asmHookBehaviour = AsmHookBehaviour.ExecuteFirst)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IntPtr | address | A memory address to install a hook. |
| System.String[] | assembly | FASM syntax assembly code representing your hook. The first line should be use64. |
| System.String | name | The name of what you are hooking, since a delegate is not required. |
| AsmHookBehaviour | asmHookBehaviour | How the hook is inserted into the execution flow. |
Properties
| Improve this Doc View SourceAddress
Gets a memory address of the target function.
Declaration
public IntPtr Address { get; }
Property Value
| Type | Description |
|---|---|
| System.IntPtr |
Exceptions
| Type | Condition |
|---|---|
| System.ObjectDisposedException | Hook is already disposed. |
BackendName
Gets the name of the hooking backend used for the hook.
Declaration
public string BackendName { get; }
Property Value
| Type | Description |
|---|---|
| System.String |
IsDisposed
Gets a value indicating whether or not the hook has been disposed.
Declaration
public bool IsDisposed { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
IsEnabled
Gets a value indicating whether or not the hook is enabled.
Declaration
public bool IsEnabled { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Methods
| Improve this Doc View SourceDisable()
Stops intercepting a call to the function.
Declaration
public void Disable()
Dispose()
Remove a hook from the current process.
Declaration
public void Dispose()
Enable()
Starts intercepting a call to the function.
Declaration
public void Enable()