Skip to main content
Version: 15.x (API 15) [Current]

Class Hook<T>

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.

Assembly: Dalamud.dll​
Declaration
public abstract class Hook<T> : IDalamudHook, IDisposable where T : Delegate

Implements:
Dalamud.Hooking.IDalamudHook, System.IDisposable

Properties​

Address​

Gets a memory address of the target function.

Declaration
public nint Address { get; }

Original​

Gets a delegate function that can be used to call the actual function as if function is not hooked yet.

Declaration
public virtual T Original { get; }

OriginalDisposeSafe​

Gets a delegate function that can be used to call the actual function as if function is not hooked yet. This can be called even after Dispose.

Declaration
public T OriginalDisposeSafe { get; }

IsEnabled​

Gets a value indicating whether the hook is enabled.

Declaration
public virtual bool IsEnabled { get; }

IsDisposed​

Gets a value indicating whether the hook has been disposed.

Declaration
public bool IsDisposed { get; }

BackendName​

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

Declaration
public virtual string BackendName { get; }

HookId​

Gets the unique GUID for this hook.

Declaration
protected Guid HookId { get; }

Methods​

Dispose()​

Remove a hook from the current process.

Declaration
public virtual void Dispose()

Enable()​

Starts intercepting a call to the function.

Declaration
public virtual void Enable()
Exceptions​

System.ObjectDisposedException
Hook is already disposed.

Disable()​

Stops intercepting a call to the function.

Declaration
public virtual void Disable()

CheckDisposed()​

Check if this object has been disposed already.

Declaration
protected void CheckDisposed()

Implements​