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

查看:349
本文介绍了如何将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?

推荐答案

您无法创建包含 x86 x64的单个可执行文件代码。但是,您可以创建单独的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天全站免登陆