Skip to content

Version Information

tajmone edited this page Dec 25, 2017 · 3 revisions
PureBASIC v5.61

References on how PB Compiler handles Version Information for Windows binary files.


Table of Contents


Introduction

On Windows, PureBASIC IDE allows to add Version Information to compiled binary files. From PureBASIC Documentation:

This is a Windows only feature. By enabling this, a resource is included in the executable with information about your program. It can be viewed by right-clicking on the executable in the windows explorer and selecting "Properties". Also it can be read by other programs such as setup tools.

Version Information in The IDE

Version Information of a source file can be accessed/set via the IDE's menu "Compiler » Compiler Options..." and selecting the "Version Info" tab. Here is a composite screenshot (vertically stretched):

PureBASIC IDE Version Information Options

If used, these settings are saved along with the rest of the compiler settings for the source file. For more details on how these settings are mapped to the source file, see the dedicated Wiki page:

IDE's Resource File

When compiling a binary file with Version Info, the IDE creates a Windows resource file ("PB_Resources.rc") in %TMP% folder. (credits: @helpy's PB Forum post)

Example RC File

Here is what the "PB_Resources.rc" created for the settings of the above screenshot looks like:

#define VOS_UNKNOWN  0x00000000
#define VOS_DOS  0x00010000
#define VOS_OS216  0x00020000
#define VOS_OS232  0x00030000
#define VOS_NT  0x00040000
#define VOS_DOS_WINDOWS16  0x00010001
#define VOS_DOS_WINDOWS32  0x00010004
#define VOS_OS216_PM16  0x00020002
#define VOS_OS232_PM32  0x00030003
#define VOS_NT_WINDOWS32  0x00040004
#define VFT_UNKNOWN  0
#define VFT_APP  1
#define VFT_DLL  2
#define VFT_DRV  3
#define VFT_FONT  4
#define VFT_VXD  5
#define VFT_STATIC_LIB  7

1 VERSIONINFO
FILEVERSION 1,2,3,4
PRODUCTVERSION 4,3,2,1
FILEOS VOS_NT_WINDOWS32
FILETYPE VFT_APP
{
  BLOCK "StringFileInfo"
  {
    BLOCK "080904b0"
    {
      VALUE "CompanyName", "My Company\0"
      VALUE "ProductName", "My Super Product\0"
      VALUE "ProductVersion", "v1\0"
      VALUE "FileVersion", "v1.0.1\0"
      VALUE "FileDescription", "Super Product EXE\0"
      VALUE "InternalName", "SuperProduct\0"
      VALUE "OriginalFilename", "SuperProduct.exe\0"
      VALUE "LegalCopyright", "(c) Tristano Ajmone\0"
      VALUE "LegalTrademarks", "Trademark\0"
      VALUE "PrivateBuild", "Developers Test Pre-Release\0"
      VALUE "SpecialBuild", "Test all Bug Fixes before release\0"
      VALUE "Email", "mymail@super.com\0"
      VALUE "Website", "http://www.super-product.com\0"
      VALUE "CustomField1", "Custom field 1 value\0"
      VALUE "CustomField2", "Custom field 2 value\0"
      VALUE "CustomField3", "Custom field 3 value\0"
    }
  }
  BLOCK "VarFileInfo"
  {
    VALUE "Translation", 0x0809, 0x4b0
  }
}

... to be continued ...

Related Wiki Pages

External Links

PureBASIC Documentation:

MSDN:

Misc. Articles:

PureBASIC Forum:

  • PBF #69818 — "Understanding PB Compiler Toolchain"
  • PBF #46332 — "How to add version info resource from commandline?"
    • p353104@helpy explains how to locate the resource file created by PB IDE in %TMP% folder.