RegQueryValueEx
RegQueryValueEx retrives the type and data associated with the value of a specified registry key.
Syntax
LONG RegQueryValueEx( HKEY hKey, LPCTSTR lpValueName, 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
lpValueName
Name of the registry value. The lpValueName parameter is optional. If lpValueName is NULL or an empty string, "", the function retrieves the type and data for the key's unnamed or default value, if any.
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
An application cannot create a key that is a direct child of HKEY_USERS or HKEY_LOCAL_MACHINE. An application can create subkeys in lower levels of HKEY_USERS or HKEY_LOCAL_MACHINE trees.
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.
Requirements
Minimum Supported Version | RTX64 2013 |
Header | windows.h |
Library | Rtx_Rtss.lib |
See Also: