コード例 #1
0
 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));
 }
コード例 #2
0
 public ServiceHandle OpenService(string serviceName, ServiceControlAccessRights desiredControlAccess)
 {
     if (!TryOpenService(serviceName, desiredControlAccess, out var service, out var errorException))
     {
         throw errorException;
     }
     return(service);
 }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
 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);
コード例 #6
0
        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);
        }
コード例 #7
0
        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);
        }
コード例 #8
0
 private static extern ServiceHandle OpenServiceW(ServiceControlManager serviceControlManager, string serviceName,
                                                  ServiceControlAccessRights desiredControlAccess);
コード例 #9
0
 ServiceHandle INativeInterop.OpenServiceW(ServiceControlManager serviceControlManager, string serviceName, ServiceControlAccessRights desiredControlAccess)
 {
     return(OpenServiceW(serviceControlManager, serviceName, desiredControlAccess));
 }
コード例 #10
0
 public static extern IntPtr OpenSCManager(
     string machineName,
     string databaseName,
     ServiceControlAccessRights desiredAccess);
コード例 #11
0
 public static extern SafeServiceHandle OpenSCManager(
     string lpMachineName,
     string lpDatabaseName,
     ServiceControlAccessRights dwAccess);
コード例 #12
0
 public static extern IntPtr OpenSCManager(
     string machineName,
     string databaseName,
     ServiceControlAccessRights desiredAccess);
コード例 #13
0
ファイル: NativeMethods.cs プロジェクト: thexur/1code
 public static extern SafeServiceHandle OpenSCManager(
     string lpMachineName,
     string lpDatabaseName,
     ServiceControlAccessRights dwAccess);
コード例 #14
0
 public static extern WinServiceHandle OpenSCManager(string machineName, string db, ServiceControlAccessRights desiredAccess);
コード例 #15
0
 ServiceHandle Win32ServiceInterface.OpenServiceW(ServiceControlManager serviceControlManager, string serviceName, ServiceControlAccessRights desiredControlAccess)
 {
     return(OpenServiceW(serviceControlManager, serviceName, desiredControlAccess));
 }