SwiftlyS2

IUnmanagedFunction

Interface IUnmanagedFunction

Namespace: SwiftlyS2.Shared.Memory

Assembly: SwiftlyS2.CS2.dll

public interface IUnmanagedFunction<TDelegate> where TDelegate : Delegate
Type Parameters
  • TDelegate

Properties

Address

The address of the unmanaged function.

nint Address { get; }
Property Value

Call

The delegate that directly call to the address. Might be hooked by other plugins or core.

TDelegate Call { get; }
Property Value
  • TDelegate

CallOriginal

The unhooked original function delegate. Call this if you don't want your invocation to be hooked.

TDelegate CallOriginal { get; }
Property Value
  • TDelegate

Methods

AddHook(Func<Func<TDelegate>, TDelegate>)

Hook a native function at the specified address with a managed callback. The callbackBuilder receives the pointer to the "next" function in the chain (previous callback if any, or the original function pointer if this is the first callback), and must return a delegate matching the native function signature with proper calling convention.

Guid AddHook(Func<Func<TDelegate>, TDelegate> callbackBuilder)
Parameters
Returns
  • Guid — a guid for the hook.

RemoveHook(Guid)

Unhook a hook by its id.

void RemoveHook(Guid id)
Parameters
  • id Guid — The id of the hook to unhook.

On this page