Ejemplo n.º 1
0
        public static NetHook CreateManaged(IntPtr oldMethodAddress, IntPtr newMethodAddress)
        {
            NetHook hook = NetHook.CreateManaged();

            try
            {
                return(hook);
            }
            finally
            {
                hook.Install(oldMethodAddress, newMethodAddress);
            }
        }
Ejemplo n.º 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);
     }
 }