RegEnumKeyEx (Windows CE 5.0)
This function enumerates subkeys of the specified open registry key. RegEnumKeyEx retrieves information about one subkey each time it is called and it retrieves the class name of the subkey and the time it was last modified.
A remote application interface (RAPI) version of this function exists, and it is called CeRegEnumKeyEx (RAPI).
LONG RegEnumKeyEx( HKEY hKey, DWORD dwIndex, LPWSTR lpName, LPDWORD lpcName, LPDWORD lpReserved, LPWSTR lpClass, LPDWORD lpcbClass, PFILETIME lpftLastWriteTime );
- [in] Handle to a currently open key or one of the following predefined reserved handle values:
The enumerated keys are subkeys of the key identified by hKey.
- [in] Index of the subkey to retrieve. This parameter should be zero for the first call to the RegEnumKeyEx function and then incremented for subsequent calls.
Because subkeys are not ordered, any new subkey will have an arbitrary index. This means that the function may return subkeys in any order.
- [out] Pointer to a buffer that receives the name of the subkey, including the terminating null character. The function copies only the name of the subkey, not the full key hierarchy, to the buffer.
- [in, out] Pointer to a variable that specifies the size, in characters, of the buffer specified by the lpName parameter. This size should include the terminating null character. When the function returns, the variable pointed to by lpcName contains the number of characters stored in the buffer. The count returned does not include the terminating null character.
- [in] Reserved; set to NULL.
- [out] Pointer to a buffer that contains the class of the enumerated subkey when the function returns. This parameter can be NULL if the class is not required.
- [in, out] Pointer to a variable that specifies the size, in characters, of the buffer specified by the lpClass parameter. The size should include the terminating null character. When the function returns, lpcbClass contains the number of characters stored in the buffer. The count returned does not include the terminating null character. This parameter can be NULL only if lpClass is NULL.
- [in] Ignored; set to NULL.
ERROR_SUCCESS indicates success. A return value of ERROR_MORE_DATA indicates that the lpName buffer is too small to receive the name of the key. A nonzero error code defined in Winerror.h indicates failure. To get a generic description of the error, call FormatMessage with the FORMAT_MESSAGE_FROM_SYSTEM flag set. The message resource is optional; therefore, if you call FormatMessage it could fail.
To enumerate subkeys, an application should initially call the RegEnumKeyEx function with the dwIndex parameter set to zero. An application should then increment the dwIndex parameter and call RegEnumKeyEx until there are no more subkeys (until the function returns ERROR_NO_MORE_ITEMS).
An application can also set dwIndex to the index of the last subkey on the first call to the function and decrement the index until the subkey with the index 0 is enumerated. To retrieve the index of the last subkey, use the RegQueryInfoKey function.
While an application is using the RegEnumKeyEx function, it should not make calls to any registry functions that might change the key being enumerated. Use the RegCreateKeyEx or RegOpenKeyEx function to open the key identified by hKey.
OS Versions: Windows CE 1.0 and later.
Link Library: Coredll.lib.
Send Feedback on this topic to the authors