RegEnumKey
RegEnumKey enumerates the subkeys of the specified open registry key. The function retrieves the name of one subkey each time it is called.
Syntax
LONG RegEnumKey( HKEY hKey, DWORD dwIndex, LPTSTR lpname, DWORD cchName );
Parameters
hKey
A handle to an open registry key. The key must have been opened with the KEY_ENUMERATE_SUB_KEYS access to the key. This handle is returned by the RegCreateKey, RegCreateKeyEx, RegOpenKey or RegOpenKeyEx function, or it can be one of the following predefined keys:
HKEY_LOCAL_MACHINE
HKEY_USERS
dwIndex
The index of the subkey of hKey to be retrieved. This value should be zero for the first call to the RegEnumKey function and then incremented for subsequent calls..
Because subkeys are not ordered, any new subkey will have and arbitrary index. This means that the function may return subkeys in any order
lpName
A pointer to a buffer that receives the name of the subkey, including the terminating null character. This function copies only the name of the subkey, not the full key hierarchy, to the buffer.
cchName
Size of the buffer pointed to by lpName in TCHARs
Return Value
If the function succeeds, the return value is ERROR_SUCCESS.
If the function fails the return value is a nonzero error code.
If there are no more subkeys available, the function returns ERROR_NO_MORE_ITEMS. If the lpName buffer is too small to receive the name of the key, the function returns ERROR_MORE_DATA.
Remarks
To enumerate subkeys, an application should initially call the RegEnumKey function with the dwIndex parameter set to zero. The application should then increment the dwIndex parameter and call RegEnumKey function until there are not more subkeys (meaning the function returns ERROR_NO_MORE_ITEMS).
While an application is using the RegEnumKey function, it should not make calls to any registration functions that might change the key being queried.
Requirements
Minimum Supported Version | RTX64 2013 |
Header | windows.h |
Library | Rtx_Rtss.lib |
See Also: