Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Accepted ¶
type Accepted uint32
Accepted is used to describe commands accepted by the service.
Interrogate is always accepted.
type Change ¶
type Change struct { Command Command EventType uint32 EventData uintptr Status Status Context uintptr }
Change is sent to the service Handler to request service status changes and updates to the service control manager.
type Command ¶
type Command uint32
Command represents a service state change request. It is sent to a service by the service manager, and should be acted upon by the service.
type Handler ¶
Handler is a function interface that must be implemented to run as a Windows service.
This function will be called by the package code at the start of the service, and the service will exit once Execute completes.
Inside the function, you may use the context or read service change requests using the 's.Requests()' channel and act accordingly.
You must keep service control manager up to date about state of your service by using the 'Update' or 'UpdateState' functions.
The supplied string list contains the service name followed by argument strings passed to the service.
You can provide service exit code in the return parameter, with 0 being "no error".
type Service ¶
type Service interface { Update(Status) Handle() uintptr Requests() <-chan Change UpdateState(State, ...Accepted) DynamicStartReason() (Reason, error) }
Service is an interface that is passed to the Handler function and can be used to receive and send updates to the service control manager.
NOTE(dij): The function 'DynamicStartReason' is only avaliable on Windows >7 and will return an error if it does not exist.