3.1.4.37 RQueryServiceConfig2W (Opnum 39)

The RQueryServiceConfig2W <64> method returns the optional configuration parameters of the specified service based on the specified information level.

 DWORD RQueryServiceConfig2W(
   [in] SC_RPC_HANDLE hService,
   [in] DWORD dwInfoLevel,
   [out, size_is(cbBufSize)] LPBYTE lpBuffer,
   [in, range(0, 1024*8)] DWORD cbBufSize,
   [out] LPBOUNDED_DWORD_8K pcbBytesNeeded
 );

hService: An SC_RPC_HANDLE (section 2.2.4) data type that defines the handle to the service record that MUST have been created previously, using one of the open methods specified in section 3.1.4. The SERVICE_QUERY_CONFIG access right MUST have been granted to the caller when the RPC context handle to the service record was created.

Value

Meaning

SERVICE_CONFIG_DESCRIPTION

0x00000001

The lpBuffer parameter is a pointer to a SERVICE_DESCRIPTION_WOW64 (section 2.2.36) structure.

SERVICE_CONFIG_FAILURE_ACTIONS

0x00000002

The lpBuffer parameter is a pointer to a SERVICE_FAILURE_ACTIONS_WOW64 (section 2.2.37) structure.

SERVICE_CONFIG_DELAYED_AUTO_START_INFO

0x00000003<65>

The lpBuffer parameter is a pointer to a SERVICE_DELAYED_AUTO_START_INFO structure.

SERVICE_CONFIG_FAILURE_ACTIONS_FLAG

0x00000004<66>

The lpBuffer parameter is a pointer to a SERVICE_FAILURE_ACTIONS_FLAG structure.

SERVICE_CONFIG_SERVICE_SID_INFO

0x00000005<67>

The lpBuffer parameter is a pointer to a SERVICE_SID_INFO structure.

SERVICE_CONFIG_REQUIRED_PRIVILEGES_INFO

0x00000006<68>

The lpBuffer parameter is a pointer to a SERVICE_REQUIRED_PRIVILEGES_INFO_WOW64 (section 2.2.38) structure.

SERVICE_CONFIG_PRESHUTDOWN_INFO

0x00000007<69>

The lpBuffer parameter is a pointer to a SERVICE_PRESHUTDOWN_INFO structure.

SERVICE_CONFIG_PREFERRED_NODE

0x00000009<70>

The lpBuffer parameter is a pointer to a SERVICE_PREFERRED_NODE_INFO structure.<71>

dwInfoLevel: A value that specifies the configuration information to query. This MUST be one of the following values.

lpBuffer: A pointer to the buffer that contains the service configuration information. The format of this data depends on the value of the dwInfoLevel parameter.

When dwInfoLevel is SERVICE_CONFIG_DESCRIPTION, or SERVICE_CONFIG_FAILURE_ACTIONS or SERVICE_CONFIG_REQUIRED_PRIVILEGES_INFO, the server returns an lpBuffer parameter that has the requested data and the offset to the start of the data from the top of the buffer. The API converts the offset into pointers that it returns to the caller by means of the lpBuffer parameter.

cbBufSize: The size, in bytes, of the lpBuffer parameter.

pcbBytesNeeded: An LPBOUNDED_DWORD_8K (section 2.2.8) data type that defines the pointer to a variable that receives the number of bytes needed to return the configuration information.

Return Values: The method returns 0x00000000 (ERROR_SUCCESS) on success; otherwise, it returns one of the following error codes.

Return value/code

Description

0x00000005

ERROR_ACCESS_DENIED

The SERVICE_QUERY_CONFIG access right had not been granted to the caller when the RPC context handle to the service record was created.

0x00000006

ERROR_INVALID_HANDLE

The handle is no longer valid.

0x00000087

ERROR_INVALID_PARAMETER

A parameter that was specified is invalid.

0x00000122

ERROR_INSUFFICIENT_BUFFER

The data area passed to a system call is too small.

0x00000124

ERROR_INVALID_LEVEL

The dwInfoLevel parameter contains an unsupported value.

0x00001115

ERROR_SHUTDOWN_IN_PROGRESS

The system is shutting down.

In response to this request from the client, for a successful operation the server MUST query the specific configuration information stored in the SCM database associated with the service record identified by the hService parameter, using the information level and the corresponding values associated with that information level as specified in the dwInfoLevel parameter of the client request. The server MUST return this configuration data by setting the lpBuffer parameter with the appropriate structure filled with the configuration data based on dwInfoLevel.

The server MUST set the required buffer size in the pcbBytesNeeded parameter.

If the buffer pointed to by lpBuffer is insufficient to hold all the configuration data, the server MUST fail the call with ERROR_INSUFFICIENT_BUFFER (122).

The server MUST return ERROR_INVALID_PARAMETER (87) if either or both lpBuffer and pcbBytesNeeded are NULL.<72>