Skip to content

Latest commit

 

History

History
263 lines (161 loc) · 9.46 KB

nf-winver-verqueryvaluew.md

File metadata and controls

263 lines (161 loc) · 9.46 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist ms.custom f1_keywords dev_langs topic_type api_type api_location api_name
NF:winver.VerQueryValueW
VerQueryValueW function (winver.h)
Retrieves specified version information from the specified version-information resource. (Unicode)
VerQueryValue
VerQueryValue function [Menus and Other Resources]
VerQueryValueW
_win32_VerQueryValue
_win32_verqueryvalue_cpp
menurc.verqueryvalue
winui._win32_verqueryvalue
winver/VerQueryValue
winver/VerQueryValueW
menurc\verqueryvalue.htm
menurc
VS|winui|~\winui\windowsuserinterface\resources\versioninformation\versioninformationreference\versioninformationfunctions\verqueryvalue.htm
12/05/2018
VerQueryValue, VerQueryValue function [Menus and Other Resources], VerQueryValueA, VerQueryValueW, _win32_VerQueryValue, _win32_verqueryvalue_cpp, menurc.verqueryvalue, winui._win32_verqueryvalue, winver/VerQueryValue, winver/VerQueryValueA, winver/VerQueryValueW
winver.h
Windows.h
Windows
Windows 2000 Professional [desktop apps only]
Windows 2000 Server [desktop apps only]
VerQueryValueW (Unicode) and VerQueryValueA (ANSI)
Version.lib
Api-ms-win-core-version-l1-1-0.dll
Windows
19H1
VerQueryValueW
winver/VerQueryValueW
c++
APIRef
kbSyntax
DllExport
api-ms-win-core-version-l1-1-0.dll
API-MS-Win-Core-version-l1-1-0.dll
KernelBase.dll
API-MS-Win-Core-versionansi-l1-1-0.dll
API-MS-Win-DownLevel-version-l1-1-0.dll
API-MS-Win-Core-Versionansi-L1-1-1.dll
API-MS-Win-Core-Version-L1-1-1.dll
version.dll
VerQueryValue
VerQueryValueA
VerQueryValueW

VerQueryValueW function

-description

Retrieves specified version information from the specified version-information resource. To retrieve the appropriate resource, before you call VerQueryValue, you must first call the GetFileVersionInfoSize function, and then the GetFileVersionInfo function.

-parameters

-param pBlock [in]

Type: LPCVOID

The version-information resource returned by the GetFileVersionInfo function.

-param lpSubBlock [in]

Type: LPCTSTR

The version-information value to be retrieved. The string must consist of names separated by backslashes (\) and it must have one of the following forms.

\

The root block. The function retrieves a pointer to the VS_FIXEDFILEINFO structure for the version-information resource.

\VarFileInfo\Translation

The translation array in a Var variable information structure—the Value member of this structure. The function retrieves a pointer to this array of language and code page identifiers. An application can use these identifiers to access a language-specific StringTable structure (using the szKey member) in the version-information resource.

\StringFileInfo\lang-codepage\string-name

A value in a language-specific StringTable structure. The lang-codepage name is a concatenation of a language and code page identifier pair found as a DWORD in the translation array for the resource. Here the lang-codepage name must be specified as a hexadecimal string. The string-name name must be one of the predefined strings described in the following Remarks section. The function retrieves a string value specific to the language and code page indicated.

-param lplpBuffer [out]

Type: LPVOID*

When this method returns, contains the address of a pointer to the requested version information in the buffer pointed to by pBlock. The memory pointed to by lplpBuffer is freed when the associated pBlock memory is freed.

-param puLen [out]

Type: PUINT

When this method returns, contains a pointer to the size of the requested data pointed to by lplpBuffer: for version information values, the length in characters of the string stored at lplpBuffer; for translation array values, the size in bytes of the array stored at lplpBuffer; and for root block, the size in bytes of the structure.

- lpSubBlock.\

The root block. The function retrieves a pointer to the VS_FIXEDFILEINFO structure for the version-information resource.

- lpSubBlock.\StringFileInfo\lang-codepage\string-name

A value in a language-specific StringTable structure. The lang-codepage name is a concatenation of a language and code page identifier pair found as a DWORD in the translation array for the resource. Here the lang-codepage name must be specified as a hexadecimal string. The string-name name must be one of the predefined strings described in the following Remarks section. The function retrieves a string value specific to the language and code page indicated.

- lpSubBlock.\VarFileInfo\Translation

The translation array in a Var variable information structure—the Value member of this structure. The function retrieves a pointer to this array of language and code page identifiers. An application can use these identifiers to access a language-specific StringTable structure (using the szKey member) in the version-information resource.

-returns

Type: BOOL

If the specified version-information structure exists, and version information is available, the return value is nonzero. If the address of the length buffer is zero, no value is available for the specified version-information name.

If the specified name does not exist or the specified resource is not valid, the return value is zero.

-remarks

This function works on 16-, 32-, and 64-bit file images.

The following are predefined version information Unicode strings.

Comments InternalName ProductName
CompanyName LegalCopyright ProductVersion
FileDescription LegalTrademarks PrivateBuild
FileVersion OriginalFilename SpecialBuild
 

Examples

The following example shows how to enumerate the available version languages and retrieve the FileDescription string-value for each language.

Be sure to call the GetFileVersionInfoSize and GetFileVersionInfo functions before calling VerQueryValue to properly initialize the pBlock buffer.

// Structure used to store enumerated languages and code pages.

HRESULT hr;

struct LANGANDCODEPAGE {
  WORD wLanguage;
  WORD wCodePage;
} *lpTranslate;

// Read the list of languages and code pages.

VerQueryValue(pBlock, 
              TEXT("\\VarFileInfo\\Translation"),
              (LPVOID*)&lpTranslate,
              &cbTranslate);

// Read the file description for each language and code page.

for( i=0; i < (cbTranslate/sizeof(struct LANGANDCODEPAGE)); i++ )
{
  hr = StringCchPrintf(SubBlock, 50,
            TEXT("\\StringFileInfo\\%04x%04x\\FileDescription"),
            lpTranslate[i].wLanguage,
            lpTranslate[i].wCodePage);
	if (FAILED(hr))
	{
	// TODO: write error handler.
	}

  // Retrieve file description for language and code page "i". 
  VerQueryValue(pBlock, 
                SubBlock, 
                &lpBuffer, 
                &dwBytes); 
}

Note

The winver.h header defines VerQueryValue as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

-see-also

Conceptual

GetFileVersionInfo

GetFileVersionInfoSize

Reference

String

StringFileInfo

StringTable

VS_FIXEDFILEINFO

VS_VERSIONINFO

Var

VarFileInfo

Version Information