Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!mit-eddie!uw-beaver!ssc-vax!bcsaic!paula From: paula@bcsaic.UUCP (Paul Allen) Newsgroups: comp.sys.ibm.pc Subject: Re: Environment settings from a C program Message-ID: <2434@bcsaic.UUCP> Date: Fri, 16-Oct-87 17:14:17 EDT Article-I.D.: bcsaic.2434 Posted: Fri Oct 16 17:14:17 1987 Date-Received: Sat, 24-Oct-87 16:16:03 EDT References: <700@hsi.UUCP> <2400@bcsaic.UUCP> Reply-To: paula@bcsaic.UUCP (Paul Allen) Organization: Boeing Computer Services AI Center, Seattle Lines: 27 Keywords: ms-dos environ putenv getenv turboc This is an update to my recent posting (2400@bcsaic.UUCP) describing the back-door interface to command.com. As usual, posting from memory has gotten me into trouble! I was describing interrupt 2EH, *not* interrupt 1EH! From the current BYTE "Inside the IBM PCs" special issue, page 168, comes the following data: Undocumented interrupt 2EH causes command.com to execute a command pointed to by ds:si. The first byte of the command is the number of bytes in the command. The command must end with a carriage return, just as if it had been typed on the keyboard. The article is not clear on whether the cr is included in the byte count. So, to change something in command.com's environment, a small model program could simply construct the command, put its ds-relative offset in si, and do an int 2EH. One side-effect of this technique is that any output from the command will go to command.com's stdout (the screen). Another poster described a way to change command.com's environment by following the chain of parent PSP pointers until you find command.com's. Passing "set foo=bar" to int 2EH seems considerably easier to me. Int 2EH has been described in depth in Ray Duncan's column in Dr. Dobb's Journal. There may also have been information in BYTE's "Best of BIX" column. I have used it on MSDOS 2.1. I seem to remember that one of Ray Duncan's articles claimed it would work on everything since version 2.0, but you ought to check that out for yourself. Paul Allen paula@boeing.com ...!uw-beaver!ssc-vax!bcsaic!paula