Querying for Version Information (Windows Embedded CE 6.0)

1/6/2010

The VERSIONINFO resource makes it easier for applications to install files properly by enabling the setup program to analyze files that are already installed. In this way, you can avoid problems such as installing older versions of components over newer versions, installing multiple copies of the same file in different directories, and changing the language in a mixed-language system.

Starting with Windows CE 3.0, Windows Embedded CE provides these version-querying functions, which are a subset of the Win32 version-information API:

To obtain version information, first call GetFileVersionInfoSize with the name of the file that you want to query. This function determines whether the specified file contains a VERSIONINFO resource with the version number of the file, its intended OS, and its original file name. If version information is available, GetFileVersionInfoSize returns the size, in bytes, of that information.

Use the size information and the file name to call GetFileVersionInfo to allocate a data buffer and retrieve the version information. If the function succeeds, the lpDataparameter points to the buffer that contains the file-version information.

Call VerQueryValue with the pointer to the buffer and another pointer to a string that specifies the sub-block of information to be retrieved. The string must consist of names that are separated by backslashes (\), and it must have one of the forms shown in the following table.

Form Description

\

Specifies the root block. The function returns a pointer to a structure that contains version information about a file. This information is language- and code-page independent.

\VarFileInfo\Translation

Pointer to a structure that depicts the organization of data in a VERSIONINFO resource. This structure typically contains a list of language and code-page identifier pairs that the version of the application or DLL supports. An application can use these identifiers to access a language-specific StringTable structure in the VERSIONINFO resource.

\StringFileInfo\lang-codepage\string-name

Specifies a value in a language-specific StringTable structure. The lang-codepage name is a concatenation of a language and code-page identifier pair that is 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 must be one of the following predefined strings:

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

The function retrieves a string value specific to the language and code page indicated.

See Also

Concepts

Obtaining and Setting File Information
File System Operations