GetFileVersionInfo The GetFileVersionInfo function retrieves version information for the specified file. BOOL GetFileVersionInfo( LPTSTR lptstrFilename, // file name DWORD dwHandle, // ignored DWORD dwLen, // size of buffer LPVOID lpData // version information buffer ); Parameters lptstrFilename [in] Pointer to a null-terminated string that specifies the name of the file of interest. If a full path is not specified, the function uses the search sequence specified by the LoadLibrary function. Windows 95/98/Me: The short path form of the specified file name must be less than 126 characters. dwHandle This parameter is ignored. dwLen [in] Specifies the size, in bytes, of the buffer pointed to by the lpData parameter. Call the GetFileVersionInfoSize function first to determine the size, in bytes, of a file's version information. The dwLen member should be equal to or greater than that value. If the buffer pointed to by lpData is not large enough, the function truncates the file's version information to the size of the buffer. lpData [out] Pointer to a buffer that receives the file-version information. You can use this value in a subsequent call to the VerQueryValue function to retrieve data from the buffer.
Version information makes it easier for applications to install files properly and enables setup programs to analyze files currently installed. The version-information resource contains the file's version number, intended operating system, and original file name. Overviews
About Version Information
This topic discusses the version information functions.Using Version Information
This topic discusses how to use the version information functions.Functions
GetFileVersionInfo
The GetFileVersionInfo function retrieves version information for the specified file. GetFileVersionInfoSize
The GetFileVersionInfoSize function determines whether the operating system can retrieve version information for a specified file. If version information is available, GetFileVersionInfoSize returns the size, in bytes, of that information. VerFindFile
The VerFindFile function determines where to install a file based on whether it locates another version of the file in the system. The values VerFindFile returns in the specified buffers are used in a subsequent call to the VerInstallFile function. VerInstallFile
The VerInstallFile function attempts to install the specified file based on information returned from the VerFindFile function. VerInstallFile decompresses the file, if necessary, assigns a unique filename, and checks for errors, such as outdated files. VerLanguageName
The VerLanguageName function retrieves a description string for the language associated with a specified binary MicrosoftVerQueryValue
The VerQueryValue function 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. Structures
String
The String structure depicts the organization of data in a file-version resource. It contains a string that describes a specific aspect of a file, for example, a file's version, its copyright notices, or its trades.StringFileInfo
The StringFileInfo structure depicts the organization of data in a file-version resource. It contains version information that can be displayed for a particular language and code page.StringTable
The StringTable structure depicts the organization of data in a file-version resource. It contains language and code page formatting information for the strings specified by the Children member. A code page is an ordered character set.Var
The Var structure depicts the organization of data in a file-version resource. It typically contains a list of language and code page identifier pairs that the version of the application or dynamic-link library (DLL) supports.VarFileInfo
The VarFileInfo structure depicts the organization of data in a file-version resource. It contains version information not dependent on a particular language and code page combination.VS_FIXEDFILEINFO
The VS_FIXEDFILEINFO structure contains version information about a file. This information is language and code page independent. VS_VERSIONINFO
The VS_VERSIONINFO structure depicts the organization of data in a file-version resource. It is the root structure that contains all other file-version information structures.--------------------------------------------------------------------------------© 2003 Microsoft Corporation. All rights reserved.
The GetFileVersionInfo function retrieves version information for the specified file. BOOL GetFileVersionInfo(
LPTSTR lptstrFilename, // file name
DWORD dwHandle, // ignored
DWORD dwLen, // size of buffer
LPVOID lpData // version information buffer
);
Parameters
lptstrFilename
[in] Pointer to a null-terminated string that specifies the name of the file of interest. If a full path is not specified, the function uses the search sequence specified by the LoadLibrary function.
Windows 95/98/Me: The short path form of the specified file name must be less than 126 characters. dwHandle
This parameter is ignored.
dwLen
[in] Specifies the size, in bytes, of the buffer pointed to by the lpData parameter.
Call the GetFileVersionInfoSize function first to determine the size, in bytes, of a file's version information. The dwLen member should be equal to or greater than that value. If the buffer pointed to by lpData is not large enough, the function truncates the file's version information to the size of the buffer. lpData
[out] Pointer to a buffer that receives the file-version information.
You can use this value in a subsequent call to the VerQueryValue function to retrieve data from the buffer.