Table of Contents

Method RequestHook

Namespace
Anvil.Services
Assembly
NWN.Anvil.dll

RequestHook<T>(T, int)

Requests a hook for a native function.

public FunctionHook<T> RequestHook<T>(T handler, int order = 0) where T : Delegate

Parameters

handler T

The handler to be invoked when this function is called. Once hooked, the original function will not be called, and must be invoked manually via the returned object.

order int

The execution order for this hook. See the constants in HookOrder.

Returns

FunctionHook<T>

A wrapper object containing a delegate to the original function. The wrapped object can be disposed to release the hook.

Type Parameters

T

The delegate type that identically matches the native function signature.

RequestHook<T>(void*, int)

Requests a hook for a native function.

public FunctionHook<T> RequestHook<T>(void* handler, int order = 0) where T : Delegate

Parameters

handler void*

A delegate pointer (delegate*) to be invoked when the original game function is called. Once hooked, the original function will not be called, and must be invoked manually via the returned object.

order int

The execution order for this hook. See the constants in HookOrder.

Returns

FunctionHook<T>

A wrapper object containing a delegate to the original function. The wrapped object can be disposed to release the hook.

Type Parameters

T

The delegate type that identically matches the native function signature. Must have the NativeFunctionAttribute applied.