bobm@hp-pcd.UUCP (bobm) (03/12/86)
Look on page 7-7 of the DOS TechRef. In DOS 3.x, the name used to invoke the program is stored after the enviroment space. To find it, get the word at offset 2CH in the PSP. That's the segment address of the enviroment. Scan through the enviroment a byte at a time until you find two consecutive zero bytes (the end of the enviroment).Following those zeros is a 1-word "count", followed by an ASCIIZ string, which is the drive, path, name and extension of the executing program. I'm not really sure what the "count" is supposed to indicate. It seems to always be set to 1. Also, the string has some wierd uppercase/lowercase conversions. The name and extension of the program are always uppercase, but the drive and path come back in various cases, depending on where the program is, what the path is, the phase of the moon... Bob May hplabs!hp-pcd!bobm
jrv@siemens.UUCP (03/12/86)
The information you are looking for is on page 7-7 of the DOS Technical Reference where it describes the make-up of the environment strings: "The environment is a series of ASCII strings (totaling less then 32K bytes) in the form: NAME=parameter Each string is terminated by a byte of zeros, and the entire set of strings is terminated by another byte of zeros. { i.e. two zero bytes in a row is the end of the environment strings } { or if a zero byte starts what you think is an environment } { variable then you are at the end of the list } Following the byte of zeros that terminates the set of environment strings is a set of initial arguments passed to a program that contains a word count followed by an ASCIIZ string. The { ASCIIZ is a string with a zero byte following it. } { } { Does anyone know what the 'word count' is a count of?? My simple } { tests always had a value of 1 in this word. } ASCIIZ string contains the drive, path, and filename[.ext] of the executable program." The above, minus my comments between '{}' is copyrighted by IBM. Hope this is of assistance. Jim Vallino Siemens Research and Technology Labs Princeton, NJ {ihnp4,allegra}!princeton!siemens!jrv