private static void StopService(IntPtr hService) { ServiceInstaller.ControlService(hService, ServiceControl.Stop, new ServiceInstaller.SERVICE_STATUS()); ServiceInstaller.WaitForServiceStatus(hService, ServiceState.Stopping, ServiceState.Stop); }
private static void StartService(IntPtr hService) { ServiceInstaller.SERVICE_STATUS sERVICESTATU = new ServiceInstaller.SERVICE_STATUS(); ServiceInstaller.StartService(hService, 0, 0); ServiceInstaller.WaitForServiceStatus(hService, ServiceState.Starting, ServiceState.Run); }