Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.exe is not a valid Win32 application on Windows XP

I'm using Visual Studio 2012 Professional and creating an installer by using Advanced installer (3rd party).

When I run the installed .exe on Windows XP, I get the following message:

<appName>.exe is not a valid Win32 application.

The installed executable works fine on both Windows 7 and 8.

How can I get the program to work on Windows XP?

like image 965
Rahul Shirphule Avatar asked May 09 '13 06:05

Rahul Shirphule


People also ask

How do I fix Setup exe is not a valid Win32 application in Windows XP?

The error not a valid Win32 application may be caused by the corrupt file during downloading. So, in order to fix the error that .exe is not a valid Win32 application, you can try to download the program again and reinstall it. And then run it and check whether the error not a valid Win32 application is solved.

How do I fix .exe is not a valid Win32 application?

Re-download the file from the original source where you got it in order to repair the issue. If it does not work, you may need to run the file with the help of using a different version of Windows or even MS-DOS. Sometimes or on rare occasions, Windows may report a bug as "not a valid Win32 application.

What is the meaning of Win32 application?

An application written for 32-bit Windows operating systems.


1 Answers

From the Visual Studio Command Prompt, run this command:

 Dumpbin.exe /headers c:\where\you\put\it\setup.exe

Where "setup.exe" is the setup EXE created by your installer creator. I'll post an example of the info you see that matters here:

OPTIONAL HEADER VALUES
             10B magic # (PE32)
            ...
            4.00 operating system version
            0.00 image version
            6.00 subsystem version              // <=== here!!
               0 Win32 version
            ...

The subsystem version number is important. VS2012 is the first version of Visual Studio that started setting this value to 6.00, the version number of Vista. Previous versions, as well as VS2012 when you target .NET 4.0 or earlier, will set this version number to 4.00

This is otherwise an important move ahead and part of phasing out support for XP. Windows version 6.00 and up, Vista, Win7 and Win8 pay attention to this number. They'll assume that your program is unaware of later Windows features and needs to have several appcompat shims turned on. The most notable one is appcompat in Aero, the desktop theme that displays windows with fat borders that are easy to click with a mouse. Windows will lie about those borders, telling you that your window is smaller than it actually is. A great source of confusion to programmers that try to make windows line up with each other.

The consequence of seeing 6.00 displayed is that your setup program cannot run on XP anymore. It is version 5.02.

So do make sure first that you do not target .NET version 4.5, it is not available for XP. Use 4.0 instead. If you still have trouble then contact the vendor's support and ask them how to control that number in the setup.exe file that the tool creates. A workaround is to run Editbin.exe with the /SUBSYSTEM option to change the number.

like image 147
Hans Passant Avatar answered Sep 25 '22 02:09

Hans Passant