Show / Hide Table of Contents

    Class DetourHelper

    Inheritance
    System.Object
    DetourHelper
    Namespace: MonoMod.RuntimeDetour
    Assembly: MonoMod.RuntimeDetour.dll
    Syntax
    public static class DetourHelper : Object

    Properties

    Native

    Declaration
    public static IDetourNativePlatform Native { get; set; }
    Property Value
    Type Description
    IDetourNativePlatform

    Runtime

    Declaration
    public static IDetourRuntimePlatform Runtime { get; set; }
    Property Value
    Type Description
    IDetourRuntimePlatform

    Methods

    CreateILCopy(MethodBase)

    Declaration
    public static MethodInfo CreateILCopy(this MethodBase method)
    Parameters
    Type Name Description
    System.Reflection.MethodBase method
    Returns
    Type Description
    System.Reflection.MethodInfo

    EmitDetourApply(ILProcessor, NativeDetourData)

    Emit a call to DetourManager.Native.Apply using a copy of the given data.

    Declaration
    public static void EmitDetourApply(this ILProcessor il, NativeDetourData data)
    Parameters
    Type Name Description
    Mono.Cecil.Cil.ILProcessor il
    NativeDetourData data

    EmitDetourCopy(ILProcessor, IntPtr, IntPtr, Byte)

    Emit a call to DetourManager.Native.Copy using the given parameters.

    Declaration
    public static void EmitDetourCopy(this ILProcessor il, IntPtr src, IntPtr dst, byte type)
    Parameters
    Type Name Description
    Mono.Cecil.Cil.ILProcessor il
    System.IntPtr src
    System.IntPtr dst
    System.Byte type

    FlushICache(IDetourNativePlatform, NativeDetourData)

    Declaration
    public static void FlushICache(this IDetourNativePlatform plat, NativeDetourData detour)
    Parameters
    Type Name Description
    IDetourNativePlatform plat
    NativeDetourData detour

    GenerateNativeProxy(IntPtr, MethodBase)

    Generate a DynamicMethod to easily call the given native function from another DynamicMethod.

    Declaration
    public static MethodInfo GenerateNativeProxy(IntPtr target, MethodBase signature)
    Parameters
    Type Name Description
    System.IntPtr target

    The pointer to the native function to call.

    System.Reflection.MethodBase signature

    A MethodBase with the target function's signature.

    Returns
    Type Description
    System.Reflection.MethodInfo

    The detoured DynamicMethod.

    GetNativeStart(Delegate)

    Declaration
    public static IntPtr GetNativeStart(this Delegate method)
    Parameters
    Type Name Description
    System.Delegate method
    Returns
    Type Description
    System.IntPtr

    GetNativeStart(Expression)

    Declaration
    public static IntPtr GetNativeStart(this Expression method)
    Parameters
    Type Name Description
    System.Linq.Expressions.Expression method
    Returns
    Type Description
    System.IntPtr

    GetNativeStart(MethodBase)

    Declaration
    public static IntPtr GetNativeStart(this MethodBase method)
    Parameters
    Type Name Description
    System.Reflection.MethodBase method
    Returns
    Type Description
    System.IntPtr

    MakeExecutable(IDetourNativePlatform, NativeDetourData)

    Declaration
    public static void MakeExecutable(this IDetourNativePlatform plat, NativeDetourData detour)
    Parameters
    Type Name Description
    IDetourNativePlatform plat
    NativeDetourData detour

    MakeWritable(IDetourNativePlatform, NativeDetourData)

    Declaration
    public static void MakeWritable(this IDetourNativePlatform plat, NativeDetourData detour)
    Parameters
    Type Name Description
    IDetourNativePlatform plat
    NativeDetourData detour

    Pin<T>(T)

    Declaration
    public static T Pin<T>(this T method)
        where T : MethodBase
    Parameters
    Type Name Description
    T method
    Returns
    Type Description
    T
    Type Parameters
    Name Description
    T

    StubCriticalDetour(DynamicMethodDefinition)

    Fill the DynamicMethodDefinition with a throw.

    Declaration
    public static DynamicMethodDefinition StubCriticalDetour(this DynamicMethodDefinition dm)
    Parameters
    Type Name Description
    DynamicMethodDefinition dm
    Returns
    Type Description
    DynamicMethodDefinition

    TryCreateILCopy(MethodBase, out MethodInfo)

    Declaration
    public static bool TryCreateILCopy(this MethodBase method, out MethodInfo dm)
    Parameters
    Type Name Description
    System.Reflection.MethodBase method
    System.Reflection.MethodInfo dm
    Returns
    Type Description
    System.Boolean

    Unpin<T>(T)

    Declaration
    public static T Unpin<T>(this T method)
        where T : MethodBase
    Parameters
    Type Name Description
    T method
    Returns
    Type Description
    T
    Type Parameters
    Name Description
    T

    Write(IntPtr, ref Int32, Byte)

    Write the given value at the address to + offs, afterwards advancing offs by sizeof(byte).

    Declaration
    public static void Write(this IntPtr to, ref int offs, byte value)
    Parameters
    Type Name Description
    System.IntPtr to
    System.Int32 offs
    System.Byte value

    Write(IntPtr, ref Int32, UInt16)

    Write the given value at the address to + offs, afterwards advancing offs by sizeof(ushort).

    Declaration
    public static void Write(this IntPtr to, ref int offs, ushort value)
    Parameters
    Type Name Description
    System.IntPtr to
    System.Int32 offs
    System.UInt16 value

    Write(IntPtr, ref Int32, UInt32)

    Write the given value at the address to + offs, afterwards advancing offs by sizeof(ushort).

    Declaration
    public static void Write(this IntPtr to, ref int offs, uint value)
    Parameters
    Type Name Description
    System.IntPtr to
    System.Int32 offs
    System.UInt32 value

    Write(IntPtr, ref Int32, UInt64)

    Write the given value at the address to + offs, afterwards advancing offs by sizeof(ulong).

    Declaration
    public static void Write(this IntPtr to, ref int offs, ulong value)
    Parameters
    Type Name Description
    System.IntPtr to
    System.Int32 offs
    System.UInt64 value
    Back to top Yet another C# modding swiss army knife.