The Service Control Manager provides functionality to three sets of clients:
1.Setup and configuration utilities. A setup program would call the following Service Control functions to install and upgrade a service in the Service Control Manager database:
Function | Description |
LockServiceDatabase | locks the specified database. |
UnlockServiceDatabase | unlocks the specified database. |
CreateService | creates a service in the database. |
DeleteService | deletes a service from the database. |
QueryServiceConfig | returns the service configuration information. |
ChangeServiceConfig | changes the service configuration information. |
QueryServiceObjectSecurity | returns the security descriptor of a service object. |
SetServiceObjectSecurity | sets the security descriptor of a service object. |
2.User interface programs. Such a program would call the following Service Control functions to control a service:
Function | Description |
StartService | starts a service running. |
ControlService | sends a control request, which includes pause, continue, interrogate, and stop, to a service. |
QueryServiceStatus | returns the current status of the service. |
EnumServicesStatus | enumerates the status of all installed services. |
3.Win32 service programs. A service communicates with the Service Control Manager via the following functions:
Function | Description |
StartServiceCtrlDispatcher | connects the current service thread to the Service Control Manager and causes it to be the control dispatch thread for all controls sent to the service(s) in this process. |
RegisterServiceCtrlHandler | registers a control handling routine which will be called whenever a control request is sent to the current service. |
SetServiceStatus | notifies the Service Control Manager of the latest service status. |
Since the setup utilities and service control UI programs require remote access to the Service Control Manager, the Service Control Manager functions are provided via RPC.
The Service Control Manager is an RPC server which runs as a trusted process in its own address space. Its clients are not allowed to manipulate its objects directly, but rather, through the Service Control Manager functions. The desired access of an function caller is granted or denied depending on the discretionary access control list of a requested object.