Beispiel #1
0
        public static NetHook CreateManaged(IntPtr oldMethodAddress, IntPtr newMethodAddress)
        {
            NetHook hook = NetHook.CreateManaged();

            try
            {
                return(hook);
            }
            finally
            {
                hook.Install(oldMethodAddress, newMethodAddress);
            }
        }
Beispiel #2
0
 private bool AddHook(IntPtr address)
 {
     lock (this)
     {
         if (address == IntPtr.Zero)
         {
             return(false);
         }
         if (_hook != null)
         {
             return(false);
         }
         _hook = NetHook.CreateManaged(_methodPtr, address);
         return(true);
     }
 }
Beispiel #3
0
 public static NetHook CreateNative(IntPtr oldMethodAddress, Delegate newMethodDelegate)
 {
     return(NetHook.CreateNative(oldMethodAddress, Marshal.GetFunctionPointerForDelegate(newMethodDelegate)));
 }