---
name: "SHQueryValueExA"
section: "3w"
platform: "linux"
package: "libwine-dev"
version: "1.4.1-4"
release: "Debian 7 (Wheezy)"
platforms: ["linux"]
url: "https://new.carta.tech/SHQueryValueExA"
---

# SHQueryValueExA(3w)

## NAME

**SHQueryValueExA** (SHLWAPI.@)

## SYNOPSIS

DWORD SHQueryValueExA\
  (\
   HKEY    *hKey*,\
   LPCSTR  *lpszValue*,\
   LPDWORD *lpReserved*,\
   LPDWORD *pwType*,\
   LPVOID  *pvData*,\
   LPDWORD *pcbData*\
  )

## DESCRIPTION

Get a value from the registry, expanding environment variable strings.

## PARAMS

*hKey* **\[In\]**  Handle to registry key.

*lpszValue* **\[In\]**  Name of value to query.

*lpReserved* **\[Out\]**  Reserved for future use; must be **NULL**.

*pwType* **\[Out\]**  Optional pointer updated with the values type.

*pvData* **\[Out\]**  Optional pointer updated with the values data.

*pcbData* **\[Out\]**  Optional pointer updated with the values size.

## RETURNS

**Success:** **ERROR\_SUCCESS**. Any non **NULL** output parameters are updated with information about the value.

**Failure:** **ERROR\_OUTOFMEMORY** if memory allocation fails, or the type of the data is **REG\_EXPAND\_SZ** and *pcbData* is **NULL**. Otherwise an error code from **[RegQueryValueExA(3w)](/RegQueryValueExA/3w.md)** or **[ExpandEnvironmentStringsA(3w)](/ExpandEnvironmentStringsA/3w.md)**.

## NOTES

Either *pwType*, *pvData* or *pcbData* may be **NULL** if the caller doesn't want the type, data or size information for the value.

If the type of the data is **REG\_EXPAND\_SZ**, it is expanded to **REG\_SZ**. The value returned will be truncated if it is of type **REG\_SZ** and bigger than the buffer given to store it.

REG\_EXPAND\_SZ: case-1: the unexpanded string is smaller than the expanded one subcase-1: the buffer is too small to hold the unexpanded string: function fails and returns the size of the unexpanded string.

subcase-2: buffer is too small to hold the expanded string: the function return success (!!) and the result is truncated \*\*\* This is clearly an error in the native implementation. \*\*\*.

case-2: the unexpanded string is bigger than the expanded one The buffer must have enough space to hold the unexpanded string even if the result is smaller.

## IMPLEMENTATION

Declared in **"shlwapi.h"**.

Implemented in **"dlls/shlwapi/reg.c"**.

Debug channel **"shell"**.
