public NativeService OpenService(string name, ServiceRights rights) { if (!(this.IsInvalid || this.IsClosed)) { NativeService service = OpenService(this, name, rights); if (service.IsClosed || service.IsInvalid) { Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error()); } return(service); } else { throw new ObjectDisposedException("NativeServiceManager"); } }
public NativeService CreateService(string name, string displayname, string cmdline, ServiceRights rights, ServiceStartType starttype = ServiceStartType.AutoStart) { if (!(this.IsInvalid || this.IsClosed)) { NativeService service = CreateService(this, name, displayname, rights, ServiceType.OwnProcess, starttype, ServiceErrorControl.Normal, cmdline, null, IntPtr.Zero, null, null, null); if (service.IsClosed || service.IsInvalid) { Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error()); } return(service); } else { throw new ObjectDisposedException("NativeServiceManager"); } }
protected static extern bool StartService( NativeService hService, uint dwNumServiceArgs, string[] lpServiceArgVectors );
protected static extern bool DeleteService( NativeService hService );
protected static extern bool ControlService( NativeService hService, ServiceControl dwControl, out ServiceStatus lpServiceStatus );
protected static extern bool StartService( NativeService hService, uint dwNumServiceArgs, string[] lpServiceArgVectors );
protected static extern bool ControlService( NativeService hService, ServiceControl dwControl, out ServiceStatus lpServiceStatus );
protected static extern bool DeleteService( NativeService hService );