Version resource in DLL not visible with right-click
Asked Answered
C

4

14

I'm trying to do something which is very easy to do in the regular MSVC, but not supported easily in VC++ Express.

There is no resource editor in VC++ Express. So I added a file named version.rc into my DLL project. The file has the below content, which is compiled by the resource compiler and added to the final DLL. This resource is viewable in the DLL using reshacker, though not when right-clicking the DLL in Windows Explorer.

What is missing from my RC file to make it appear when right-clicking?

VS_VERSION_INFO VERSIONINFO
 FILEVERSION 1,0,0,1
 PRODUCTVERSION 1,0,0,1
 FILEFLAGSMASK 0x17L
#ifdef _DEBUG
 FILEFLAGS 0x1L
#else
 FILEFLAGS 0x0L
#endif
 FILEOS 0x4L
 FILETYPE 0x1L
 FILESUBTYPE 0x0L
BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "040904b0"
        BEGIN
            VALUE "FileDescription", "something Application"
            VALUE "FileVersion", "1, 0, 0, 1"
            VALUE "InternalName", "something"
            VALUE "LegalCopyright", "Copyright (C) 2008 Somebody"
            VALUE "OriginalFilename", "something.exe"
            VALUE "ProductName", "something Application"
            VALUE "ProductVersion", "1, 0, 0, 1"
        END
    END
    BLOCK "VarFileInfo"
    BEGIN
        VALUE "Translation", 0x409, 1200
    END
END
Conventicle answered 12/5, 2009 at 12:42 Comment(0)
D
14

The correct solution is to add to the top of your .rc file:

#include <windows.h>
Disembark answered 27/3, 2015 at 20:35 Comment(1)
#include <winres.h> is enoughChlor
C
21

I was able to see (using reshacker) one difference between my resource and resources that appear on right-click, and that was the name of the resource. So I changed VS_VERSION_INFO to 1; and now the resource is visible on right-click.

1 VERSIONINFO
 FILEVERSION 1,0,0,1
 PRODUCTVERSION 1,0,0,1
 FILEFLAGSMASK 0x17L
#ifdef _DEBUG
 FILEFLAGS 0x1L
#else
 FILEFLAGS 0x0L
#endif
 FILEOS 0x4L
 FILETYPE 0x1L
 FILESUBTYPE 0x0L
BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "040904b0"
        BEGIN
            VALUE "FileDescription", "something Application"
            VALUE "FileVersion", "1, 0, 0, 1"
            VALUE "InternalName", "something"
            VALUE "LegalCopyright", "Copyright (C) 2008 Somebody"
            VALUE "OriginalFilename", "something.exe"
            VALUE "ProductName", "something Application"
            VALUE "ProductVersion", "1, 0, 0, 1"
        END
    END
    BLOCK "VarFileInfo"
    BEGIN
        VALUE "Translation", 0x409, 1200
    END
END
Conventicle answered 17/5, 2009 at 8:30 Comment(7)
Great catch! I just ran into the same thing. Presumably the VS_VERSION_INFO symbol is defined somewhere else that isn't getting included from your (or mine) resource script.Unpriced
I defined it to equal 1 and it now works. Thank you! I wish I had found this answer earlier.Dysphemism
David's answer to his own question is right! And it is a great catch, specially when one is creating resource files without using Visual Studio. Perhaps that was why he, Jim Crafton and I have run into the exact same problem. Thanks David!Intravenous
Worth adding that rc.exe does not seem to be included in post 2005 versions of VC++ express...Tongue
From learn.microsoft.com: versionID Version-information resource identifier. This value must be 1.Thorsten
That little missing 1 at the start has burned me so many times over the years, #include declarations or not. This answer should really be the accepted answer.Quantifier
Thank you, this ended my 2 hour search for the same issue !Telegenic
D
14

The correct solution is to add to the top of your .rc file:

#include <windows.h>
Disembark answered 27/3, 2015 at 20:35 Comment(1)
#include <winres.h> is enoughChlor
D
4

Try changing your resources to:

 FILEFLAGSMASK 0x3fL

and

    BLOCK "040004e4"

and

VALUE "Translation", 0x400, 1252
Defy answered 12/5, 2009 at 13:54 Comment(4)
Then find out which of your libs already link to a version resource. You're already linking to a version resource (now you have to find out which one and which file/lib does this).Defy
Try to disable incremental linking: Project properties->Linker->Common->Enable Incremental Linking Or a rebuild might also help.Defy
I've deleted my comments, now that the question was rephrased.Conventicle
I'm so sorry; I rewrote my question and didn't notice that you had rewritten your answer!Conventicle
T
1

I will expand @Stefan answer, according to: StringFileInfo BLOCK statement

Defines a string information block. syntax

BLOCK "StringFileInfo" { BLOCK "lang-charset" {VALUE "string-name", "value" . . . }}

Parameters

lang-charset

Language and character-set identifier pair. It is a hexadecimal string consisting of the concatenation of the language and character-set identifiers specified in the Remarks section.

My case is that I was using the wrong lang-charset and that's why the version details was not showing the version info, this is the correct one:

BLOCK "040904E4"
....
BLOCK "VarFileInfo"
  BEGIN
    VALUE "Translation", 0x409, 1252
  END

Here the list of language codes and character set

Troth answered 15/8, 2020 at 4:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.