4 out of 10 rated this helpful - Rate this topic

GetFileVersionInfoSize function

Applies to: desktop apps only

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.

Syntax

DWORD WINAPI GetFileVersionInfoSize(
  __in       LPCTSTR lptstrFilename,
  __out_opt  LPDWORD lpdwHandle
);

Parameters

lptstrFilename [in]

Type: LPCTSTR

The name of the file of interest. The function uses the search sequence specified by the LoadLibrary function.

lpdwHandle [out, optional]

Type: LPDWORD

A pointer to a variable that the function sets to zero.

Return value

Type: DWORD

If the function succeeds, the return value is the size, in bytes, of the file's version information.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

Call the GetFileVersionInfoSize function before calling the GetFileVersionInfo function. The size returned by GetFileVersionInfoSize indicates the buffer size required for the version information returned by GetFileVersionInfo.

Requirements

Minimum supported client

Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Header

Winver.h (include Windows.h)

Library

Version.lib

DLL

Version.dll

Unicode and ANSI names

GetFileVersionInfoSizeW (Unicode) and GetFileVersionInfoSizeA (ANSI)

See also

Reference
GetFileVersionInfo
VS_VERSIONINFO
VerQueryValue
Conceptual
Version Information

 

 

Send comments about this topic to Microsoft

Build date: 2/3/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
Return value size
You say: "If the function succeeds, the return value is the size, in bytes, of the file's version information." Is there any difference in size / contents of the buffer retrieved by GetFileVersionInfoW and GetFileVersionInfoA?
GetFileVersionInfoSize corrupts memory
I am trying to use GetFileVersionInfoSize on the following file:
c:\windows\SoftwareDistribution\Download\f0d77e49e427eb2d1efc93bd6563100109b56899

DWORD dwThisFileVersionInfoSize = GetFileVersionInfoSize(strName.GetString(), &dwZero);
dwThisFileVersionInfoSize  = 1892
FileSize = 351,936 bytes

If I run the program in Release mode it returns:
    Company Name: Microsoft Corporation
    Internal Name: mpas-d_bd1.exe
    Product Name: Microsoft Malware Protection
    Product Version: 1.117.3022.0

If I run the program in Visual Studio 2010 (Version 10.0.40219.1 SP1Rel) debug mode it hangs after I call some code after calling
GetFileVersionInfoSize

I have uploaded the file to my website: http://www.file-utilities.com/GF.zip