(SST) ShlWAPIFunctionInfo Version 1.0

Developer Reference
TSSTDllVerInfo.WinApiVerQueryValueStr Method
Retrieves a specific version information value-string from the in-memory copy of the version information resources of the file specified in property DllFileName.
Protected (i.e. the method can only be accessed from code in a descendant class or the unit it which it is implemented).
Function WinApiVerQueryValueStr(asubblock : STRING) : STRING;  
asubblock [in] Specifies the sub-block from which to retrieve the version information value-string. The sub-block string must have the following form (literals in bold, placeholders in italics):
That is, a backslash ("\") followed by "StringFileInfo", followed by a backslash and the language and codepage identifier pair in hexadecimal notation, separated from a value name string by a backslash.
Return Values
Returns the value-string assigned to the string-name specified in the sub-block string. This can be an empty (i.e. a zero length) string.
The function reads property ResourceVersionInfo to determine if an in-memory copy of the version info resources exists. If the pointer supplied by the property is not nil, the function assumes that the version information has been mapped into memory at the address specified by the pointer. It then proceeds by calling the ANSI version of the Windows API function VerQueryValue, specifying the pointer and asubblock (the parameter passed to the method on call) as the first two parameters. If VerQueryValue returns TRUE, the method evaluates the values returned in parameters three (lplpBuffer) and four (puLen). If the variables passed to the API function as the lplpBuffer and puLen parameters are not nil and zero (0), the lplpBuffer variable is cast to a PChar and copied into the string returned to the caller of WinApiVerQueryValueStr. If VerQueryValue returns FALSE or either of the variables passed to VerQueryValue as the third and fourth parameters contain invalid values (i.e. nil or zero) after the call, the method calls procedure SetLastErrorCode with a default error code of -1 (0xFFFFFFFF). In both of these, latter, two cases the method exits returning an empty string. An empty string is also returned if property ResourceVersionInfo is nil.
The following standardized version information, string value-names are predefined in Microsoft and third party, Windows SDKs and can be specified to retrieve the corresponding value-string.
Prediefined String-Name Example How to Specify
Comments WinApiVerQueryValueStr('\StringFileInfo\040904B0\Comments');
CompanyName WinApiVerQueryValueStr('\StringFileInfo\040904B0\CompanyName');
FileDescription WinApiVerQueryValueStr('\StringFileInfo\040904B0\FileDescription');
FileVersion WinApiVerQueryValueStr('\StringFileInfo\040904B0\FileVersion');
InternalName WinApiVerQueryValueStr('\StringFileInfo\040904B0\InternalName');
LegalCopyright WinApiVerQueryValueStr('\StringFileInfo\040904B0\LegalCopyright');
OriginalFilename WinApiVerQueryValueStr('\StringFileInfo\040904B0\OriginalFilename');
ProductName WinApiVerQueryValueStr('\StringFileInfo\040904B0\ProductName');
ProductVersion WinApiVerQueryValueStr('\StringFileInfo\040904B0\ProductVersion');
Like the above, the following value-names are also standardized and predefined, but are generally only present, and should thus be specified only, if the respective flag in the dwFileFlags member/field of the version information resources' VS_FIXEDFILEINFO record/structure is set.
Prediefined String-Name Example How to Specify
PrivateBuild WinApiVerQueryValueStr('\StringFileInfo\040904B0\PrivateBuild');
SpecialBuild WinApiVerQueryValueStr('\StringFileInfo\040904B0\SpecialBuild');
Unit (Declared and implemented in) SSTNewUnit.pas
Library SSTNewUnit.dcu/SSTNewUnit.obj
Unicode Implemented as ANSI version only.
See Also
TSSTDllVerInfo, ResourceFixedFileInfo, ResourceLanguageIdAsStr, WinResLanguageIdAsString, WinApiGetResourceLanguageId, SetLastErrorCode, LastError, Source Code
Windows APIs: VERSIONINFO Resource, VS_VERSIONINFO Structure, VerQueryValue.

Document/Contents version 1.00
Page/URI last updated on April 30, 2022
Copyright © Stoelzel Software Technologie (SST) 2010 - 2017
Suggestions and comments mail to: