3.1.4.2.32 ApiEnumKey (Opnum 31)

(Protocol Version 3) In response to an ApiEnumKey request from the client, for a successful operation, the server MUST return the subkey at the index that is specified by dwIndex for the cluster registry key that is specified by hkey.

The server SHOULD accept an ApiEnumKey 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 ApiEnumKey request if the client's access level is at least "Read" (section 3.1.4).

 error_status_t ApiEnumKey(
   [in] HKEY_RPC hKey,
   [in] DWORD dwIndex,
   [out, string] LPWSTR *KeyName,
   [out] FILETIME *lpftLastWriteTime,
   [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.

dwIndex: The index of the key, as specified in [MS-RRP], whose name is to be retrieved.

KeyName: On successful completion of the method, the server MUST copy the name of the retrieved subkey (as specified in [MS-RRP]), including the terminating NULL character, to the buffer that is pointed to by the KeyName parameter. If the method fails, this parameter MUST be ignored.

lpftLastWriteTime: On successful completion of the method, the server MUST set lpftLastWriteTime to the time the enumerated subkey was last modified. If the method fails, this parameter MUST be ignored. The lpftLastWriteTime parameter is a FILETIME data structure as specified in [MS-DTYP] section 2.3.3.

rpc_status: A 32-bit integer used to indicate success or failure. The RPC runtime MUST indicate, by writing to this parameter, whether the runtime succeeded in executing this method on the server. A value of 0x00000000 indicates that the method call was successfully transported to the server, executed with no faults, and returned control to the client without encountering any communication faults. This value is separate from the value returned by the method and does not represent the success of the method. The client MUST treat all nonzero values the same, except as specified in section 3.2.4.6.

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.

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 3.2.4.6 as recoverable errors, and initiate the reconnect procedure as specified in section 3.2.4.6.