Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » External resources » On Windows: Creating VERSIONINFO for your binaries...
On Windows: Creating VERSIONINFO for your binaries... [message #11526] Sun, 16 September 2007 17:18 Go to previous message
tvanriper is currently offline  tvanriper
Messages: 85
Registered: September 2007
Location: Germantown, MD, USA
Member
I noticed no topic regarding this subject in the forum, and figured some folks might want some information about it here, rather than having to hunt around for it.

I'll describe a fairly simple way to provide version information for your Windows application, such that one can right-click on the executable in Windows Explorer, and click 'Properties' to see what version of the product they're running. Note that if you intend to use MSI (Microsoft Installer) to install your application, you will need this if you want to properly support patching your product.

The linker links your file version information from resources. This means you need to create a resource file bearing your file version information. Note that you also need to do this to have your application show an icon for itself in Windows Explorer. To include a resource file in your project in TheIDE, just tap Ctrl-I (or right-click in the files area and select 'Insert any file(s)...'), then type in any filename ending with ".rc". TheIDE is smart enough to know that this is a resource file, and will run your resource compiler for this file.

The version information block should look much like this:

#include <windows.h>

VS_VERSION_INFO VERSIONINFO
FILEVERSION 1, 0, 0, 1
PRODUCTVERSION 1, 0, 0, 1
#ifdef DEBUG
FILEFLAGSMASK VS_FF_DEBUG | VS_FF_PRERELEASE
#else
FILEFLAGSMASK 0
#endif
FILEOS VOS__WINDOWS32
FILETYPE VFT_APP
FILESUBTYPE VFT2_UNKNOWN
BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "040904b0"
        BEGIN
            VALUE "Comments", "My Super Amazing Application\0"
            VALUE "CompanyName", "Cheese Olfactory Workshop\0"
            VALUE "FileDescription", "Provides a /dev/null device for Windows.\0"
            VALUE "FileVersion", "1.00.00.01\0"
            VALUE "InternalName", "DEVNULL\0"
            VALUE "LegalCopyright", "Copyright (C) 1967-2007, Cheese Olfactory Workshop, All rights reserved\0"
            VALUE "OriginalFilename", "devnull.exe\0"
            VALUE "ProductName", "DevNull\0"
            VALUE "ProductVersion", "1.00.00.01\0"
        END
    END
    BLOCK "VarFileInfo"
    BEGIN
        VALUE "Translation", 0x0409, 0x04B0
    END
END


Notice the trailing \0 characters... those are important. Without them, you won't have a proper information block, and while the numeric fields seem to be in place, nobody can see the string information (they'll be dropped, I think).

Also notice that I've included Windows.h. This allows you to use the VS_FF_DEBUG, VS_FF_PRERELEASE, VOS__WINDOWS32, VFT_APP, and VFT2_UNKNOWN 'keywords'. If you do not want to include windows.h, you'll have to figure out these values for yourself.

If you're making a DLL instead of an EXE, you want VFT_APP to be changed to VFT_DLL.

If your application is intended to run on specific OSes (not just any WIN32 machine), you might want to change VOS__WINDOWS32 to something more specific. You can choose from the following:

  • VOS_UNKNOWN The operating system for which the file was designed is unknown.
  • VOS_DOS File was designed for MS-DOS.
  • VOS_NT File was designed for Windows Server 2003 family, Windows XP, Windows 2000, or Windows NT.
  • VOS__WINDOWS16 File was designed for 16-bit Windows.
  • VOS__WINDOWS32 File was designed for 32-bit Windows.
  • VOS_DOS_WINDOWS16 File was designed for 16-bit Windows running with MS-DOS.
  • VOS_DOS_WINDOWS32 File was designed for 32-bit Windows running with MS-DOS.
  • VOS_NT_WINDOWS32 File was designed for Windows Server 2003 family, Windows XP, Windows 2000, or Windows NT.


You can find more detailed information on this subject at Microsoft's web site. At the moment, this URL seems to present the topic nicely:

http://msdn2.microsoft.com/en-us/library/aa381058.aspx
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: an efficient embedded database library
Next Topic: flashcc - Compile your C++ code to run in Flash Player
Goto Forum:
  


Current Time: Sat Apr 20 07:43:38 CEST 2024

Total time taken to generate the page: 0.03698 seconds