Show / Hide Table of Contents

# 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

System.Object
AsmHook

##### Implements

System.IDisposable
IDalamudHook

##### Inherited Members

System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()

###### Namespace: Dalamud.Hooking

###### Assembly: Dalamud.dll

##### Syntax

    public sealed class AsmHook : IDisposable, IDalamudHook

### Constructors

| Improve this Doc View Source

#### AsmHook(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.

| Improve this Doc View Source

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

#### Address

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.

| Improve this Doc View Source

#### BackendName

Gets the name of the hooking backend used for the hook.

##### Declaration

    public string BackendName { get; }

##### Property Value

Type | Description
--- | ---
System.String |

| Improve this Doc View Source

#### IsDisposed

Gets a value indicating whether or not the hook has been disposed.

##### Declaration

    public bool IsDisposed { get; }

##### Property Value

Type | Description
--- | ---
System.Boolean |

| Improve this Doc View Source

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

#### Disable()

Stops intercepting a call to the function.

##### Declaration

    public void Disable()

| Improve this Doc View Source

#### Dispose()

Remove a hook from the current process.

##### Declaration

    public void Dispose()

| Improve this Doc View Source

#### Enable()

Starts intercepting a call to the function.

##### Declaration

    public void Enable()

### Implements

System.IDisposable
IDalamudHook