适用于 32 位和 64 位的单个可执行文件(不含 WOW64)

发布于 2024-08-20 05:55:22 字数 318 浏览 3 评论 0原文

我正在编写一个应该在 16\32\64 位系统上运行的小实用程序。 我的旧实用程序通过将 16 位版本压缩为 32 位并在 Visual Studio 2008 中应用 /stub 开关 (/STUB -MS-DOS 存根文件名 )。

我正在寻找一种方法来对我的 64 位可执行文件执行相同的操作。 目标64位系统是Win PE 64位,并且没有安装WOW64。

是否可以?

I'm writing a small utility that should run on both 16\32\64 bit systems.
My old utility ran both on 32 and 16 bit by compressing the 16bit version to the 32 bit and applying the /stub switch in visual studio 2008 (/STUB -MS-DOS Stub File Name ).

I'm looking for a way to do the same with my 64 bit executable.
The target 64bit system is Win PE 64bit and it doesn't have the WOW64 installed on it.

Is it possible?

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

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

发布评论

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

评论(3

分分钟 2024-08-27 05:55:22

Windows 可执行文件的 DOS 存根使用 MZ 部分,而 32 位和 64 位可执行文件都使用 PE 部分。这允许 DOS 存根存在于任一 Windows 可执行文件中,但在尝试组合 32 位和 64 位可执行文件时会导致冲突。

The DOS stub of Windows executables uses the MZ section, whereas both 32-bit and 64-bit executables use the PE section. This allows the DOS stub to exist within either Windows executable, but causes a collision when trying to combine 32- and 64-bit executables.

离笑几人歌 2024-08-27 05:55:22

您应该将 32 位和 64 位 util 打包到另一个 exe 的资源中,我们将其称为 32 位启动器。
然后您的启动器应该检测它是从哪个系统启动的,然后从其资源中提取正确的二进制文件并启动它。

You should pack your 32 and 64 bit util in resources of another exe, let's call it launcher 32 bit.
Then your launcher should detect on what system it is started from and then extract proper binary from it's resources and start it.

遮云壑 2024-08-27 05:55:22

Windows 32位通过wowexec.exe运行16位应用程序,Win64通过wow64运行32位应用程序。因此,如果没有 wow64,您的程序就不可能在 Windows 上创建通用启动器。 (注意:Mac OSX 无论如何都支持单个二进制文件中的多个体系结构)

我能想到的最好方法是创建一个 MSI 安装程序包并将两个 32/64 exe 放入其中。

Windows 32-bit runs 16-bit applications by wowexec.exe, and Win64 runs 32-bit application by wow64. So without wow64 it's impossible for your program to create a universal launcher on Windows. (Note: Mac OSX supports multiple architecture in single binary anyway)

The best approach I can figure out is to create a single MSI installer package and put both 32/64 exes into it.

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