Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This method enumerates subkeys of an open registry key on a remote Windows Embedded CE–based device.

Syntax

LONG CeRegEnumKeyEx(
  HKEY 
hKey, 
  DWORD 
dwIndex, 
  LPWSTR 
lpName, 
  LPDWORD 
lpcbName, 
  LPDWORD 
lpReserved, 
  LPWSTR 
lpClass, 
  LPDWORD 
lpcbClass, 
  PFILETIME 
lpftLastWriteTime 
);

Parameters

hKey

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

HKEY_CLASSES_ROOT

HKEY_CURRENT_USER

HKEY_LOCAL_MACHINE

HKEY_USERS

The enumerated keys are subkeys of the key identified by hKey.

dwIndex

[in] Specifies the index of the subkey to retrieve. This parameter should be zero for the first call to the IRAPISession::CeRegEnumKeyExfunction 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.

lpName

[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.

lpcbName

[in, out] Pointer to a variable that specifies the size, in characters, of the buffer specified by the lpNameparameter. This size should include the terminating null character. When the function returns, the variable pointed to by lpcbNamecontains the number of characters stored in the buffer. The count returned does not include the terminating null character.

lpReserved

[in] Reserved; set to NULL.

lpClass

[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.

lpcbClass

[in, out] Pointer to a variable that specifies the size, in characters, of the buffer specified by the lpClassparameter. The size should include the terminating null character. When the function returns, lpcbClasscontains 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 lpClassis NULL.

lpftLastWriteTime

[in] Ignored; set to NULL.

Return Value

ERROR_SUCCESS indicates success. A return value of ERROR_MORE_DATA indicates that the lpNamebuffer 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 FormatMessagewith the FORMAT_MESSAGE_FROM_SYSTEM flag set. The message resource is optional, therefore, if you call FormatMessageit could fail.

Remarks

To enumerate subkeys, an application should initially call the IRAPISession::CeRegEnumKeyExfunction with the dwIndexparameter set to zero. An application should then increment the dwIndexparameter and call IRAPISession::CeRegEnumKeyExuntil there are no more subkeys (until the function returns ERROR_NO_MORE_ITEMS).

To retrieve the number of subkeys for a given key, use the IRAPISession::CeRegQueryInfoKeyfunction.

While an application is using the IRAPISession::CeRegEnumKeyExmethod, it should not make calls to any registration functions that might change the key being enumerated.

The key identified by hKeymust have been opened with KEY_ENUMERATE_SUB_KEYS access (KEY_READ includes KEY_ENUMERATE_SUB_KEYS). Use the IRAPISession::CeRegCreateKeyExor IRAPISession::CeRegOpenKeyExfunction to open the key.

Requirements

Header rapi2.h
Library ole32.lib, rapiuuid.lib
Windows Embedded CE Windows Embedded CE 6.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also