ServiceHandle INativeInterop.CreateServiceW(ServiceControlManager serviceControlManager, string serviceName, string displayName, ServiceControlAccessRights desiredControlAccess, ServiceType serviceType, ServiceStartType startType, ErrorSeverity errorSeverity, string binaryPath, string loadOrderGroup, IntPtr outUIntTagId, string dependencies, string serviceUserName, string servicePassword) { return(CreateServiceW(serviceControlManager, serviceName, displayName, desiredControlAccess, serviceType, startType, errorSeverity, binaryPath, loadOrderGroup, outUIntTagId, dependencies, serviceUserName, servicePassword)); }
public ServiceHandle OpenService(string serviceName, ServiceControlAccessRights desiredControlAccess) { if (!TryOpenService(serviceName, desiredControlAccess, out var service, out var errorException)) { throw errorException; } return(service); }
public ServiceHandle OpenService(string serviceName, ServiceControlAccessRights desiredControlAccess) { var service = NativeInterop.OpenServiceW(this, serviceName, desiredControlAccess); service.NativeInterop = NativeInterop; if (service.IsInvalid) { throw new Win32Exception(Marshal.GetLastWin32Error()); } return(service); }
public ServiceHandle OpenService(string serviceName, ServiceControlAccessRights desiredControlAccess) { ServiceHandle service; System.ComponentModel.Win32Exception errorException; if (!TryOpenService(serviceName, desiredControlAccess, out service, out errorException)) { throw errorException; } return(service); }
private static extern ServiceHandle CreateServiceW( ServiceControlManager serviceControlManager, string serviceName, string displayName, ServiceControlAccessRights desiredControlAccess, ServiceType serviceType, ServiceStartType startType, ErrorSeverity errorSeverity, string binaryPath, string loadOrderGroup, IntPtr outUIntTagId, string dependencies, string serviceUserName, string servicePassword);
public virtual bool TryOpenService(string serviceName, ServiceControlAccessRights desiredControlAccess, out ServiceHandle serviceHandle, out Win32Exception errorException) { ServiceHandle service = Win32.OpenServiceW(this, serviceName, desiredControlAccess); if (service.IsInvalid) { errorException = new Win32Exception(Marshal.GetLastWin32Error()); serviceHandle = null; return(false); } serviceHandle = service; errorException = null; return(true); }
public virtual bool TryOpenService(string serviceName , ServiceControlAccessRights desiredControlAccess , out ServiceHandle serviceHandle , out System.ComponentModel.Win32Exception errorException) { ServiceHandle service = NativeInterop.OpenServiceW(this, serviceName, desiredControlAccess); service.NativeInterop = NativeInterop; if (service.IsInvalid) { errorException = new System.ComponentModel.Win32Exception(System.Runtime.InteropServices.Marshal.GetLastWin32Error()); serviceHandle = null; return(false); } serviceHandle = service; errorException = null; return(true); }
private static extern ServiceHandle OpenServiceW(ServiceControlManager serviceControlManager, string serviceName, ServiceControlAccessRights desiredControlAccess);
ServiceHandle INativeInterop.OpenServiceW(ServiceControlManager serviceControlManager, string serviceName, ServiceControlAccessRights desiredControlAccess) { return(OpenServiceW(serviceControlManager, serviceName, desiredControlAccess)); }
public static extern IntPtr OpenSCManager( string machineName, string databaseName, ServiceControlAccessRights desiredAccess);
public static extern SafeServiceHandle OpenSCManager( string lpMachineName, string lpDatabaseName, ServiceControlAccessRights dwAccess);
public static extern WinServiceHandle OpenSCManager(string machineName, string db, ServiceControlAccessRights desiredAccess);
ServiceHandle Win32ServiceInterface.OpenServiceW(ServiceControlManager serviceControlManager, string serviceName, ServiceControlAccessRights desiredControlAccess) { return(OpenServiceW(serviceControlManager, serviceName, desiredControlAccess)); }