Example #1
0
            /// <summary>
            /// Creates a new service handle.
            /// </summary>
            /// <param name="ServiceName">The name of the service to open.</param>
            /// <param name="access">The desired access to the service.</param>
            public ServiceHandle(string ServiceName, SERVICE_RIGHTS access)
            {
                using (ServiceManagerHandle manager =
                           new ServiceManagerHandle(SC_MANAGER_RIGHTS.SC_MANAGER_CONNECT))
                {
                    this.Handle = OpenService(manager, ServiceName, access);

                    if (this.Handle == 0)
                    {
                        ThrowLastWin32Error();
                    }
                }
            }
Example #2
0
 public static extern int CreateService(int SCManager,
                                        string ServiceName,
                                        string DisplayName,
                                        SERVICE_RIGHTS DesiredAccess,
                                        SERVICE_TYPE ServiceType,
                                        SERVICE_START_TYPE StartType,
                                        SERVICE_ERROR_CONTROL ErrorControl,
                                        string BinaryPathName,
                                        string LoadOrderGroup,
                                        int TagID,
                                        int Dependencies,
                                        string ServiceStartName,
                                        string Password
                                        );
Example #3
0
 public static extern int OpenService(int SCManager,
     string ServiceName, SERVICE_RIGHTS DesiredAccess);
Example #4
0
 public static extern int CreateService(int SCManager,
     string ServiceName,
     string DisplayName,
     SERVICE_RIGHTS DesiredAccess, 
     SERVICE_TYPE ServiceType,
     SERVICE_START_TYPE StartType,
     SERVICE_ERROR_CONTROL ErrorControl,
     string BinaryPathName,
     string LoadOrderGroup,
     int TagID, 
     int Dependencies,
     string ServiceStartName,
     string Password
     );
Example #5
0
		private static extern IntPtr OpenService (
			IntPtr SCHANDLE,
			string lpSvcName,
			SERVICE_RIGHTS dwNumServiceArgs);
Example #6
0
 private static extern IntPtr OpenService(
     IntPtr SCHANDLE,
     string lpSvcName,
     SERVICE_RIGHTS dwNumServiceArgs);
Example #7
0
 public static extern int OpenService(int SCManager,
                                      string ServiceName, SERVICE_RIGHTS DesiredAccess);