Version resource in DLL not visible with right-click

丶灬走出姿态 提交于 2019-12-28 15:25:05

问题


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

回答1:


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

#include <windows.h>



回答2:


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



回答3:


Try changing your resources to:

 FILEFLAGSMASK 0x3fL

and

    BLOCK "040004e4"

and

VALUE "Translation", 0x400, 1252


来源:https://stackoverflow.com/questions/852568/version-resource-in-dll-not-visible-with-right-click

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!