Re: Detect if running in Windows environment



In article <1173839295.556725.112010@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
smaniaol@xxxxxxxxx "Sonny" writes:

I have seen past threads about checking if the software is running in
a Windows environment but I think it is not applicable in Win XP.
Using Int 2F/AX=1600h or AX=160Ah or getenv("windir") failed. I mean,
I run the program in Win XP and it did not detect that it is running
in windows (The program ran!). Is there a new way? Thanks.

I assume you're running a DOS program as you're calling Int 2F.
There might be a neater way, but looking at what is set in the
environment should give a clue -- running

command /c set >settings.txt

from a XP command prompt shows up lots of stuff that couldn't be
there in a pure DOS environment (e.g. spaces in pathnames), so
analysing the file produced by

system("set >settings.txt");

should give some clues, assuming that system() invokes command.com
and not cmd.exe.

Pete
--
"We have not inherited the earth from our ancestors,
we have borrowed it from our descendants."
.



Relevant Pages