如何将 64 位和 32 位可执行文件绑定为一个? [英] How to bind 64-bit and 32-bit executable into one?

查看:39
本文介绍了如何将 64 位和 32 位可执行文件绑定为一个?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,所以我的想法是将 64 位和 32 位 Windows 可执行文件绑定到一个应用程序中,这样如果它不运行 64 位版本,它就会尝试 32 位版本.

Alright so my idea was some way to bind both 64-bit and 32-bit Windows executables into one application so if it doesn't run the 64-bit version it would then try the 32-bit one.

我正在阅读有关 PE 的内容,并了解了一些关于 MS-DOS 实模式存根的知识,它说明了它如何调用应用程序(通常是错误消息).但是每次我尝试研究 MS-DOS 实模式存根时,它似乎只显示错误消息.所以我的想法是用我的 32 位应用程序覆盖 STUB.

I was reading up about PE's and learned a little about MS-DOS Real Mode Stub and it says how it invokes an application (usually an error message). But every time I tried to do research about MS-DOS Real Mode Stub it seemed to only show error messages. So my idea was to overwrite the STUB with my 32-bit application.

我自己天真地认为,当 32 位操作系统运行 64 位可执行文件时,它会失败,然后运行存根文件.

My self being naive figured when the 32-bit operating system would run the the 64-bit executable it would fail and then run the stub file.

有什么办法可以让我的可执行文件独立于 32 位/64 位吗?

Is there any way to make my executable 32-bit/64-bit independent?

推荐答案

您无法创建包含 x86x64 代码的单个可执行文件.但是,您可以创建单独的 32 位和 64 位应用程序,将 x64 应用程序打包到 x86 应用程序资源中.在程序启动时,您可以检查您是否正在使用 IsWow64Process 运行 x64 环境,然后如果需要,解压您的 x64 版本并运行它

You could not create a single executable file, containing both x86 and x64 code. However you could create separate 32bit and 64bit applications, pack x64 app into the x86 app resources. On the program start you could check, that you are running x64 environment using IsWow64Process then if needed, unpack your x64 version and run it instead

这篇关于如何将 64 位和 32 位可执行文件绑定为一个?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆