BOOL QueryServiceConfig(hService, lpServiceConfig, cbBufSize, pcbBytesNeeded) | |||
SC_HANDLE hService; | |||
LPQUERY_SERVICE_CONFIG lpServiceConfig; | |||
DWORD cbBufSize; | |||
LPDWORD pcbBytesNeeded; |
The QueryServiceConfig function examines the service configuration parameters.
hService
Handle obtained from a previous CreateService or OpenService call.
lpServiceConfig
A pointer to a buffer to receive a QUERY_SERVICE_CONFIG information structure.
cbBufSize
Size of the buffer in bytes pointed to by lpServiceConfig.
pcbBytesNeeded
A pointer to a variable to receive the number of bytes needed to read the all the configuration information.
Returns TRUE if the service configuration 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_CONFIG access. | |
ERROR_INVALID_HANDLE | The specified handle is invalid. | |
ERROR_INSUFFICIENT_BUFFER | There is more service configuration information than would fit into the supplied output buffer. pcbBytesNeeded contains the number of bytes required to get all the information. Nothing is written to the supplied output buffer. |
This function returns the service configuration information kept in the Service Control Manager database. This configuration information was first set in the database via the CreateService API, and may have been updated via the ChangeServiceConfig API.