Mail Archives: djgpp/1996/06/03/22:03:12
Eli Zaretskii (eliz AT is DOT elta DOT co DOT il) wrote:
[...]
> > (0) Detect whether it was running under Windows or not.
> That is easy. Many programs just check for `windir' environment variable
> be defined, but that isn't robust enough (IMHO), because if I set it from
> the DOS prompt, I can fool such programs. Better ways are described in
> e.g. "Undocumented DOS".
AFAIK, this is at least partly untrue: you actually *can't* set the
'windir' environment variable from the DOS prompt. That's because
command.com automatically converts all environment variable names
passed to the 'set' command to upper case before storing the
information in the environment. E.g., these two commands yield the
exact same result:
set djgpp=c:/djgpp/djgpp.env
set DJGPP=c:/djgpp/djgpp.env
(Note: the contents aren't transformed to upper case, only the
variable names.) The only way to generate an environment variable with
a lower case name is by direct manipulation of the environment space,
either by specialized command line utilities or your own programs.
Actually, before they used that trick themselves for that 'windir'
variable, M$ was telling anybody who dared to ask that lower-case
letters weren't *allowed* in environment variable names! One of their
major contributions to 'political correctness' in the software
industry...
Hans-Bernhard Broeker (Aachen, Germany)
- Raw text -