Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utcs!mnetor!seismo!lll-crg!nike!ucbcad!pavepaws!chapman From: chapman@pavepaws.UUCP Newsgroups: net.micro.pc Subject: Re: Simple Environment Question Message-ID: <854@ucbcad.BERKELEY.EDU> Date: Mon, 14-Jul-86 21:52:10 EDT Article-I.D.: ucbcad.854 Posted: Mon Jul 14 21:52:10 1986 Date-Received: Tue, 15-Jul-86 04:52:33 EDT References: <10800008@mcomp> Sender: news@ucbcad.BERKELEY.EDU Reply-To: chapman@pavepaws.UUCP (Brent Chapman) Organization: UNIXversity of California at Berkeley Lines: 28 The following information is for DOS 3.x; I am unsure of its applicability to earlier versions. The segment address of a program's copy of the environment is stored at offset 0x2C in the PSP. It is stored as a series of ASCII strings (totallyng less than 32K) in the form "NAME=parameter". Each string is terminated by a byte of zeros. A second byte of zeros follows the last string in the environment. The address of the PSP can be obtained by using interrupt 0x21, function 0x62. Set AH to 0x62, cause an interrupt 0x21, and read the PSP address from register BX. Note that what your program sees is a COPY of the environment of the calling process (generally COMMAND.COM). Therefore, any changes you make to this environment will be visible to sub-programs that your program calls, but will "disappear" when your program terminates. Brent -- Brent Chapman chapman@pavepaws.berkeley.edu ucbvax!pavepaws!chapman TANSTAAFL! (There Ain't No Such Thing As A Free Lunch!)