Class Hook
  
  
  
  
    Inheritance
    System.Object
    Hook
      
      
   
  
    Implements
    
    System.IDisposable
   
  
  Assembly: MonoMod.RuntimeDetour.dll
  Syntax
  
    public class Hook : Object, IDetour, IDisposable
   
  Constructors
  
  
  
  
  Hook(Delegate, Delegate)
  
  
  Declaration
  
    public Hook(Delegate from, Delegate to)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | System.Delegate | from |  | 
      
        | System.Delegate | to |  | 
    
  
  
  
  
  Hook(Delegate, Delegate, HookConfig)
  
  
  Declaration
  
    public Hook(Delegate from, Delegate to, HookConfig config)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | System.Delegate | from |  | 
      
        | System.Delegate | to |  | 
      
        | HookConfig | config |  | 
    
  
  
  
  
  Hook(Delegate, Delegate, ref HookConfig)
  
  
  Declaration
  
    public Hook(Delegate from, Delegate to, ref HookConfig config)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | System.Delegate | from |  | 
      
        | System.Delegate | to |  | 
      
        | HookConfig | config |  | 
    
  
  
  
  
  Hook(Delegate, IntPtr)
  
  
  Declaration
  
    public Hook(Delegate from, IntPtr to)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | System.Delegate | from |  | 
      
        | System.IntPtr | to |  | 
    
  
  
  
  
  Hook(Delegate, IntPtr, HookConfig)
  
  
  Declaration
  
    public Hook(Delegate from, IntPtr to, HookConfig config)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | System.Delegate | from |  | 
      
        | System.IntPtr | to |  | 
      
        | HookConfig | config |  | 
    
  
  
  
  
  Hook(Delegate, IntPtr, ref HookConfig)
  
  
  Declaration
  
    public Hook(Delegate from, IntPtr to, ref HookConfig config)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | System.Delegate | from |  | 
      
        | System.IntPtr | to |  | 
      
        | HookConfig | config |  | 
    
  
  
  
  
  Hook(Expression, Delegate)
  
  
  Declaration
  
    public Hook(Expression from, Delegate to)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | System.Linq.Expressions.Expression | from |  | 
      
        | System.Delegate | to |  | 
    
  
  
  
  
  Hook(Expression, Delegate, HookConfig)
  
  
  Declaration
  
    public Hook(Expression from, Delegate to, HookConfig config)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | System.Linq.Expressions.Expression | from |  | 
      
        | System.Delegate | to |  | 
      
        | HookConfig | config |  | 
    
  
  
  
  
  Hook(Expression, Delegate, ref HookConfig)
  
  
  Declaration
  
    public Hook(Expression from, Delegate to, ref HookConfig config)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | System.Linq.Expressions.Expression | from |  | 
      
        | System.Delegate | to |  | 
      
        | HookConfig | config |  | 
    
  
  
  
  
  Hook(Expression, IntPtr)
  
  
  Declaration
  
    public Hook(Expression from, IntPtr to)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | System.Linq.Expressions.Expression | from |  | 
      
        | System.IntPtr | to |  | 
    
  
  
  
  
  Hook(Expression, IntPtr, HookConfig)
  
  
  Declaration
  
    public Hook(Expression from, IntPtr to, HookConfig config)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | System.Linq.Expressions.Expression | from |  | 
      
        | System.IntPtr | to |  | 
      
        | HookConfig | config |  | 
    
  
  
  
  
  Hook(Expression, IntPtr, ref HookConfig)
  
  
  Declaration
  
    public Hook(Expression from, IntPtr to, ref HookConfig config)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | System.Linq.Expressions.Expression | from |  | 
      
        | System.IntPtr | to |  | 
      
        | HookConfig | config |  | 
    
  
  
  
  
  Hook(Expression<Action>, Delegate)
  
  
  Declaration
  
    public Hook(Expression<Action> from, Delegate to)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | System.Linq.Expressions.Expression<System.Action> | from |  | 
      
        | System.Delegate | to |  | 
    
  
  
  
  
  Hook(Expression<Action>, Delegate, HookConfig)
  
  
  Declaration
  
    public Hook(Expression<Action> from, Delegate to, HookConfig config)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | System.Linq.Expressions.Expression<System.Action> | from |  | 
      
        | System.Delegate | to |  | 
      
        | HookConfig | config |  | 
    
  
  
  
  
  Hook(Expression<Action>, Delegate, ref HookConfig)
  
  
  Declaration
  
    public Hook(Expression<Action> from, Delegate to, ref HookConfig config)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | System.Linq.Expressions.Expression<System.Action> | from |  | 
      
        | System.Delegate | to |  | 
      
        | HookConfig | config |  | 
    
  
  
  
  
  Hook(Expression<Action>, IntPtr)
  
  
  Declaration
  
    public Hook(Expression<Action> from, IntPtr to)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | System.Linq.Expressions.Expression<System.Action> | from |  | 
      
        | System.IntPtr | to |  | 
    
  
  
  
  
  Hook(Expression<Action>, IntPtr, HookConfig)
  
  
  Declaration
  
    public Hook(Expression<Action> from, IntPtr to, HookConfig config)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | System.Linq.Expressions.Expression<System.Action> | from |  | 
      
        | System.IntPtr | to |  | 
      
        | HookConfig | config |  | 
    
  
  
  
  
  Hook(Expression<Action>, IntPtr, ref HookConfig)
  
  
  Declaration
  
    public Hook(Expression<Action> from, IntPtr to, ref HookConfig config)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | System.Linq.Expressions.Expression<System.Action> | from |  | 
      
        | System.IntPtr | to |  | 
      
        | HookConfig | config |  | 
    
  
  
  
  
  Hook(MethodBase, Delegate)
  
  
  Declaration
  
    public Hook(MethodBase method, Delegate to)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | System.Reflection.MethodBase | method |  | 
      
        | System.Delegate | to |  | 
    
  
  
  
  
  Hook(MethodBase, Delegate, HookConfig)
  
  
  Declaration
  
    public Hook(MethodBase method, Delegate to, HookConfig config)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | System.Reflection.MethodBase | method |  | 
      
        | System.Delegate | to |  | 
      
        | HookConfig | config |  | 
    
  
  
  
  
  Hook(MethodBase, Delegate, ref HookConfig)
  
  
  Declaration
  
    public Hook(MethodBase method, Delegate to, ref HookConfig config)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | System.Reflection.MethodBase | method |  | 
      
        | System.Delegate | to |  | 
      
        | HookConfig | config |  | 
    
  
  
  
  
  Hook(MethodBase, IntPtr)
  
  
  Declaration
  
    public Hook(MethodBase method, IntPtr to)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | System.Reflection.MethodBase | method |  | 
      
        | System.IntPtr | to |  | 
    
  
  
  
  
  Hook(MethodBase, IntPtr, HookConfig)
  
  
  Declaration
  
    public Hook(MethodBase method, IntPtr to, HookConfig config)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | System.Reflection.MethodBase | method |  | 
      
        | System.IntPtr | to |  | 
      
        | HookConfig | config |  | 
    
  
  
  
  
  Hook(MethodBase, IntPtr, ref HookConfig)
  
  
  Declaration
  
    public Hook(MethodBase method, IntPtr to, ref HookConfig config)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | System.Reflection.MethodBase | method |  | 
      
        | System.IntPtr | to |  | 
      
        | HookConfig | config |  | 
    
  
  
  
  
  Hook(MethodBase, MethodInfo)
  
  
  Declaration
  
    public Hook(MethodBase from, MethodInfo to)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | System.Reflection.MethodBase | from |  | 
      
        | System.Reflection.MethodInfo | to |  | 
    
  
  
  
  
  Hook(MethodBase, MethodInfo, HookConfig)
  
  
  Declaration
  
    public Hook(MethodBase from, MethodInfo to, HookConfig config)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | System.Reflection.MethodBase | from |  | 
      
        | System.Reflection.MethodInfo | to |  | 
      
        | HookConfig | config |  | 
    
  
  
  
  
  Hook(MethodBase, MethodInfo, ref HookConfig)
  
  
  Declaration
  
    public Hook(MethodBase from, MethodInfo to, ref HookConfig config)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | System.Reflection.MethodBase | from |  | 
      
        | System.Reflection.MethodInfo | to |  | 
      
        | HookConfig | config |  | 
    
  
  
  
  
  Hook(MethodBase, MethodInfo, Object)
  
  
  Declaration
  
    public Hook(MethodBase from, MethodInfo to, object target)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | System.Reflection.MethodBase | from |  | 
      
        | System.Reflection.MethodInfo | to |  | 
      
        | System.Object | target |  | 
    
  
  
  
  
  Hook(MethodBase, MethodInfo, Object, HookConfig)
  
  
  Declaration
  
    public Hook(MethodBase from, MethodInfo to, object target, HookConfig config)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | System.Reflection.MethodBase | from |  | 
      
        | System.Reflection.MethodInfo | to |  | 
      
        | System.Object | target |  | 
      
        | HookConfig | config |  | 
    
  
  
  
  
  Hook(MethodBase, MethodInfo, Object, ref HookConfig)
  
  
  Declaration
  
    public Hook(MethodBase from, MethodInfo to, object target, ref HookConfig config)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | System.Reflection.MethodBase | from |  | 
      
        | System.Reflection.MethodInfo | to |  | 
      
        | System.Object | target |  | 
      
        | HookConfig | config |  | 
    
  
  Fields
  
  
  
  DelegateTarget
  
  
  Declaration
  
    public readonly object DelegateTarget
   
  Field Value
  
    
      
        | Type | Description | 
    
    
      
        | System.Object |  | 
    
  
  
  
  Method
  
  
  Declaration
  
    public readonly MethodBase Method
   
  Field Value
  
    
      
        | Type | Description | 
    
    
      
        | System.Reflection.MethodBase |  | 
    
  
  
  
  OnDetour
  
  
  Declaration
  
    public static Func<Hook, MethodBase, MethodBase, object, bool> OnDetour
   
  Field Value
  
    
      
        | Type | Description | 
    
    
      
        | System.Func<Hook, System.Reflection.MethodBase, System.Reflection.MethodBase, System.Object, System.Boolean> |  | 
    
  
  
  
  OnGenerateTrampoline
  
  
  Declaration
  
    public static Func<Hook, MethodBase, MethodBase> OnGenerateTrampoline
   
  Field Value
  
    
      
        | Type | Description | 
    
    
      
        | System.Func<Hook, System.Reflection.MethodBase, System.Reflection.MethodBase> |  | 
    
  
  
  
  OnUndo
  
  
  Declaration
  
    public static Func<Hook, bool> OnUndo
   
  Field Value
  
    
      
        | Type | Description | 
    
    
      
        | System.Func<Hook, System.Boolean> |  | 
    
  
  
  
  Target
  
  
  Declaration
  
    public readonly MethodBase Target
   
  Field Value
  
    
      
        | Type | Description | 
    
    
      
        | System.Reflection.MethodBase |  | 
    
  
  
  
  TargetReal
  
  
  Declaration
  
    public readonly MethodBase TargetReal
   
  Field Value
  
    
      
        | Type | Description | 
    
    
      
        | System.Reflection.MethodBase |  | 
    
  
  Properties
  
  
  
  
  Detour
  
  
  Declaration
  
    public Detour Detour { get; }
   
  Property Value
  
  
  
  
  IsApplied
  
  
  Declaration
  
    public bool IsApplied { get; }
   
  Property Value
  
    
      
        | Type | Description | 
    
    
      
        | System.Boolean |  | 
    
  
  
  
  
  IsValid
  
  
  Declaration
  
    public bool IsValid { get; }
   
  Property Value
  
    
      
        | Type | Description | 
    
    
      
        | System.Boolean |  | 
    
  
  Methods
  
  
  
  
  Apply()
  
  
  Declaration
  
  
  
  
  Dispose()
  
  
  Declaration
  
  
  
  
  Free()
  
  
  Declaration
  
  
  
  
  GenerateTrampoline(MethodBase)
  
  
  Declaration
  
    public MethodBase GenerateTrampoline(MethodBase signature = null)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | System.Reflection.MethodBase | signature |  | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | System.Reflection.MethodBase |  | 
    
  
  
  
  
  GenerateTrampoline<T>()
  Generate a new DynamicMethod with which you can invoke the previous state.
Declaration
  
    public T GenerateTrampoline<T>()
    where T : Delegate
   
  Returns
  
  Type Parameters
  
  
  
  
  Undo()
  
  
  Declaration
  
  Implements
  
  
      System.IDisposable