다음을 통해 공유


Querying for Version Information (Windows CE 5.0)

Send Feedback

The VERSIONINFO resource makes it easier for applications to install files properly by allowing the setup program to analyze files that are installed already. 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.

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

To obtain version information, first call the GetFileVersionInfoSize function 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 operating system, 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 the GetFileVersionInfo function to allocate a data buffer and retrieve the version information. If the function succeeds, the lpData parameter will point to the buffer that contains the file-version information.

Call the VerQueryValue function 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 following forms.

Form Description
\ Specifies the root block. The function retrieves a pointer to a structure 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 file-version 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 version-information 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 name must be one of the following predefined strings: Comments, InternalName, ProductName, CompanyName, LegalCopyright, ProductVersion, FileDescription, LegalTrademarks, PrivateBuild, FileVersion, OriginalFilename, or SpecialBuild. The function retrieves a string value specific to the language and code page indicated.

See Also

File System Operations

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.