public EntryPoint(RemoteHooking.IContext InContext, string InChannelName) { _interface = RemoteHooking.IpcConnectClient<OverlayInterface>(InChannelName); _interface.Ping(); IDictionary properties = new Hashtable(); properties["name"] = InChannelName; properties["portName"] = InChannelName + Guid.NewGuid().ToString("N"); BinaryServerFormatterSinkProvider provider = new BinaryServerFormatterSinkProvider(); provider.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full; _serverChannel = new IpcServerChannel(properties, provider); ChannelServices.RegisterChannel(_serverChannel, false); }
public void Run(RemoteHooking.IContext InContext, string InChannelName) { AppDomain domain = AppDomain.CurrentDomain; domain.AssemblyResolve += (sender, args) => { return this.GetType().Assembly.FullName == args.Name ? this.GetType().Assembly : null; }; Log.Write("Injected into process"); _runWait = new ManualResetEvent(false); _runWait.Reset(); try { if (!InstallHooks()) return; _interface.Disconnected += _proxy.DisconnectedProxyHandler; _proxy.Disconnected += () => { _runWait.Set(); }; CheckConnection(); _runWait.WaitOne(); StopCheckingConnection(); UninstallHooks(); } catch { } finally { ChannelServices.UnregisterChannel(_serverChannel); Thread.Sleep(1000); } _hook = null; _proxy = null; _interface = null; _serverChannel = null; _runWait = null; _checkConnectionTask = null; Log.Write("Unloading DLL"); }