7.5 WFMEnumKey

HRESULT WFMEnumKey ( hKey, iSubKey, lpszName, lpcchName, lpftLastWrite )

Enumerates the subkeys of the specified open key. Retrieves information about one subkey each time it is called.

Parameters HKEY hKey

Handle to a currently open key, or the predefined handle value:
WFS_CFG_HKEY_XFS_ROOT
The keys enumerated by this function are subkeys of the key identified by this parameter.

DWORD iSubKey

The index of the subkey to retrieve. This parameter should be zero for the first call to this function, then incremented for each subsequent call, in order to enumerate all the subkeys of the specified open key.

Because subkeys are not ordered, any new subkey will have an arbitrary index. This means that the function may return subkeys in any order.

LPSTR lpszName

Pointer to a buffer that receives the name of the subkey, including the terminating null character.

LPDWORD lpcchName

Pointer to a variable that specifies the size, in characters, of the buffer specified by the lpszName parameter, including the terminating null character. When the function returns, this variable contains the the number of characters actually stored in the buffer, not including the terminating null character.

PFILETIME lpftLastWrite

Pointer to a variable that receives the time the enumerated subkey was last written to, in the form of a FILETIME structure (see Microsoft Win32 Programmer's Reference, Vol. 5):
typedef struct _FILETIME {
DWORD dwLowDateTime;
DWORD dwHighDateTime;
} FILETIME;

Comments While a program is using this function iteratively, it should not call any other configuration functions that would change the key being enumerated.

Error Codes If the function return is not WFS_SUCCESS, it is one of the following error conditions.

WFS_ERR_CFG_INVALID_HKEY
The specified hKey parameter does not correspond to a currently open key.
WFS_ERR_CFG_NO_MORE_ITEMS
There are no more subkeys to be returned (the iSubKey parameter is greater than the index of the last subkey).
WFS_ERR_CFG_NAME_TOO_LONG
The length of the name to be returned exceeds the length of the buffer.
WFS_ERR_INVALID_POINTER
A pointer parameter does not point to accessible memory.