3.1.4.11 EnumKeys (Opnum 6)
The EnumKeys method enumerates the subnodes of the specified node.
-
HRESULT EnumKeys( [in] METADATA_HANDLE hMDHandle, [unique, in, string] LPCWSTR pszMDPath, [out, size_is(ADMINDATA_MAX_NAME_LEN)] LPWSTR pszMDName, [in] DWORD dwMDEnumObjectIndex );
hMDHandle: An unsigned 32-bit integer value containing an open metabase handle specifying the key to be enumerated.
pszMDPath: A pointer to a Unicode string that contains the path of the node whose subnodes are to be enumerated, relative to the path of the hMDHandle parameter.
pszMDName: A pointer to a string buffer that receives the names of the enumerated metabase subnodes.
dwMDEnumObjectIndex: An integer value specifying the index of the subnode to be retrieved.
Return Values: A signed 32-bit value that indicates return status. If the method returns a negative value, it failed. If the 12-bit facility code (bits 16–27) is set to 0x007, the value contains a Win32 error code in the lower 16 bits. Zero or positive values indicate success, with the lower 16 bits in positive nonzero values containing warnings or flags defined in the method implementation. For more information about Win32 error codes and HRESULT values, see [MS-ERREF].
-
Return value/code
Description
0x00000000
S_OK
The call was successful.
0x80070003
ERROR_PATH_NOT_FOUND
The system cannot find the path specified.
0x80070005
E_ACCESSDENIED
General access denied error.
0x80070006
ERROR_INVALID_HANDLE
The handle is invalid.
0x80070057
E_INVALIDARG
One or more arguments are invalid.
0x80070103
ERROR_NO_MORE_ITEMS
No more data is available.
The opnum field value for this method is 6.
A subnode can be enumerated once per call. Subnodes are numbered from zero to (NumKeys - 1), with NumKeys equal to the number of subnodes below the node.
When processing this call, the server MUST do the following:
Check the handle. This handle is valid if it is either the master root handle or a handle returned from a previous OpenKey call. If the handle is invalid, return ERROR_INVALID_HANDLE.
The server SHOULD check whether the handle was opened for read access. If not, return an error.<12>
Check whether the relative path points to the existing subnode of the parent handle. If not, return ERROR_PATH_NOT_FOUND.
Find the child node of the destination node that has an index equal to the dwMDEnumKeyIndex parameter. If there is no child with that index, return ERROR_NO_MORE_ITEMS.
Copy the name of this child node to the pszMDName buffer.