C# 클래스 ServiceTools.ServiceInstaller

Installs and provides functionality for handling windows services
파일 보기 프로젝트 열기: wirepair/GHAST_priv8

공개 메소드들

메소드 설명
GetServiceStatus ( string ServiceName ) : ServiceState

Takes a service name and returns the ServiceState of the corresponding service

Install ( string ServiceName, string DisplayName, string FileName ) : void

Takes a service name, a service display name and the path to the service executable and installs the windows service.

InstallAndStart ( string ServiceName, string DisplayName, string FileName ) : void

Takes a service name, a service display name and the path to the service executable and installs / starts the windows service.

ServiceInstaller ( ) : System

ServiceIsInstalled ( string ServiceName ) : bool

Accepts a service name and returns true if the service with that service name exists

StartService ( string Name ) : void

Takes a service name and starts it

StopService ( string Name ) : void

Stops the provided windows service

Uninstall ( string ServiceName ) : void

Takes a service name and tries to stop and then uninstall the windows serviceError

비공개 메소드들

메소드 설명
CloseServiceHandle ( IntPtr hSCObject ) : int
ControlService ( IntPtr hService, ServiceControl dwControl, SERVICE_STATUS lpServiceStatus ) : int
CreateService ( IntPtr hSCManager, string lpServiceName, string lpDisplayName, ServiceRights dwDesiredAccess, int dwServiceType, ServiceBootFlag dwStartType, ServiceError dwErrorControl, string lpBinaryPathName, string lpLoadOrderGroup, IntPtr lpdwTagId, string lpDependencies, string lp, string lpPassword ) : IntPtr
DeleteService ( IntPtr hService ) : int
GetServiceStatus ( IntPtr hService ) : ServiceState

Gets the service state by using the handle of the provided windows service

OpenSCManager ( ServiceManagerRights Rights ) : IntPtr

Opens the service manager

OpenSCManager ( string lpMachineName, string lpDatabaseName, ServiceManagerRights dwDesiredAccess ) : IntPtr
OpenService ( IntPtr hSCManager, string lpServiceName, ServiceRights dwDesiredAccess ) : IntPtr
QueryServiceStatus ( IntPtr hService, SERVICE_STATUS lpServiceStatus ) : int
StartService ( IntPtr hService, int dwNumServiceArgs, int lpServiceArgVectors ) : int
StartService ( IntPtr hService ) : void

Stars the provided windows service

StopService ( IntPtr hService ) : void

Stops the provided windows service

WaitForServiceStatus ( IntPtr hService, ServiceState WaitStatus, ServiceState DesiredStatus ) : bool

Returns true when the service status has been changes from wait status to desired status ,this method waits around 10 seconds for this operation.

메소드 상세

GetServiceStatus() 공개 정적인 메소드

Takes a service name and returns the ServiceState of the corresponding service
public static GetServiceStatus ( string ServiceName ) : ServiceState
ServiceName string The service name that we will check for his ServiceState
리턴 ServiceState

Install() 공개 정적인 메소드

Takes a service name, a service display name and the path to the service executable and installs the windows service.
public static Install ( string ServiceName, string DisplayName, string FileName ) : void
ServiceName string The service name that this service will have
DisplayName string The display name that this service will have
FileName string The path to the executable of the service
리턴 void

InstallAndStart() 공개 정적인 메소드

Takes a service name, a service display name and the path to the service executable and installs / starts the windows service.
public static InstallAndStart ( string ServiceName, string DisplayName, string FileName ) : void
ServiceName string The service name that this service will have
DisplayName string The display name that this service will have
FileName string The path to the executable of the service
리턴 void

ServiceInstaller() 공개 메소드

public ServiceInstaller ( ) : System
리턴 System

ServiceIsInstalled() 공개 정적인 메소드

Accepts a service name and returns true if the service with that service name exists
public static ServiceIsInstalled ( string ServiceName ) : bool
ServiceName string The service name that we will check for existence
리턴 bool

StartService() 공개 정적인 메소드

Takes a service name and starts it
public static StartService ( string Name ) : void
Name string The service name
리턴 void

StopService() 공개 정적인 메소드

Stops the provided windows service
public static StopService ( string Name ) : void
Name string The service name that will be stopped
리턴 void

Uninstall() 공개 정적인 메소드

Takes a service name and tries to stop and then uninstall the windows serviceError
public static Uninstall ( string ServiceName ) : void
ServiceName string The windows service name to uninstall
리턴 void