BOOL QueryServiceStatus(hService, lpServiceStatus) | |||
SC_HANDLE hService; | |||
LPSERVICE_STATUS lpServiceStatus; |
The QueryServiceStatus function examines the service status.
hService
Handle obtained from a previous CreateService or OpenService call.
lpServiceStatus
A pointer to a buffer to receive a SERVICE_STATUS information structure.
Returns TRUE if the service status information is successfully written into the supplied output buffer. If the return value is FALSE, an error has occurred. Use GetLastError to determine the cause of the failure.
Errors | Value | Meaning |
ERROR_ACCESS_DENIED | The specified handle was not opened with SERVICE_QUERY_STATUS access. | |
ERROR_INVALID_HANDLE | The specified handle is invalid. |
This function returns the service status information maintained by Service Control Manager. This is the last status information the service reported to the Service Control Manager. The service may have just changed its status and may not have updated the Service Control Manager yet. Applications can find out the absolute latest service status by interrogating the service directly using the ControlService API with the SERVICE_CONTROL_INTERROGATE control code.