Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
VS 2008 and NT 4.0
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Expand all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
jerichar99  
View profile  
(1 user)  More options Mar 31 2008, 6:31 pm
From: jerichar99 <jericha...@gmail.com>
Date: Mon, 31 Mar 2008 15:31:13 -0700 (PDT)
Local: Mon, Mar 31 2008 6:31 pm
Subject: VS 2008 and NT 4.0
This is an unusual question, but hopefully someone can point me in the
right direction. I apologize if this is wrong group to post this, but
I can't locate a VS 2008 group (please let me know if there is a more
appropriate group).

I have a legacy C++ application that my company runs on NT 4.0 (yes,
we still use it!).  Currently I compile the code on my development
machine (Win2k3) using VS 2005 and copy the exe to the NT machines.
That works just fine.  When I compile the code using VS 2008 and copy
the exe to NT, a dialog box says "[exe name] is not a valid Windows NT
application."

A few things I've checked:
1) Yes, the exe file was copied correctly. I've copied it several
times and the same result.
2) The exe runs just fine on the development machine (Win2k3).
3) The exe's byte size is _not_ divisible by 4,096 (image section
size), unlike the VS2005 exe image. I'm not sure if it matters (but I
did try padding the exe with zeroes using a hex editor, but same
error).

Is there a linker option creates an image for legacy OSes (NT, 95,
98)?

Upgrading NT 4.0 is not an option, unfortunately, since the licenses
would be very costly and serve us no purpose.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
jerichar99  
View profile  
(1 user)  More options Apr 4 2008, 6:38 pm
From: jerichar99 <jericha...@gmail.com>
Date: Fri, 4 Apr 2008 15:38:53 -0700 (PDT)
Local: Fri, Apr 4 2008 6:38 pm
Subject: Re: VS 2008 and NT 4.0
I fixed my own problem, just thought I'd post my solution. Also, I'm
not an expert with exe binaries, so I apologize if any information is
incorrect or misleading.

The exe header was the problem. Windows executables (aka "PE files")
contain header sections, one of which is the "Optional Header."  In
the Optional Header section, MajorOperatingSystemVersion and
MajorSubsystemVersion indicates which level of OS the exe will run on.
VS 2005 sets these values to 4 and VS 2008 sets these values to 5.
Using a PE editor (I used CFF Explorer), simply change those values
from 5 to 4 (on the VS 2008 compiled exe).  When I did this and
executed the exe on NT4, it ran beautifully!

A few notes:
1) VS 2008 C++ compiler officially no longer supports Win9x, ME, WinNT
("Breaking Changes" http://msdn2.microsoft.com/en-us/library/bb531344.aspx)
2) My issue is probably an issue also with Win9x, ME, not just WinNT
(I have no Win9x boxes to test with).
3) The file alignment of the exe is 1024 bytes, not 4096 bytes like VS
2005 produces.  I'm not sure if this is a problem, but it does not
appear to be for me.  If this is a problem, pad the exe file with
zeroes until the file size is divisble by 4096 bytes using a hex
editor.  Also you may need to update the "FileAlignment" value in the
Optional Header of the exe from 0x200 (512) to 0x1000 (4096).
4) Of course, if your exe calls newer functions that don't exist in
the NT DLLs, you will run into other issues (but at least the exe will
execute and tell you what's wrong).
5) As of yet, I don't know how to compile the code to automatically
set the correct values.  It's possible there a #define or #pragma that
will do this, but I haven't researched it yet.
6) The PE header also contains a checksum value.  Of course, since the
exe header is modified, the checksum value is almost 100% likely
incorrect.  It doesn't appear that Windows cares, since the exe runs
just fine.

On to VS 2008!

P.S. There is similar thread here: http://www.msfn.org/board/Visual-Studio-2008-Windows-9x-t112283.html
("Visual Studio 2008 and Windows 9x")

On Mar 31, 3:31 pm, jerichar99 <jericha...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google