Jump to content
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble

MSFN is made available via donations, subscriptions and advertising revenue. The use of ad-blocking software hurts the site. Please disable ad-blocking software or set an exception for MSFN. Alternatively, register and become a site sponsor/subscriber and ads will be disabled automatically. 


Sign in to follow this  
smeezekitty

Why "Not a valid win32 application?" XP+ programs

Recommended Posts

I tried a Windows XP only program on Windows 2000 and got "Not a valid Win32 Application"

 

Now I fully expected to get DLL errors but I was surprised by that message. In fact I even re-downloaded

it because I thought it may have gotten corrupted but the result was the same.

 

Did something change in Windows EXEs that make them show that message?

Share this post


Link to post
Share on other sites

This info applies to running 9x/ME in 2k/XP, so it's probably not related.

As you can see, "Not a valid Win32 Application", may not actually mean literally that.

I doubt you error is caused by the same issues described in the link I jus gave you.

But, at the moment, it's the best I can offer. HTH

Share this post


Link to post
Share on other sites

Blackwingcat could possibly answer this as that was the firstish thing he found a way around when he created his Kernel Extension (v2) for Windows 2000, and that was to stop the Win32 errors from happening.

Share this post


Link to post
Share on other sites

this happens when an application is compiled to be used at least under XP (_WIN32_WINNT is defined as 0x0501):

 

 

Setting WINVER or _WIN32_WINNT

You can define these symbols by using the #define statement in each source file, or by specifying the /D compiler option supported by Visual C++.

For example, to set WINVER in your source file, use the following statement:

#define WINVER 0x0502

To set _WIN32_WINNT in your source file, use the following statement:

#define _WIN32_WINNT 0x0502

To set _WIN32_WINNT using the /D compiler option, use the following command:

cl -c /D_WIN32_WINNT=0x0502 source.cpp

 

http://msdn.microsoft.com/en-us/library/windows/desktop/aa383745%28v=vs.85%29.aspx

Share this post


Link to post
Share on other sites

Blackwingcat could possibly answer this as that was the firstish thing he found a way around when he created his Kernel Extension (v2) for Windows 2000, and that was to stop the Win32 errors from happening.

Ok

 

Maybe He will stop by?

 


this happens when an application is compiled to be used at least under XP (_WIN32_WINNT is defined as 0x0501):

But what is changed in the executable that throws that message? And can it be changed with a hex editor maybe?

Share this post


Link to post
Share on other sites

This batch can set those values to 5.0 for you, provided you have the linker from MSVS 6 (I used v. 6.0.8447.0, from MSVC6 SP3)..
 

@echo offif %1sz==sz goto erroucopy %1 %1_oriren *.*_ori *.oriLINK /EDIT %1 /SUBSYSTEM:WINDOWS,5.00 /OSVERSION:5.00 /VERSION:5.00goto finis:errouecho usage: 44460 filename.extecho.:finis

Of course, there'll be many possible improvements to the above batch.

Share this post


Link to post
Share on other sites

But... but... but... doesn't ImportPatcher apply just for 9x/ME? Would it work also for 2k?

Would you perhaps elaborate some more, please? 

Share this post


Link to post
Share on other sites

ImportPatcher is built using VC5 so should run on Win95+ and NT4+, maybe even win32s and NT3.5. It will check (and can correct) the OS subversion (target platform) of any PE32 file. IP37 and IP38 will auto-target to the current (reported) OS version.

Polish Jack1024's PEInfo.exe 0.9.1.1 (d7p) is also very good for editing PE32 header values.

Share this post


Link to post
Share on other sites

Polish Jack1024's PEInfo.exe 0.9.1.1 (d7p) is also very good for editing PE32 header values.

PEinfo.exe did the trick!

 

I changed Minor version number of required OS

and Minor version number of subsystem from 1 to 0

Share this post


Link to post
Share on other sites

Hi.

 

http://blog.livedoor.jp/blackwingcat/archives/1452362.html

I released before VC++2005 for Windows 95 Library.

You should patch PE Header for Windows 4.x  after you compile and link.

 

 

Polish Jack1024's PEInfo.exe 0.9.1.1 (d7p) is also very good for editing PE32 header values.


PEinfo.exe did the trick!
 
I changed Minor version number of required OS
and Minor version number of subsystem from 1 to 0

 

Share this post


Link to post
Share on other sites

Windows 98 actually provided a second more informative message in such a case: EXE expects a never version of Windows. Upgrade your Windows version.

It is not often that 9x does something better than NT. :)

I've previously used Stud_PE to adjust this header.

  • Upvote 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×