3

I'm trying to use 'Comment' field of VERSIONINFO resource. The target program is 64-bit windows EXE file (compiled with VS 2015).

All elements like version, copyright, description and so on are shown correctly - except "Comments". I define it just like other elements of StringFileInfo block. Something like that:

VS_VERSION_INFO VERSIONINFO
FILEVERSION     FILEVER
PRODUCTVERSION  PRODUCTVER

FILEFLAGSMASK   VS_FFI_FILEFLAGSMASK
#ifdef _DEBUG
FILEFLAGS VS_FF_DEBUG
#else
FILEFLAGS 0x0L
#endif

FILEOS          VOS__WINDOWS32
FILETYPE        VFT_APP
BEGIN
   BLOCK "StringFileInfo"
   BEGIN
      BLOCK "000004b0"
      BEGIN
         VALUE "FileDescription",  PROGRAM_NAME
         VALUE "LegalCopyright",   COPYRIGHT_NOTE 
         VALUE "CompanyName",      "My Company\0"
         VALUE "FileVersion",      STRFILEVER
         VALUE "ProductName",      STRPRODUCTNAME
         VALUE "ProductVersion",   STRPRODUCTVER
         VALUE "InternalName",     "program\0"
         VALUE "OriginalFilename", "program.exe\0"
         VALUE "Comments",         "A comment to show\0"
      END
   END
   BLOCK "VarFileInfo"
   BEGIN
     VALUE "Translation", 0x0000, 0x04b0
   END
END

When I display version info with PowerShell, like this:

 (dir *.exe).VersionInfo|fl

empty "Comments" are displayed.

I also sigcheck program from SysInternals:

sigcheck -a .\program.exe

It displays:

...
Comments:       n/a
...

"N/A" ? Does it mean I need to set some special flags, or something to get Comments shown?

macmac
  • 119
  • 8
  • Unable to reproduce, I get "A comment to show". Using VIsual C++ 2015 32-bit. – Cheers and hth. - Alf Feb 10 '16 at 11:16
  • Maybe it is the utilities you're using that are at fault? What if you loaded the EXE as a resource in Visual Studio? Do you see the comments? I know that Windows Explorer does not give you the entire version information block, so it wouldn't be surprising if other utilities only give you partial information. – PaulMcKenzie Feb 10 '16 at 11:16
  • Also tested with 64-bit Visual C++ 2015, works OK. – Cheers and hth. - Alf Feb 10 '16 at 11:24
  • I tried loading .EXE as resource into VS and it shows empty string too. Maybe the problem is that I don't compile it using VS project - it is cross-platform project compiled and linked from command line and maybe resource compiler is run with different options. I run 'rc /x /fo program.res program.rc'. is set of /I"path" switches that point to necessary include paths. This can probably be the case. I must check how VS calls 'rc' it from its "native" projects. What is strange for me is that "Comments" field is somehow "special" here - other fields look fine – macmac Feb 10 '16 at 11:34

1 Answers1

0

To make it work I had to add /D _UNICODE /D UNICODE to resource compiler command line:

rc.exe /D _UNICODE /D UNICODE ....

With such command line - Comments are there! Looks strange to me that it is required only for Comments, while other predefined fields do not require it. Anyway - thank you guys for hint - I had a look how VS does it.

macmac
  • 119
  • 8