[net.micro.pc] address of environment

benno@eurifb.UUCP (07/14/86)

Does anyone know where command.com finds the address of the start
of the environment (strings)? I would like the exact address.........

Tnx in advance.
-- 

	Ben Noordzij	( mcvax!eurifb!benno )
	( Looking for a really _p_o_r_t_a_b_l_e UNIX )
	EUR/bedrijfskunde, Burg.Oudlaan 50, 3062 PA  Rotterdam, (010)4525511

everett@hp-pcd.UUCP (07/16/86)

The environment strings are stored in an area which is aligned on a paragraph
boundary (a multiple of 16 bytes).  The PARAGRAPH address (i.e. the segment)
of the current environment can be found by loading the WORD at offset 2c (hex)
in your code segment.  For example, at the beginning of your program, you 
could:

             mov	di,2ch     ; pointer to envirnment address
            mov        es,cs:[di] ; set extra segment pointing to env
             xor       di,di      ; set offset to beginning of env

At this point, es:[di] points to the first byte of your environment.

Everett Kaser
Hewlett-Packard Co.
Corvallis, OR