c++资源中的 Visual Studio 2010 exe 得到重新设置吗?

发布于 2024-12-06 10:12:19 字数 292 浏览 1 评论 0原文

有没有人注意到,如果你导入一个 exe 作为资源,它会被重新设置基础,并且它的 PE 标头也会被重建?

有时这很令人恼火。有谁知道如何禁用变基!?

在 C++ 中重现的步骤:

1) 编译一个 hello world 并手动将其基地址(在属性中)设置为 0x1000000

2) 创建第二个项目并将 hello world 包含到资源中。也如上手动设置其基地址。

3)构建第二个项目

4)从资源中提取exe并使用Pe编辑器检查它!它被设置回 0x400000。为什么?!

Has anyone noticed that if you import an exe as resource it gets rebased and also seems that its PE header gets rebuilt?

There are times that this is irritating. Does anybody knows how to disable the rebasing!?

steps to reproduce in c++:

1) compile a hello world and manually set its base address (in properties) to lets say 0x1000000

2) make a second project and include the hello world into resources. Also manually set its base address as above.

3) build second project

4) extract the exe from resources and check it with a Pe editor! it gets set back to 0x400000. Why?!

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

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

发布评论

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

评论(2

薄暮涼年 2024-12-13 10:12:19

您如何将 EXE 作为资源包含到第二个项目中?

使用这些定义:

#define BINFILE 222
#define IDR_MYFILE 101

如果我将 .rc 文件中的可执行文件引用为指向原始文件,例如:

IDR_MYFILE BINFILE "S:\\mysource\\t1\\Release\\t1.exe"

然后,在提取时,我的嵌入式 EXE 资源不会重新设置基础,而是保留我构建它所用的资源。

How are you including the EXE as a resource into the second project?

Using these defines:

#define BINFILE 222
#define IDR_MYFILE 101

If I reference the executable in my .rc file as pointing to the original file, e.g.:

IDR_MYFILE BINFILE "S:\\mysource\\t1\\Release\\t1.exe"

Then, upon extraction, my embedded EXE resource is not rebased, but maintains what I had built it with.

沫雨熙 2024-12-13 10:12:19

您可能对二进制生成器感兴趣,它将您的 exe 文件隐藏为 const unsigned char [] 数组。
这样,VisualStudio 将没有机会窥探您的资源。

例如,这个:
http://sourceforge.net/projects/juce /files/juce/1.52/prebuilt%20binaries/BinaryBuilder.exe/download

You might be interested in a binary builder that'll covert your exe file as a const unsigned char [] array.
That way, VisualStudio will not have a chance to snoop into your resources.

For example, this one:
http://sourceforge.net/projects/juce/files/juce/1.52/prebuilt%20binaries/BinaryBuilder.exe/download

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