问题描述
我写在纯粹的Win32 API的的Visual C ++程序。按我的理解,我需要单独编译生成的可执行文件为x86和x64架构。
I am writing an Visual C++ program in pure Win32 API. As per my understanding, I need to separately compile and generate executable for x86 and x64 architecture.
我如何将它们组合成一个可执行文件,并发射64在运行时?我见过的Sysinternals工具做同样的,但不知道如何使用编程方式完成。
How do I combine them into single executable and emit the x64 at runtime? I have seen Sysinternals tools doing the same , but don't know how it is done programmatically.
我一定要包括我的x64版本作为一种资源为86,然后写入文件系统,做CreateProcess的?
Do I have to include my x64 version as a resource into x86 and then write to filesystem and doCreateProcess ?
任何指针?
推荐答案
是的,他们嵌入操作系统特定的驱动程序作为一种资源。以下是从Visual Studio截图使用文件+开放+文件打开他们的Handle.exe工具之后:
Yes, they embed the operating specific driver as a resource. Here's a screenshot from Visual Studio after using File + Open + File to open their Handle.exe utility:
不完全知道它们是什么,但可以肯定看起来像他们涵盖Windows 9x中,32位和64位。接下来的事情,他们会做的是使用资源的API函数(FindResource,SizeofResource,LockResource)和WriteFile()资源的内容到一个文件中可写目录。然后装入的CreateService和StartService驱动程序。
Not exactly sure what they are but it certainly looks like they cover Windows 9x, 32-bit and 64-bit. Next thing they'd do is use the resource API functions (FindResource, SizeofResource, LockResource) and WriteFile() the resource content to a file in a writable directory. Then load the driver with CreateService and StartService.
主程序是86所以它可以运行在任何版本的Windows。在运行时生成的二进制文件不是一个非常友好客户的事顺便说一句,他们(和他们的病毒扫描程序)通常想知道从哪里是什么来的。
The main program is x86 so it runs on any version of Windows. Generating binaries at runtime isn't a very customer friendly thing to do btw, they (and their virus scanner) usually like to know what came from where.
这篇关于结合x86和x64可执行文件在单一的可执行(如Sysinternals的工具)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!