GetFileVersionInfo

3.1

  #include <ver.h>    

  BOOL GetFileVersionInfo(lpszFileName, handle, cbBuf, lpvData)    
  LPCSTR lpszFileName; /* address of buffer for filename */
  DWORD handle; /* file-version information, */  
  DWORD cbBuf; /* size of buffer, */  
  void FAR* lpvData; /* address of buffer for file-version info */

The GetFileVersionInfo function returns version information about the specified file. The application must call the GetFileVersionInfoSize function before calling GetFileVersionInfo to obtain the appropriate handle if the handle is not NULL.

Parameters

lpszFileName

Points to the buffer that contains the name of the file.

handle

Identifies the file-version information. The GetFileVersionInfoSize function returns this handle, or it may be NULL. If the handle parameter is NULL, the GetFileVersionInfo function searches the file for the version information.

cbBuf

Specifies the buffer size, in bytes, identified by the lpvData parameter. The GetFileVersionInfoSize function returns the buffer size required to hold the file-version information. If the buffer is not large enough, the file-version information is truncated to the size of the buffer.

lpvData

Points to the buffer that will receive the file-version information. This parameter is used by a subsequent call to the VerQueryValue function.

Return Value

The return value is nonzero if the function is successful. Otherwise, it is zero, indicating the file does not exist or the handle parameter is invalid. The GetFileVersionInfo function returns no information about the type of error that occurred.

Comments

The file version information is organized in a VERSIONINFO statement.

Currently, the GetFileVersionInfo function recognizes only version-information created by Microsoft Resource Compiler (RC).

See Also

GetFileVersionInfoSize, VerQueryValue