QueryServiceConfig2

[This is preliminary documentation and subject to change.]

The QueryServiceConfig2 function retrieves the optional configuration parameters of the specified service.

BOOL QueryServiceConfig2(
  SC_HANDLE hService,
  DWORD dwInfoLevel,
  LPBYTE lpBuffer,
  DWORD cbBufSize,
  LPDWORD pcbBytesNeeded
);
 

Parameters

hService
Handle to the service. This handle is returned by the OpenService or CreateService function and must have the SERVICE_CHANGE_CONFIG access right.
dwInfoLevel
Specifies the configuration information to query. This parameter can have one of the following values.
Value Meaning
SERVICE_CONFIG_DESCRIPTION The lpBuffer parameter is a pointer to a SERVICE_DESCRIPTION structure.
SERVICE_CONFIG_FAILURE_ACTIONS The lpBuffer parameter is a pointer to a SERVICE_FAILURE_ACTIONS structure.

lpBuffer
Pointer to the structure in which the service configuration information is returned, plus the strings to which its members point. The format of this data depends on the value of the dwInfoLevel parameter.
cbBufSize
Specifies the size, in bytes, of the structure pointed to by the lpBuffer parameter.
pcbBytesNeeded
Pointer to a variable that receives the number of bytes needed to return the configuration information, if the function fails.

Return Values

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

The QueryServiceConfig2 function returns the optional configuration information stored in the service control manager database for the specified service. You can change this configuration information by using the ChangeServiceConfig2 function.

You can change and query additional configuration information using the ChangeServiceConfig and QueryServiceConfig functions, respectively.

QuickInfo

  Windows NT: Requires version 5.0 or later.
  Windows: Unsupported.
  Windows CE: Unsupported.
  Header: Declared in winsvc.h.
  Import Library: Use advapi32.lib.
  Unicode: Implemented as Unicode and ANSI versions on Windows NT.

See Also

Services Overview, Service Functions, ChangeServiceConfig, ChangeServiceConfig2, CreateService, OpenService, QueryServiceConfig, SERVICE_DESCRIPTION, SERVICE_FAILURE_ACTIONS