Search code examples
winapiwow64

How do I prevent my Win32 process starting on WOW64?


I've got a Win32 process that is compiled and packaged in both 32-bit (x86) and 64-bit (x64) variants. I'd like the x86 variant to refuse to run on a 64-bit version of Windows (i.e. WOW64).

Is there any way to do this by setting linker flags? If not, what do I need to do?


Solution

  • You can check whether you're running under emulation by calling IsWow64Process. Note, that you may need to load the function dynamically if you want to support older versions the OS.