RegQueryValueEx

RegQueryValueEx retrives the type and data associated with the value of a specified registry key.

Syntax

Copy
LONG RegQueryValueEx(
    HKEY           hKey,
    LPCTSTR        lpValueName,
    LPDWORD        lpReserved, 
    LPDWORD        lpType, 
    LPBYTE         lpData, 
    LPDWORD        lpcbData  
  );

Parameters

hKey

A handle that can be one of the following predefined keys:

lpValueName

Name of the registry value. This parameter must not be NULL.

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. The lpType parameter can be NULL if the type code is not required.

lpData

Pointer to the buffer that receives the value’s data. This parameter is optional and 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, this variable contains the size of the data copied to lpData.

The lpcbData parameter 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 nonzero error code.

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

If the lpValueName registry value does not exist, the function returns ERROR_FILE_NOT_FOUND.

Remarks

The application should call RegClosekey when the handle is not in use or upon application exit.

An application can use the RegCreateKey function to create one level deep at once.

When lpData is NULL and lpcbData is not NULL, lpcbData receives the size of the data and the function returns ERROR_SUCCESS.

Requirements

Minimum supported version Header Library

eRTOS 1.0 SDK

windows.h rtkrnl.lib

See Also: