I understand that programs written for win9x will not always work on an NT system but will a prog written for NT always work on win9x? What about XP?

What is the difference in the code that makes it good for one but not the other OS? Is it the use of registers or API that make the difference?

There are a lot of questions there but I don't expect someone to answer them all but if you could point me in the right direction.

Thanks in advance.
Posted on 2001-12-04 20:40:34 by brewmanchu

Although a program using WIN32 API SHOULD work on any plateform using WIN32 i.e 9x or NT, but that is not always true.

I have heard that XP has an option in which u can configure the application so that the application thinks that it is running under 9x or NT or 2000.

Different OS have different requirements,
e.g 9x have to have small footprint but do not have to be that robust
NT has to been designed considering security and robusteness into mind.

So although the API is the same but their internal implementation can be very different.
As well as the internal design is quite different.

Posted on 2001-12-04 21:30:27 by goto
Windows 2000 also has a feature where you can run programs so that they will think you are using Win98, etc. I've never used it myself and I'm sure WinXp improves upon it, but it's called something along the lines of 'Application compatibility support'. Win2k users can get it from the update site.
Posted on 2001-12-04 23:02:20 by matthew
if your program meets all requirements of the MS APIs then it
runs on every platform.

Often Win9x tolerates some errors, like forget saving registers,
or misaligned stack.

WinNT/2000/XP is much more sensitive and errors will make your program crash more often.
Posted on 2001-12-05 05:37:37 by beaster
OK, I thought that you had to write the code a different way i.e. preserving more registers, linker options,...

Thanks for the responses.
Posted on 2001-12-05 06:19:44 by brewmanchu
There are only a few reasons that I can think of that ends up making
a 9x program not run on nt-ish windowses.

First and most common is programmers that don't know how to
preserve registers, pass "sloppy" parameters to API functions, or
forget to return valid return codes. I see it as a blessing that nt
systems catch this early, so you don't end up chewing through endless
customer reports.

Next up, it's possible for 9x apps to do dirty stuff. Like gaining ring0
in improper ways. Or issuing DPMI interrupts. Or (ab)using various
very system-dependant structures.

It's also possible for 9x apps to do some thunking so you can use
16bit code. This is an utterly stupid thing to do in most cases, but...
well... some stuff is hard to do without it, and I guess it can be justified
if you're porting an old 16bit app (but only in the initial phases).

And the last thing... some stuff on NT systems require various privileges
that a default user might or might not have.

Now, as for nt programs not running on 9x, there can be a lot of
reasons. Remember that NT has the full win32 api, while the 9x
win32 api is only a subset (a rather complete subset, but still lacking
a few things). You don't have CreateRemoteThread in 9x. You can't
work with files larger than 4GB in 9x (yes, this CAN be a limitation).
Ok, the 4GB limit is also a fat32 limit (max filesize), but even if 9x
had NTFS (you can do some patchy stuff with some NT dlls to achieve this),
you will not be able to work with files > 4GB. You'll notice a bunch
of <blabla>Ex funcitons not working on 9x, and a bunch of parameters
to some APIs with a note "this must be NULL on 9x" and similar.

As for the compatibility modes in 2k and XP... who cares. I doubt it
will run the very dirty stuff that requires raw dos. It can't emulate
a 9x kernel to the full, so very dirty win32 apps will also fail. And the
rest that it might be able to run better... is not stuff I mess with.
Posted on 2001-12-05 09:01:19 by f0dder

I understand that programs written for win9x will not always work on an NT system but will a prog written for NT always work on win9x

While this is generally true, be aware that there are API functions
that are specific to NT and have no analog in W9x. If you use any
of them in your program, then it will NOT run in W9x.
Posted on 2001-12-05 09:04:55 by anon