RegEnumValue

RegEnumValue enumerates the values for the specified open registry key.

Syntax

LONG RegEnumValue(
    HKEY       hKey,
    DWORD                dwIndex,
    LPTSTR     lpValueName, 
    LPDWORD    lpcchValueName, 
    LPDWORD    lpReserved, 
    LPDWORD    lpType, 
    LPBYTE     lpData, 
    LPDWORD    lpcbData, 
  );

Parameters

hKey

A handle to an open registry key. The key must have been opened with the KEY_QUERY_VALUE access right. This handle is returned by the RegCreateKey, RegCreateKeyEx, RegOpenKey or RegOpenKeyEx function. It can also be one of the following predefined keys:

HKEY_LOCAL_MACHINE

HKEY_USERS

dwIndex

The index of the value to be retrieved. This parameter should be zero for the first call to the RegEnumValue function and then be incremented for subsequent calls.

Because values are not ordered, any new value will have an arbitrary index. This means that the function may return values in any order.

lpValueName

A pointer to a buffer that receives the name of the value as a null-terminated string. This buffer must be large enough to include the terminating null character.

lpcchValueName

A pointer to a variable that specifies the size of the buffer pointed to by the lpValueName parameter, in characters. When the function returns, the variable receives the number of characters stored in the buffer, not including the terminating null character.

lpReserved

This parameter is reserved and must be NULL.

lpType

A pointer to a variable that receives a code indicating the type of data stored in the specified value. This parameter is optional and can be NULL if the type code is not required.

lpData

Pointer to a buffer that receives the data for the value entry. This parameter is optional. It can be NULL if the data is not required.

lpcbData

A pointer to a variable that specifies the size of the buffer pointed to by the lpData parameter, in bytes. When the function returns, the variable reeives the number of bytes stored in the buffer. This parameter is optional and can be NULL only if lpData is NULL.

Return Value

If the function succeeds, the return value is ERROR_SUCCESS.

If the function fails, the return value is a system error code. If there are no more values available, the function returns ERROR_NO_MORE_ITEMS.

If the lpData buffer is too small to receive the value, the function returns ERROR_MORE_DATA.

Remarks

To enumerate values, an application should initially call the RegEnumValue function with the dwIndex parameter set to zero. The application should then increment the dwIndex parameter and call RegEnumValue function until there are not more values (meaning the function returns ERROR_NO_MORE_ITEMS).

Requirements

Minimum Supported Version RTX64 2013
Header windows.h
Library Rtx_Rtss.lib

See Also:

Registry API

RegCreateKeyEx

RegEnumKeyEx

RegOpenKey

RegOpenKeyEx