An Experiment in Supporting XP Console Subsystem via Hex Edit Patching

Since at least Visual Studio 2012 Win32 C++ programs compiled by Visual Studio by default do not run on 32-bit Windows XP, unless the following Linker command line option is added:


Attempting to run a program compiled without this option on XP will result in “not a valid Win32 application” error


Some more info:

Windows XP Targeting with C++ with VS 2012

Without this option provided to linker the compiled EXE will only run on Windows Vista or later…

We can see the minimum subsystem version, which matches to OS version number in the executables header:


However there is also an additional difference, in the PE File Header. This would appear to be the time stamp, because these files were compiled at different times. This was confirmed using the free tool PEBrowse Professional 64 (Which can open x86 binaries)

Vista Version


XP Version


So I patch this to version suitable for XP (5.01) by changing the 06 00 00 to 05 00 01 in the file header in two locations (I am using free Hex Editor here ):


Ok the patched file works fine on Windows 8.1.


Now on Windows XP:

As expected, the EXE compiled for Vista subsystem fails with <EXE> is not a valid Win32 application


Our patched EXE launches on XP fine


It is likely additional patching would be required on more complex programs, but proves it may be possible in some cases to easily patch a binary to make it run on Windows XP if necessary.

But please…get rid of XP if you still use it :)

About chentiangemalc

specializes in end-user computing technologies. disclaimer 1) use at your own risk. test any solution in your environment. if you do not understand the impact/consequences of what you're doing please stop, and ask advice from somebody who does. 2) views are my own at the time of posting and do not necessarily represent my current view or the view of my employer and family members/relatives. 3) over the years Microsoft/Citrix/VMWare have given me a few free shirts, pens, paper notebooks/etc. despite these gifts i will try to remain unbiased.
This entry was posted in Hacking. Bookmark the permalink.

One Response to An Experiment in Supporting XP Console Subsystem via Hex Edit Patching

  1. Cockfork says:

    I don’t want to get rid of my XP dude.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s