Class DetourHelper
Inheritance
System.Object
DetourHelper
Assembly: MonoMod.RuntimeDetour.dll
Syntax
public static class DetourHelper : Object
Properties
Native
Declaration
public static IDetourNativePlatform Native { get; set; }
Property Value
Runtime
Declaration
public static IDetourRuntimePlatform Runtime { get; set; }
Property Value
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
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 |
|
Declaration
public static void FlushICache(this IDetourNativePlatform plat, NativeDetourData detour)
Parameters
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 |
|
Declaration
public static void MakeExecutable(this IDetourNativePlatform plat, NativeDetourData detour)
Parameters
Declaration
public static void MakeWritable(this IDetourNativePlatform plat, NativeDetourData detour)
Parameters
Pin<T>(T)
Declaration
public static T Pin<T>(this T method)
where T : MethodBase
Parameters
Type |
Name |
Description |
T |
method |
|
Returns
Type Parameters
StubCriticalDetour(DynamicMethodDefinition)
Fill the DynamicMethodDefinition with a throw.
Declaration
public static DynamicMethodDefinition StubCriticalDetour(this DynamicMethodDefinition dm)
Parameters
Returns
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 Parameters
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 |
|