www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/06/03/22:03:12

Xref: news2.mv.net comp.os.msdos.djgpp:4539
From: Broeker AT PROBLEM_WITH_INEWS_DOMAIN_FILE (Hans-Bernhard Broeker)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Windows for djgpp
Date: 3 Jun 1996 14:02:48 GMT
Organization: RWTH -Aachen / Rechnerbetrieb Informatik
Lines: 32
Message-ID: <4oura8$cjs@news.rwth-aachen.de>
References: <Pine DOT SUN DOT 3 DOT 91 DOT 960530083039 DOT 14387I-100000 AT is>
NNTP-Posting-Host: axpcl1.physik.rwth-aachen.de
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019