Skip to content

Instantly share code, notes, and snippets.

@jpluimers
Created February 27, 2017 19:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpluimers/8915bc53689e6c5037e975a44d4628c3 to your computer and use it in GitHub Desktop.
Save jpluimers/8915bc53689e6c5037e975a44d4628c3 to your computer and use it in GitHub Desktop.
RC example for Delphi
// Assemble the VersionInfo resource from the previously information included/provided by the .RC file for the project.
#ifndef PRIVATEBUILD
#define VER_PRIVATEBUILD VS_FF_RELEASE
#else
#define VER_PRIVATEBUILD VS_FF_PRIVATEBUILD
#endif
#ifndef PRERELEASE
#define VER_PRERELEASE VS_FF_RELEASE
#else
#define VER_PRERELEASE VS_FF_PRERELEASE
#endif
#ifndef DEBUG
#define VER_DEBUG VS_FF_RELEASE
#else
#define VER_DEBUG VS_FF_DEBUG
#endif
VS_VERSION_INFO VERSIONINFO
FILEVERSION VER_FILEVERSION
PRODUCTVERSION VER_PRODUCTVERSION
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
FILEFLAGS (VER_PRIVATEBUILD|VER_PRERELEASE|VER_DEBUG)
FILEOS VOS__WINDOWS32
FILETYPE VFT_APP // or VFT_DLL
FILESUBTYPE VFT_UNKNOWN
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "080904B0"
BEGIN
// VALUE "Comments", "\0\0"
VALUE "CompanyName", VER_COMPANYNAME_STR
VALUE "FileDescription", VER_FILEDESCRIPTION_STR
VALUE "FileVersion", VER_FILEVERSION_STR
VALUE "InternalName", VER_INTERNALNAME_STR
VALUE "LegalCopyright", VER_LEGALCOPYRIGHT_STR
// LegalTrademarks Trademarks and registered trademarks that apply to the file. This should include the full text of all notices, legal symbols, trademark numbers, and so on. This string is optional.
VALUE "LegalTrademarks1", VER_LEGALTRADEMARKS1_STR
VALUE "LegalTrademarks2", VER_LEGALTRADEMARKS2_STR
VALUE "OriginalFilename", VER_ORIGINALFILENAME_STR
#ifdef PRIVATEBUILD
// VALUE "PrivateBuild" "\0\0"
#endif
VALUE "ProductName", VER_PRODUCTNAME_STR
VALUE "ProductVersion", VER_PRODUCTVERSION_STR
// VALUE "SpecialBuild" "\0\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x809,1200
END
END
// Copyrights used by the verious Suite projects
#define VER_SUITECOPYRIGHT_STR "Copyright \251 2001-2017 Copyrightholder\0\0"
#define VER_SUITETESTSCOPYRIGHT_STR "Copyright \251 2016-2017 Copyrightholder\0\0"
// Name information used by all Suite projects
#define VER_SUITECOMPANYNAME_STR "Suite company name\0\0"
#define VER_SUITEPRODUCTNAME_STR "Suite product name\0\0"
// Resources for SuiteTestsProject
#include "SuiteCopyrightsForResources.inc"
#include "SuiteNamesForResources.inc"
#include "SuiteVersionNumberForResources.inc"
#include "VsVersionForResources.inc"
#define VER_COMPANYNAME_STR VER_SUITECOMPANYNAME_STR
#define VER_FILEDESCRIPTION_STR "Suite Unit Tests\0\0" ///////////////////// modify for each suite part
#define VER_FILEVERSION VER_SUITEVERSION
#define VER_FILEVERSION_STR VER_SUITEVERSION_STR
#define VER_INTERNALNAME_STR "SuiteTestsProject\0\0" //////////////////// modify for each suite part
#define VER_LEGALCOPYRIGHT_STR VER_SUITETESTSCOPYRIGHT_STR
#define VER_LEGALTRADEMARKS1_STR "\0\0"
#define VER_LEGALTRADEMARKS2_STR "\0\0"
#define VER_ORIGINALFILENAME_STR "SuiteTestsProject.exe\0\0" //////////////// modify for each suite part
#define VER_PRODUCTNAME_STR VER_SUITEPRODUCTNAME_STR
#define VER_PRODUCTVERSION VER_SUITEVERSION
#define VER_PRODUCTVERSION_STR VER_SUITEVERSION_STR
#include "SuiteAssembleVersionInfoResource.inc"
// Version information used by all Suite projects
#define VER_SUITEVERSION 1,2,3,45
#define VER_SUITEVERSION_STR "1.2.3.45\0\0"
// comments https://msdn.microsoft.com/en-us/library/windows/desktop/aa380896.aspx
// 1200 -> 0x04B0 (Unicode)
// 0x0809 -> 1057 (U.K. English)
// 0x0409 -> 1033 (U.S. English)
// 1252 -> 0x04E4 (Codepage 1252 - Multilingual)
// VS_VERSION_INFO resource https://msdn.microsoft.com/en-us/library/windows/desktop/aa381058.aspx
// StringFileInfo block https://msdn.microsoft.com/en-us/library/windows/desktop/aa381049.aspx
// VarFileInfo block https://msdn.microsoft.com/en-us/library/windows/desktop/aa381057.aspx
///* ----- VS_VERSION.dwFileFlags ----- */
#define VS_FF_RELEASE 0x00000000L
#define VS_FF_DEBUG 0x00000001L
#define VS_FF_PRERELEASE 0x00000002L
#define VS_FF_PATCHED 0x00000004L
#define VS_FF_PRIVATEBUILD 0x00000008L
#define VS_FF_INFOINFERRED 0x00000010L
#define VS_FF_SPECIALBUILD 0x00000020L
#define VS_FFI_FILEFLAGSMASK 0x0000003FL
///* ----- VS_VERSION.dwFileOS ----- */
#define VOS_UNKNOWN 0x00000000L
#define VOS_DOS 0x00010000L
#define VOS_OS216 0x00020000L
#define VOS_OS232 0x00030000L
#define VOS_NT 0x00040000L
#define VOS_WINCE 0x00050000L
#define VOS__BASE 0x00000000L
#define VOS__WINDOWS16 0x00000001L
#define VOS__PM16 0x00000002L
#define VOS__PM32 0x00000003L
#define VOS__WINDOWS32 0x00000004L
#define VOS_DOS_WINDOWS16 0x00010001L
#define VOS_DOS_WINDOWS32 0x00010004L
#define VOS_OS216_PM16 0x00020002L
#define VOS_OS232_PM32 0x00030003L
#define VOS_NT_WINDOWS32 0x00040004L
///* ----- VS_VERSION.dwFileType ----- */
#define VFT_UNKNOWN 0x00000000L
#define VFT_APP 0x00000001L
#define VFT_DLL 0x00000002L
#define VFT_DRV 0x00000003L
#define VFT_FONT 0x00000004L
#define VFT_VXD 0x00000005L
#define VFT_STATIC_LIB 0x00000007L
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment