Documentation
¶
Index ¶
- Constants
- Variables
- func CreateService(serviceName, binPath string, autostart bool) error
- func DeleteService(serviceName string) error
- func IsAdmin() bool
- func IsServiceHidden(serviceName string) (bool, error)
- func QueryServiceStatus(serviceName string) (uint32, error)
- func ServiceExists(serviceName string) (bool, error)
- func SetServiceHidden(serviceName string) error
- func SetServiceUnHidden(serviceName string) error
- func StartService(serviceName string) error
- func StopService(serviceName string) error
- type SERVICE_STATUS
Constants ¶
View Source
const ( SERVICE_QUERY_STATUS uint32 = 0x0004 SERVICE_QUERY_CONFIG uint32 = 0x0001 SERVICE_CHANGE_CONFIG uint32 = 0x0002 SERVICE_START uint32 = 0x0010 SERVICE_STOP uint32 = 0x0020 SERVICE_ALL_ACCESS uint32 = 0xF01FF SERVICE_STOPPED uint32 = 0x00000001 SERVICE_START_PENDING uint32 = 0x00000002 SERVICE_STOP_PENDING uint32 = 0x00000003 SERVICE_RUNNING uint32 = 0x00000004 SERVICE_CONTINUE_PENDING uint32 = 0x00000005 SERVICE_PAUSE_PENDING uint32 = 0x00000006 SERVICE_PAUSED uint32 = 0x00000007 )
View Source
const (
DACL_SECURITY_INFORMATION = 0x00000004
)
DACL_SECURITY_INFORMATION Security descriptor information flags
Variables ¶
View Source
var ( ErrServiceManagerConnectFail = errors.New("service manager connect fail") ErrServiceOpenFail = errors.New("service open fail") ErrServiceCreateFail = errors.New("service create fail") ErrServiceStartFail = errors.New("service start fail") ErrServiceStopFail = errors.New("service stop fail") ErrServiceDeleteFail = errors.New("service delete fail") ErrServiceStatusGetFail = errors.New("service status get fail") ErrServiceStopTimeout = errors.New("service stop timeout") ErrServiceAlreadyExists = errors.New("service is already exist") ErrServiceRecoveryStrategyFail = errors.New("service recovery strategy set fail") ErrServiceSecuritySetFail = errors.New("service security set fail") )
Common errors for service operations
Functions ¶
func CreateService ¶
CreateService registers a new Windows service
func DeleteService ¶
func IsServiceHidden ¶
IsServiceHidden check service is hidden
func QueryServiceStatus ¶
QueryServiceStatus returns the current state of a service
func ServiceExists ¶
ServiceExists checks if a service with the given name exists
func SetServiceHidden ¶
SetServiceHidden makes a service hidden from regular users
func SetServiceUnHidden ¶
SetServiceUnHidden makes a service visible to regular users
func StartService ¶
StartService starts an existing Windows service
func StopService ¶
StopService stops a running Windows service with timeout
Types ¶
Click to show internal directories.
Click to hide internal directories.