BOOL SetServiceStatus(hServiceStatus, lpServiceStatus) | |||
SERVICE_STATUS_HANDLE hServiceStatus; | |||
LPSERVICE_STATUS lpServiceStatus; |
The SetServiceStatus function updates the Service Control Manager of changes in the service status.
hServiceStatus
Handle to the Service Control Manager's status information structure maintained for the current service.
lpServiceStatus
A pointer to the SERVICE_STATUS information structure which reflects the latest status of the calling service.
Returns TRUE if the service status is successfully updated in the Service Control Manager. If the return value is FALSE, an error has occurred. Use GetLastError to determine the cause of the failure.
Errors | Value | Meaning |
ERROR_INVALID_HANDLE | The specified handle is invalid. | |
ERROR_INVALID_DATA | The specified service status structure is invalid. |
A service calls this function to inform the Service Control Manager of changes in its status. When the change is a result of a service control request, the changed status should be returned by calling this function within the context of the control handling function. A service may also update the Service Control Manager of changes in its status at any other time during the running of the service, and in any thread context. Examples of such unsolicited status updates include pending checkpoint updates, and unexpected occurrence of a fatal error that cause the service to stop.
This function can only be called by a service after it has called RegisterServiceCtrlHandler to get a service status handle.