右键单击 DLL 中的版本资源不可见

发布于 2024-07-19 08:10:43 字数 1058 浏览 5 评论 0原文

我正在尝试做一些在常规 MSVC 中很容易完成但在 VC++ Express 中不容易支持的事情。

VC++ Express 中没有资源编辑器。 因此,我将一个名为 version.rc 的文件添加到我的 DLL 项目中。 该文件具有以下内容,由资源编译器编译并添加到最终的DLL中。 使用 reshacker 可在 DLL 中查看此资源,但在 Windows 资源管理器中右键单击 DLL 时则看不到该资源。

我的 RC 文件中缺少什么才能使其在右键单击时出现?

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

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

梦里南柯 2024-07-26 08:10:43

我能够(使用 reshacker)看到我的资源和右键单击时出现的资源之间的一个区别,那就是资源的名称。 所以我把VS_VERSION_INFO改为1; 现在右键单击该资源即可看到。

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

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
2024-07-26 08:10:43

正确的解决方案是添加到 .rc 文件的顶部:

#include <windows.h>

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

#include <windows.h>
寄居人 2024-07-26 08:10:43

尝试将您的资源更改为

 FILEFLAGSMASK 0x3fL

    BLOCK "040004e4"

VALUE "Translation", 0x400, 1252

Try changing your resources to:

 FILEFLAGSMASK 0x3fL

and

    BLOCK "040004e4"

and

VALUE "Translation", 0x400, 1252
清君侧 2024-07-26 08:10:43

我将根据以下内容扩展@Stefan的答案:StringFileInfo BLOCK语句< /a>

定义字符串信息块。 语法

BLOCK "StringFileInfo" { BLOCK "lang-charset" {VALUE "字符串名称",
“价值” 。 。 。 }}

参数

lang-charset

语言和字符集标识符对。 它是一个十六进制字符串,由语言和
备注部分中指定的字符集标识符。

我的情况是我使用了错误的lang-charset,这就是版本详细信息未显示版本信息的原因,这是正确的一:

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

此处语言代码列表和字符集

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文