Doing it yourself in C
There are ways to implement this kind of thing in C/C++ described here and here. Basically you do the following:
- Add your 32-bit and 64-bit executables as binary PE resources to a 32-bit bootstrapper executable. You can do this using any PE resource editor including Visual Studio if that's what you're using.
- The bootstrapper uses the
IsWow64Process
API to decide whether it is running on a 64bit system or not.
- The bootstrapper extracts the correct executable file from its resources using the resource APIs
- The bootstrapper writes the executable file to a temporary file and executes it.
This is pretty much what I had to do for an old project, and offers you the most control and flexibility. But if you just want quick and dirty...
Making AutoIT do it for you!
I also found this guide to compiling an AutoIT script which basically does all of the above for you! Neat, eh?
I will reproduce the AutoIT script here in case the link disappears:
; Check if we’re on 64-bit OS…
If EnvGet(“PROCESSOR_ARCHITEW6432″)=”” Then
; No we’re not – run x86 version…
FileInstall(“D:\Support\ETrustCheck_x86.exe”,@TempDir & “\ETrustCheck_x86.exe”)
RunWait(“D:\Support\ETrustCheck_x86.exe”,@TempDir & “\ETrustCheck_x86.exe”)
FileDelete(@TempDir & “\ETrustCheck_x86.exe”)
Else
; Yes we are – run x64 version..
FileInstall(“D:\Support\ETrustCheck_x64.exe”,@TempDir & “\ETrustCheck_x64.exe”)
RunWait(“D:\Support\ETrustCheck_x86.exe”,@TempDir & “\ETrustCheck_x64.exe”)
FileDelete(@TempDir & “\ETrustCheck_x64.exe”)
EndIf
; The END
This script can be wrapped by the AutoIT script editor into 32bit launcher with your two executables packed into it.