LONG RegEnumKeyEx(hkey, iSubkey, lpszName, lpcbName, lpdwReserved, lpszClass, lpcbClass, lpftLastWrite) | |||||
HKEY hkey; | /* handle of key to query | */ | |||
DWORD iSubkey; | /* index of subkey to query | */ | |||
LPTSTR lpszName; | /* address of buffer for subkey name | */ | |||
LPDWORD lpcbName; | /* size of subkey buffer | */ | |||
LPDWORD lpdwReserved; | /* reserved; should be NULL | */ | |||
LPTSTR lpszClass; | /* address of buffer for class string | */ | |||
LPDWORD lpcbClass; | /* size of class buffer | */ | |||
PFILETIME lpftLastWrite; | /* time key last written | */ |
The RegEnumKeyEx function enumerates the subkeys of a specified open configuration registry key. It does this by copying an indexed subkey of the specified key. The function enumerates one subkey each time it is invoked.
hkey
Identifies a currently open key or any of the following predefined reserved handle values:
HKEY_CLASSES_ROOT HKEY_CURRENT_USER HKEY_LOCAL_MACHINE HKEY_USERS
The enumerated subkeys are relative to the key specified by hkey.
iSubkey
Specifies the index of the subkey to retrieve. This parameter should be zero for the first call to the RegEnumKey function.
Subkeys are not ordered. A new subkey has an arbitrary index. This means that this function may return subkeys in any order.
lpszName
Points to a buffer that receives the name of the subkey. The function copies only the name of the subkey, not the full key hierarchy, to the buffer.
lpcbName
Points to a variable that specifies the size of the buffer at lpszName (in bytes). When the function returns, the variable at lpcbName contains the number of bytes stored in the buffer.
lpdwReserved
Reserved; must be NULL.
lpszClass
Points 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.
lpcbClass
Points to a variable that specifies the size of the buffer at lpszClass (in bytes). When the function returns, the variable at lpcbClass contains the number of bytes stored in the buffer. This parameter may only be NULL if lpszClass is NULL.
lpftLastWrite
Points to a variable that receives the time the enumerated subkey was last written to.
The return value is ERROR_SUCCESS if the function is successful. Otherwise, it is an error value.
To enumerate subkeys, an application should initially call the RegEnumKeyEx function with the iSubKey parameter set to zero. The application should then increment the iSubKey parameter and call the RegEnumKeyEx function until there are no more subkeys (the function returns ERROR_CANT_READ).
While an application is using the RegEnumKeyEx function it should not make calls to any registration functions that might change the key being queried.
The key specified by hkey must have been opened with KEY_ENUMERATE_SUB_KEYS access (KEY_READ includes KEY_ENUMERATE_SUB_KEYS).
The RegEnumKeyEx function may be used as either a wide-character function (where text arguments must use Unicode) or an ANSI function (where text arguments must use characters from the Windows 3.x character set installed).
RegEnumKey