public static NetHook CreateManaged(IntPtr oldMethodAddress, IntPtr newMethodAddress) { NetHook hook = NetHook.CreateManaged(); try { return(hook); } finally { hook.Install(oldMethodAddress, newMethodAddress); } }
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); } }
public static NetHook CreateNative(IntPtr oldMethodAddress, Delegate newMethodDelegate) { return(NetHook.CreateNative(oldMethodAddress, Marshal.GetFunctionPointerForDelegate(newMethodDelegate))); }