Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site bnrmtv.UUCP Path: utzoo!watmath!clyde!burl!ulysses!gamma!epsilon!zeta!sabre!petrus!bellcore!decvax!decwrl!sun!amdahl!bnrmtv!connery From: connery@bnrmtv.UUCP (Glenn Connery) Newsgroups: net.micro.pc Subject: Re: Current DOS environment Message-ID: <322@bnrmtv.UUCP> Date: Tue, 15-Apr-86 17:09:53 EST Article-I.D.: bnrmtv.322 Posted: Tue Apr 15 17:09:53 1986 Date-Received: Fri, 18-Apr-86 08:24:20 EST References: <2454@pogo.UUCP> Organization: Bell Northern Research, Mtn. View, CA Lines: 32 > > > Does anyone out there know how to get a pointer to the > CURRENT environment in DOS? What about version dependencies? > > Joe Maybee > ...!tektronix!pogo!maybee > > "We have met the enemy and he is US!" > ---Pogo > > -- > > > ----maybee@pogo > > "We have met the enemy and he is US!" > ----Pogo The program segment prefix has the segment address of the environment at offset 2C. If you take this and add offset zero you will be able to locate the current environment for THIS program, which is a COPY of that for its parent, usually DOS. It contains a series of strings, as displayed by typing SET with no parms, each terminated by a null byte. The end of the table is indicated by a trailing NULL (ie. two null bytes in a row). This should be valid for all DOS versions that support the environment. -- Glenn Connery, Bell Northern Research, Mountain View, CA {hplabs,amdahl,3comvax}!bnrmtv!connery