3.1.4.2.37 ApiEnumValue (Opnum 36)

(Protocol Version 3) In response to an ApiEnumValue request from the client, the server MUST return the value and data at the index that is specified by dwIndex for the cluster registry key that is specified by hKey in the client request.

The server SHOULD accept an ApiEnumValue request if its protocol server state is read-only, and the server 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 ApiEnumValue request if the client's access level is at least "Read" (section 3.1.4).

 error_status_t ApiEnumValue(
   [in] HKEY_RPC hKey,
   [in] DWORD dwIndex,
   [out, string] LPWSTR *lpValueName,
   [out] LPDWORD lpType,
   [out, size_is(*lpcbData)] UCHAR *lpData,
   [in, out] LPDWORD lpcbData,
   [out] LPDWORD TotalSize,
   [out] error_status_t *rpc_status
 );

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

dwIndex: The index of the value, as specified in [MS-RRP], whose name, type, and data are to be retrieved.

lpValueName: On success, the server MUST set this parameter to a null-terminated Unicode string that contains the name of the value at dwIndex. On failure, this parameter MUST be ignored. The lpValueName parameter MUST NOT equal NULL.

lpType: On success, the server MUST set lpType to one of the value types for the dwType parameter, as specified in section 3.1.4.2.33. On failure, this parameter MUST be ignored. The lpType parameter MUST NOT equal NULL.

lpData: On success, the server MUST write the lpValueName data to the lpData buffer. On failure, this parameter MUST be ignored. The lpData parameter MUST NOT be NULL.

lpcbData: On input, the variable that is pointed to by lpcbData MUST be set to the size, in bytes, of the lpData buffer. On successful completion of the method, the server MUST set the variable that is pointed to by lpcbData to the number of bytes written into the lpData buffer. The lpcbData parameter MUST NOT be NULL.

TotalSize: On success, the server MUST set the variable that is pointed to by TotalSize to the number of bytes written into the lpData buffer. If the input value of the variable that is pointed to by lpcbData indicates that the lpData buffer is too small for the data, the server MUST return 234 (ERROR_MORE_DATA) and set the variable that is pointed to by TotalSize to the required size of the lpData buffer. If the method fails with any other error code, TotalSize MUST be ignored. TotalSize MUST NOT be NULL.

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 lpcbData parameter indicates that the lpData buffer is too small to hold the lpValueName data.

0x00000103

ERROR_NO_MORE_ITEMS

Either the key specified by hKey has zero subkeys, or dwIndex is greater than or equal to the nonzero number of subkeys under the key specified by hKey.

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.