[comp.binaries.ibm.pc] prenv, demonstrates how to read environment strings

cgs@umd5.umd.edu (Chris Sylvain) (09/24/88)

[ One of three programs received as a single package.  I edited the
submitter's description.  -- R.D. ]

PRENV demonstrates how to read this program's copy of the parent's
environment created by COMMAND.COM ... For DOS Ver 3.x, the fully
justified path name of this program will also be displayed.  The
executable and the assembly source are supplied.

The environment consists of null-terminated ASCII strings (ASCIIZ),
with the entire list terminated by another null.  A 2-byte entry at
offset 2Ch in the program's program segment prefix (PSP) contains the
segment of the copy of the environment.  The code commenting, wording
of printing messages and some of the code itself have been changed in
a number of places.

This is one of three programs, being posted consecutively to this
newsgroup, that was written using MASM 5.0 by Hardin Brothers for the
April 1988 issue of PC Resource magazine, (C) Copyright 1988 by IDG
Communications/Peterborough, Inc.

Hardin Brothers is a freelance programmer and technical writer. Write
to him at 280 N. Campus Ave., Upland, CA  91786. Enclose a self-
addressed, stamped envelope for a reply.

[
Uudecode this article normally or feed to the "combine" script.

checksum     size (bytes)  file
   23774         2800      this uuencoded posting
   10143         2011      prenv.arc

-- R.D.
]

BEGIN--cut here--cut here
begin 644 prenv.arc
M&@A04D5.5BY!4TT`7EY>%P<``"416';Y8,4+```,8]ZT:5/&#9T$?!HH4)B`
M"IHT<T#`D?/FC)PP;4"0*=/FC9LY="[2*1,1S9L[(.B\`2&G3!@R*1]&G%CQ
M8IL3$0/"R0/BC9F891C""=/2($X0!>VDH>B&H$$08UJ&&0E3#,\A3YHT">*$
MB`NL34"X&`O"R!LY((@\F0+"2AFT,US@80&4H9DZ;-CP5%,'9!HS:<K`'$H'
M#0@W&,OT_%D8HD2*%C&"N),F+X@P;.:L%*.8#$0X;,+D$>Q"(4.'BI,N]>B4
M#E2/<R#2B>CS,%XV+4;*:9,&,5400:8,29($!$@YO<]$1!%\>!(M*5@PI%P8
M*%*#2Q6SD9WR+6_?@D%8O>SF3>&WMO.Z``Y"1@NK(Z^'Y#F5H4\S<\JXEC'$
M<&_K-$5VTTR0V61<&6>T]E@9@.$!`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