3.1.4.2.35 ApiQueryValue (Opnum 34)

(Protocol Version 3) In response to an ApiQueryValue request from the client, for a successful operation the server MUST return the data that is associated with the value that is specified by lpValueName for the cluster registry key that is specified by hKey.

The server SHOULD accept an ApiQueryValue request if its protocol server state is read-only and MUST accept the request for processing if it is in the read/write state, as specified in section 3.1.1.

The server SHOULD accept an ApiQueryValue request if the client's access level is at least "Read" (section 3.1.4).

 error_status_t ApiQueryValue(
   [in] HKEY_RPC hKey,
   [in, string] LPCWSTR lpValueName,
   [out] DWORD *lpValueType,
   [out, size_is(cbData)] UCHAR *lpData,
   [in] DWORD cbData,
   [out] LPDWORD lpcbRequired,
   [out] error_status_t *rpc_status
 );

hKey: The RPC context handle for a key that was previously obtained by a call to ApiGetRootKey, ApiCreateKey, or ApiOpenKey.

lpValueName: The name of the value (as specified in [MS-RRP]) to query. If the name value was not specified and an empty string is presented to the server, the server MUST return the data in the default value of the specified key, as specified in [MS-RRP].

lpValueType: Upon successful completion of this method, the server MUST set lpValueType to one of the value types specified for the dwType parameter in section 3.1.4.2.33. Upon failure of this method, the client MUST ignore the value assigned to lpValueType.

lpData: A pointer to a buffer to receive the data of the value entry. If the size of lpData is too small to hold the lpValueName data (as indicated by cbData), the server MUST return 0x000000EA (ERROR_MORE_DATA) and set lpcbRequired to the size of the lpData buffer that is necessary to return the lpValueName data, and the client MUST ignore the value of lpData. If there is sufficient size, the server MUST copy the data of the value entry into lpData.

cbData: On input, the size, in bytes, of lpData.

lpcbRequired: If the method succeeds, the server MUST set lpcbRequired to the number of bytes that are written into the lpData buffer. If the server returns 0x000000EA (ERROR_MORE_DATA), the server MUST set lpcbRequired to the size of the lpData buffer that is necessary to return the lpValueName data. If the method fails with any other error code, this parameter MUST be ignored.

rpc_status: A 32-bit integer used to indicate success or failure. The RPC runtime MUST indicate, by writing to this parameter, whether it succeeded in executing this method on the server. The encoding of the value passed in this parameter MUST conform to encoding for  comm_status and fault_status, as specified in Appendix E of [C706].

Return Values: The method MUST return the following error codes for the specified conditions.

Return value/code

Description

0x00000000

ERROR_SUCCESS

Success.

0x00000006

ERROR_INVALID_HANDLE

The data that is pointed to by the hKey parameter does not represent a valid HKEY_RPC context handle.

0x000000EA

ERROR_MORE_DATA

The cbData parameter indicates that the lpData buffer is too small to hold the lpValueName data.

For any other condition, this method MUST return a value that is not one of the values listed in the preceding table. The client MUST behave in one consistent, identical manner for all values that are not listed in the preceding table. The client SHOULD treat errors specified in section 3.2.4.6 as recoverable errors and initiate the reconnect procedure as specified in section 3.2.4.6.