INtime SDK Help
RtRegEnumKeyEx
INtime SDK v7.1 > About INtime > INtime Kernel > Registry access > RtRegEnumKeyEx

Enumerates subkeys of the specified open registry key. The call retrieves information about one subkey each time it is called. This call enumerates the class name of the subkey and the time it was last modified.

To enumerate subkeys, an application should initially make this call with the dwIndex parameter set to zero. The application should then increment the dwIndex parameter and make this call until there are no more subkeys (until the call returns ERROR_NO_MORE_ITEMS).

The application can also set dwIndex to the index of the last subkey on the first call to the call and decrement the index until the subkey with the index 0 is enumerated. To retrieve the index of the last subkey, use RtRegQueryInfoKey.

While an application is using this call, it should not make calls to any registration calls that might change the key being enumerated.

The key identified by hKey must have been opened with KEY_ENUMERATE_SUB_KEYS access (KEY_READ includes KEY_ENUMERATE_SUB_KEYS). Use RtRegCreateKeyEx or RtRegOpenKeyEx to open the key.

LONG RtRegEnumKeyEx(
    HKEY hKey,                   // handle to key to enumerate
    DWORD dwIndex,               // index of subkey to enumerate
    LPTSTR lpName,               // address of buffer for subkey name
    LPDWORD lpcbName,            // address for size of subkey buffer
    LPDWORD lpReserved,          // reserved
    LPTSTR lpClass,              // address of buffer for class string
    LPDWORD lpcbClass,           // address for size of class buffer
    PFILETIME lpftLastWriteTime  // address for time key last written to
);

Parameters

hKey
Handle to a currently open key or one of the following predefined reserved handle values:

HKEY_CLASSES_ROOT
HKEY_CURRENT_CONFIG
HKEY_CURRENT_USER
HKEY_LOCAL_MACHINE
HKEY_USERS
HKEY_PERFORMANCE_DATA

The enumerated keys are subkeys of the key identified by hKey.
dwIndex
Specifies the index of the subkey to retrieve. This parameter should be zero for the first call to RtRegEnumKeyEx and then incremented for subsequent calls. Because subkeys are not ordered, any new subkey has an arbitrary index. This means that the call may return subkeys in any order.
lpName
Pointer to a buffer that receives the name of the subkey, including the terminating null character. The call copies only the name of the subkey, not the full key hierarchy, to the buffer.
lpcbName
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 call returns, the variable pointed to by lpcbName contains the number of characters stored in the buffer. The count returned does not include the terminating null character.
lpReserved
Reserved; must be NULL.
lpClass
Pointer to a buffer that contains the class of the enumerated subkey when the call returns. This parameter can be NULL if the class is not required.
lpcbClass
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 call 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.
lpftLastWriteTime
Pointer to a variable that receives the time the enumerated subkey was last written to.

Return Values

ERROR_SUCCESS
Success.
A nonzero status code defined in RTWIN32.H.
Failure. To determine the status, call GetLastRtError.

Requirements

Versions Defined in Include Link to
INtime 3.0 intime/rt/include/rtbase.h rt.h rt.lib

See Also

Registry system calls, RtRegQueryInfoKey, RtRegCreateKeyEx, RtRegOpenKeyEx, RtRegDeleteKey