[comp.lang.c] Program name

kr@mrmarx.UUCP (Kelly Roney) (01/27/88)

In article <11334@brl-adm.ARPA> C08922DB%WUVMD.BITNET@CUNYVM.CUNY.EDU (Don Branson) writes:
>  I understand that the program name is supposed to be available under
>DOS versions 3.00 and above- but it isn't in the PSP. Where is it?

According to p. 7-7 of the DOS Technical Reference for v3.1 (verified by
my own experience), the program's environment is pointed to at offset 2CH
of the PSP.  The environment strings are null-terminated, and then the
environment itself is null-terminated.  Following the two nulls is a count
of some unspecified words, which may be a long (I don't recall).  Following
that is a null-terminated string containing the fully qualified path name
of the file being executed.

(By the way, this discussion should be in comp.sys.ibm.pc.)
-- 
Kelly Roney				{uunet,alliant,masscomp}!mrmarx!kr
51 Spinelli Place			(617) 576-7121
Decision Software Co.			
Cambridge, MA  02138