public static RtlInstallService ( String InServiceName, String InExePath, String InChannelName ) : void | ||
InServiceName | String | |
InExePath | String | |
InChannelName | String | |
Результат | void |
private static void Install() { lock (ThreadSafe) { // Ensure we create a new one if the existing // channel cannot be pinged try { if (m_Interface != null) { m_Interface.Ping(); } } catch { m_Interface = null; } if (m_Interface == null) { // create sync objects String ChannelName = RemoteHooking.GenerateName(); EventWaitHandle Listening = new EventWaitHandle( false, EventResetMode.ManualReset, "Global\\Event_" + ChannelName); Mutex TermMutex = new Mutex(true, "Global\\Mutex_" + ChannelName); using (TermMutex) { // install and start service NativeAPI.RtlInstallService( "EasyHook" + (NativeAPI.Is64Bit?"64":"32") + "Svc", Path.GetFullPath(Config.GetDependantSvcExecutableName()), ChannelName); if (!Listening.WaitOne(5000, true)) { throw new ApplicationException("Unable to wait for service startup."); } HelperServiceInterface Interface = RemoteHooking.IpcConnectClient <HelperServiceInterface>(ChannelName); Interface.Ping(); // now we can be sure that all things are fine... m_Interface = Interface; m_TermMutex = TermMutex; } } } }