GetFileVersionInfoExA function (winver.h)

Retrieves version information for the specified file.

Syntax

BOOL GetFileVersionInfoExA(
  [in]  DWORD  dwFlags,
  [in]  LPCSTR lpwstrFilename,
        DWORD  dwHandle,
  [in]  DWORD  dwLen,
  [out] LPVOID lpData
);

Parameters

[in] dwFlags

Type: DWORD

Controls the MUI DLLs (if any) from which the version resource is extracted. The value of this flag must match the flags passed to the corresponding GetFileVersionInfoSizeEx call, which was used to determine the buffer size that is passed in the dwLen parameter. Zero or more of the following flags.

Value Meaning
FILE_VER_GET_LOCALISED
0x01
Loads the entire version resource (both strings and binary version information) from the corresponding MUI file, if available.
FILE_VER_GET_NEUTRAL
0x02
Loads the version resource strings from the corresponding MUI file, if available, and loads the binary version information (VS_FIXEDFILEINFO) from the corresponding language-neutral file, if available.
FILE_VER_GET_PREFETCHED
0x04
Indicates a preference for version.dll to attempt to preload the image outside of the loader lock to avoid contention. This flag does not change the behavior or semantics of the function.

[in] lpwstrFilename

Type: LPCTSTR

The name of the file. If a full path is not specified, the function uses the search sequence specified by the LoadLibrary function.

dwHandle

Type: DWORD

This parameter is reserved, and expected to be zero (0).

[in] dwLen

Type: DWORD

The size, in bytes, of the buffer pointed to by the lpData parameter.

Call the GetFileVersionInfoSizeEx function first to determine the size, in bytes, of a file's version information. The dwLen parameter 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.

[out] lpData

Type: LPVOID

When this function returns, contains a pointer to a buffer that contains the file-version information.

You can use this value in a subsequent call to the VerQueryValue function to retrieve data from the buffer.

Return value

Type: BOOL

If the function succeeds, the return value is nonzero.

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

Remarks

Call the GetFileVersionInfoSizeEx function before calling the GetFileVersionInfoEx function. To retrieve information from the file-version information buffer, use the VerQueryValue function.

Note

The winver.h header defines GetFileVersionInfoEx as an alias that automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that is not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header winver.h (include Windows.h)
Library Version.lib
DLL Api-ms-win-core-version-l1-1-0.dll

See also

Conceptual

GetFileVersionInfo

GetFileVersionInfoSizeEx

Reference

VS_VERSIONINFO

VerQueryValue

Version Information