Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an executable that works fine when run on 32-bit windows but breaks when run on 64-bit windows.

Is there some way I can force it to run in 32-bit mode on a 64-bit machine?

I don't have access to the source code.

share|improve this question
This doesn't make much sense. Unless the software has some code which explicitly makes it fail if not run on a 64bit machine. 32 bit runs fine on 64bit, the issue comes the other way round (running 64bit on 32bit). Do you get an error message? – Dave Sep 27 '12 at 9:25
Is this code you have written (in which case Stack Overflow is the place to ask - with the code and error messages), or is it someone else's program you are running? It would help if you included any error messages you're getting. – ChrisF Sep 27 '12 at 9:27
up vote 8 down vote accepted

How technical an answer do you want? You can probably force the exe to always run 32bit with a few SDK tools, but it does require a little work.

The easy answer is to launch from a 32bit process (eg. use %SystemRoot%\SYSWOW64\cmd.exe to launch).

The more complex is to check what kind of exe it is, then modify it yourself. Background here is to understand that compiled code from languages that directly work with the Windows APIs are created as 32bit or 64bit at compile time by the developer. This cannot then be changed without going back to the source code.

However increasingly applications are written via a virtualisation layer that makes writing applications easier. There are two common ones: .NET and Java. I'm not sure about Java except knowing that forcing the right Java runtime install with solve the problem.

For .NET you can use SDK tools to:

  • Validate that the application is "AnyCPU": corflags myExe.exe. Using a utility from the .NET SDK to read the headers of a .NET assembly, for an exe will return something like:
Version   : v4.0.30319
CLR Header: 2.5
PE        : PE32
CorFlags  : 0x20003
ILONLY    : 1
32BITREQ  : 0
Signed    : 0

the 32BITREQ tells me this is AnyCPU because 32bit is not required.

  • Use corflags with its /32BITREQ+ option to modify the exe to be 32bit only.
share|improve this answer
+1 The .Net AnyCPU setting was my first thought. All it takes is an unaware programmer to not specify this setting properly. It's great to hear there's a way to fix it after it's compiled. – Hand-E-Food Sep 27 '12 at 10:46
I tried launching it from %SystemRoot%\SYSWOW64\cmd.exe and it failed in the same way - showing an error message - and when I check in TaskManager my exe process doesn't show as a 32-bit process – Rory Sep 27 '12 at 16:40
As Dave asked above, what exact error message do you get? – Karan Sep 27 '12 at 17:41
Launching a managed AnyCPU EXE from SYSWOW64\cmd.exe still causes it to be run as a 64-bit process (I just tried it). – Carl Walsh Oct 7 '15 at 1:19

If you have windows 7 professional (or higher), then use the virtual XP mode from Microsoft

this emulates(?) a 32 bit environment, and it has proved useful for getting some old 16 bit programs to run

share|improve this answer

Tried everything and nothing worked. but then thought about moving gta iv directory from the C/program files(x86) to C/program files and it work since x86 is for 32bit apps(I think) but worked anyway.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .