SHQueryValueExA function

Opens a registry key and queries it for a specific value.

Syntax

LSTATUS SHQueryValueExA(
  HKEY   hkey,
  LPCSTR pszValue,
  DWORD  *pdwReserved,
  DWORD  *pdwType,
  void   *pvData,
  DWORD  *pcbData
);

Parameters

hkey

Type: HKEY

A handle to the currently open key, or any of the following predefined values.

HKEY_CLASSES_ROOT

HKEY_CURRENT_CONFIG

HKEY_CURRENT_USER

HKEY_LOCAL_MACHINE

HKEY_PERFORMANCE_DATA

HKEY_USERS

pszValue

Type: LPCTSTR

The address of the null-terminated string that contains the name of the value to be queried.

pdwReserved

Type: LPDWORD

Reserved. Must be NULL.

pdwType

Type: LPDWORD

The address of the variable that receives the key's value type. For more information, see Registry Data Types.

pvData

Type: LPVOID

The address of the buffer that receives the value's data. This parameter can be NULL if the data is not required.

pcbData

Type: LPDWORD

The address of the variable that specifies the size, in bytes, of the buffer pointed to by the pvData parameter. When the function returns, this variable contains the size of the data copied to pvData.

Return Value

Type: DWORD

Returns ERROR_SUCCESS if successful, or a nonzero error code defined in Winerror.h otherwise. You can use the FormatMessage function with the FORMAT_MESSAGE_FROM_SYSTEM flag to retrieve a generic description of the error.

Requirements

   
Minimum supported client Windows 2000 Professional, Windows XP [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header shlwapi.h
Library Shlwapi.lib
DLL Shlwapi.dll (version 4.71 or later)