Print Page | Close Window

EXEs created by VisualStudio2008 vs Win4.0

Printed From: Sysinternals
Category: Windows Discussions
Forum Name: Development
Forum Description: Windows development problems, techniques and questions
URL: https://forum.sysinternals.com/forum_posts.asp?TID=14431
Printed Date: 21 August 2017 at 2:50am
Software Version: Web Wiz Forums 11.06 - http://www.webwizforums.com


Topic: EXEs created by VisualStudio2008 vs Win4.0
Posted By: steelbytes
Subject: EXEs created by VisualStudio2008 vs Win4.0
Date Posted: 21 April 2008 at 7:21am
EXEs and DLLs created by Visual Studio 2008 don't run on Windows 4.0 (ie, NT4 and Win9x)
 
here's my results of digging into this problem ...
 
http://louis.steelbytes.com/vs2008_vs_win40.html - http://louis.steelbytes.com/vs2008_vs_win40.html
 


-------------
Louis Solomon
www.SteelBytes.com



Replies:
Posted By: molotov
Date Posted: 21 April 2008 at 8:08am
Hi Louis,
 
It would seem that this is discussed (indirectly) http://forum.sysinternals.com/forum_posts.asp?TID=14290&PN=1#67533 - here .  Have a look at the http://msdn2.microsoft.com/en-us/library/fcc1zstk%28VS.80%29.aspx - /SUBSYSTEM linker switch .  (Doesn't help if you're not the one building the app, of course... Wink)


-------------
Daily affirmation:
net helpmsg 4006


Posted By: steelbytes
Date Posted: 21 April 2008 at 4:42pm
1.  the http://msdn2.microsoft.com/en-us/library/fcc1zstk%28VS.80%29.aspx - /SUBSYSTEM with VS2008 won't allow values less then 5.0
 
2.  if you read the page I pointed to, you'll see the os ver num is not the only issue.


-------------
Louis Solomon
www.SteelBytes.com


Posted By: molotov
Date Posted: 21 April 2008 at 6:12pm
RE: 1) Ah, thanks.  I hadn't actually tried it. Embarrassed
Quote LINK : warning LNK4010: invalid subsystem version number x.y; default subsystem version assumed
 
Wonder if it's worth mentioning on your page?  (Also would be nice if the MSDN doc for the switch would include that detail...)
 
RE: 2) I did read the page; I guess I disregarded parts 2 and 3 because they were Win9x only...  Shame on me... Shocked


-------------
Daily affirmation:
net helpmsg 4006


Posted By: steelbytes
Date Posted: 21 April 2008 at 8:01pm

thnx for the suggestion (reminder) - updated.

what inspired me to post this thread was, that I saw that sysintnerals had published a new ver of handle.exe that is supposed to work on win9x - it doesn't :-)  It looks like sysinternals have bumped into this set of problems and hadn't realised part 2 and 3 of my post ...


-------------
Louis Solomon
www.SteelBytes.com


Posted By: molotov
Date Posted: 22 April 2008 at 4:48am
Quote using older version of EditBin from some older version of VS/VC/SDK _may_ work - I have not explored/tested
I used VS 2003's editbin.exe, and was no longer presented with the following dialog:
Quote =====
Error Starting Program
=====
The X:\Path To\Your.exe file
expects a newer version of Windows.
Upgrade your Windows version.
 
OK
=====
 
I finally made a 98SE and ME VM; the app didn't run, probably due to Part 2 and Part 3 from your page.  Added those functions, and rebuilt, but still no joy... 
Quote LIBCMT.lib(crt0dat.obj) : error LNK2005: __crt_waiting_on_module_handle already defined in objfile.obj
LIBCMT.lib(initcrit.obj) : error LNK2005: ___crtInitCritSecAndSpinCount already defined in objfile.obj
 
Got around those with /FORCE:MULTIPLE to ignore the second definition, but the apps still wouldn't run...  (No warning, and no response from the app.)


-------------
Daily affirmation:
net helpmsg 4006


Posted By: steelbytes
Date Posted: 22 April 2008 at 5:11am
were you compiling with global optimisation? if so, it seems that you can't reliably override the CRT functions.

-------------
Louis Solomon
www.SteelBytes.com


Posted By: molotov
Date Posted: 22 April 2008 at 7:43pm
Even after disabling compiler optimization (/Od), and using the functions in Part 2 and Part 3 from your page (in conjunction with /FORCE:MULTIPLE), and running the binary through the function in Part 1 (or VS2003's EditBin.exe), the executables created in VS 2008 do not function on Windows 98 SE or Windows ME.
 
In the case of EditBin, Dependency Walker verifies the Subsystem Ver is 4.0, and in the case of the function from Part 1 Dependency Walker shows the OS Ver and Subsystem Ver both as 4.0. 


-------------
Daily affirmation:
net helpmsg 4006


Posted By: steelbytes
Date Posted: 22 April 2008 at 10:01pm

please past your build log here, as I am interested in reading the warnings that the linker generates when resolving the multiple references to these two functons.

PS, test 5 mins ago with a hello world test from scratch ...
* set progrm to be multibyte
* add forcemultiple to linker
* set crt to be static not dll
* disable whole program optimisation
* use the two funcs from my web page
* and modfy the ver fields (using the method on my page).



-------------
Louis Solomon
www.SteelBytes.com


Posted By: molotov
Date Posted: 23 April 2008 at 3:54am
I have my test program working on 98 and ME now - thanks for your persistence. EmbarrassedThumbs%20Up
 
Quote were you compiling with global optimisation?
I had taken this to mean /Og which the default optimization (/O2) includes.  I had previously changed the optimzation setting to /Od, to no effect.
 
Quote disable whole program optimisation
This made me look at that Whole Program Optimization setting (/GL); disabling that seems to have been the key.
 
EditBin.exe from VS 2003 and the code from Part 1 each worked, in combination with the functions from Part 2 and Part 3.
 
Wonder if it may also be worth including http://forum.sysinternals.com/forum_posts.asp?TID=14431#68565 - your list of steps on your page...


-------------
Daily affirmation:
net helpmsg 4006


Posted By: steelbytes
Date Posted: 23 April 2008 at 4:57am
re: 'global opt' vs 'whole prog opt', yeah I typed the wrong thing when I quickly scribbled that post :-)
 
re: updating my page with those steps, that was my intention affter writing them for you - I was just waiting for you to get it working (ie, validate the steps).  page updated :-)
 
 
it's a shame that we have to do this messing around, as it will just keep people from upgrading from VC6 for even longer :-)  a conspirisist would say it's MS attempting to force our hands in dropping support for old windows.  bit of a shame since my programs work fully on win9x/nt4 when compiled with vs2003 and doing my method requires turning off whole prog opt if I use vs2005 - not desirable.
 
 
I have been considering writing an exe patcher to apply these changes to an already compiled .exe (or .dll), but just haven't had the time.  I wonder if I could then get vs2008's remote debugger running on win9x/nt4 ...
 
 
hey, if you have email addy for whomever maintains sysinternals's apps such as handle.exe, then you may want to formard this info to them
 


-------------
Louis Solomon
www.SteelBytes.com


Posted By: steelbytes
Date Posted: 29 July 2008 at 1:47pm
I have at last found time to write a patcher to modifiy a compiled .exe/dll. 
 
why not just mod the crt .lib?  umm ... because I feel that is MS's job :-)
 
thinking of releasing on steelbytes.com, but need to test it a bit more first.


-------------
Louis Solomon
www.SteelBytes.com


Posted By: takeos
Date Posted: 25 August 2008 at 5:29pm
The work and posts by steelbytes and molotov are milestones in this fields, nevertheless I'd like to bring to your attention a slightly different approach, implemented as a library containing the missing functions, so that it is compatible with optimization as well:
 
Legacy Extender for Visual Studio 2005/2008
http://www.legacyextender.com - http://www.legacyextender.com
 
The toolkit contains a linkable library and a command to edit the version and recalculate the checksum (similar to editbin.exe once provided by Microsoft).
 
The Legacy Extender library also implements some Unicode functions which are present in Windows 95, but which do not work on an out of the box system (your application will start, but it will fail on these functions). These are also referenced by Visual Studio. Your critical expert opinion is of course most welcome.


Posted By: steelbytes
Date Posted: 27 August 2008 at 2:18pm
Originally posted by steelbytes steelbytes wrote:

I have at last found time to write a patcher to modifiy a compiled .exe/dll. 
 
why not just mod the crt .lib?  umm ... because I feel that is MS's job :-)
 
thinking of releasing on steelbytes.com, but need to test it a bit more first.
 
beta released http://www.steelbytes.com/?mid=47 - ExeVersion
http://www.steelbytes.com/?mid=47 -  


-------------
Louis Solomon
www.SteelBytes.com



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.06 - http://www.webwizforums.com
Copyright ©2001-2016 Web Wiz Ltd. - https://www.webwiz.co.uk