Partager via


3.1.4.36 RQueryServiceConfig2A (Opnum 38)

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

 DWORD RQueryServiceConfig2A(
   [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.

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

Value

Meaning

SERVICE_CONFIG_DESCRIPTION

0x00000001

The lpBuffer parameter is a pointer to a SERVICE_DESCRIPTIONA structure.

SERVICE_CONFIG_FAILURE_ACTIONS

0x00000002

The lpBuffer parameter is a pointer to a SERVICE_FAILURE_ACTIONSA structure.

SERVICE_CONFIG_DELAYED_AUTO_START_INFO

0x00000003<56>

The lpBuffer parameter is a pointer to a SERVICE_DELAYED_AUTO_START_INFO structure.

SERVICE_CONFIG_FAILURE_ACTIONS_FLAG

0x00000004<57>

The lpBuffer parameter is a pointer to a SERVICE_FAILURE_ACTIONS_FLAG structure.

SERVICE_CONFIG_SERVICE_SID_INFO

0x00000005<58>

The lpBuffer parameter is a pointer to a SERVICE_SID_INFO structure.

SERVICE_CONFIG_REQUIRED_PRIVILEGES_INFO

0x00000006<59>

The lpBuffer parameter is a pointer to a SERVICE_RPC_REQUIRED_PRIVILEGES_INFO structure.

SERVICE_CONFIG_PRESHUTDOWN_INFO

0x00000007<60>

The lpBuffer parameter is a pointer to a SERVICE_PRESHUTDOWN_INFO structure.

SERVICE_CONFIG_PREFERRED_NODE

0x00000009<61>

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

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.

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 contains 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

5

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.

6

ERROR_INVALID_HANDLE

The handle is no longer valid.

87

ERROR_INVALID_PARAMETER

A parameter that was specified is invalid.

122

ERROR_INSUFFICIENT_BUFFER

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

124

ERROR_INVALID_LEVEL

The dwInfoLevel parameter contains an unsupported value.

1115

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 use the process described in Conversion Between ANSI and Unicode String Formats (section 3.1.7) to convert a string to the appropriate format.

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