X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f From: Georg Newsgroups: comp.os.msdos.djgpp Subject: Re: argv[0] Date: Thu, 8 Dec 2011 13:04:04 -0800 (PST) Organization: http://groups.google.com Lines: 35 Message-ID: References: <16b04d29-8317-4c7f-929c-1a22a328fa32 AT p9g2000vbb DOT googlegroups DOT com> <9bf257a7-a0f8-43ba-a65f-36c6027f68cb AT r28g2000yqj DOT googlegroups DOT com> NNTP-Posting-Host: 92.250.191.164 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1323379154 20623 127.0.0.1 (8 Dec 2011 21:19:14 GMT) X-Complaints-To: groups-abuse AT google DOT com NNTP-Posting-Date: Thu, 8 Dec 2011 21:19:14 +0000 (UTC) Complaints-To: groups-abuse AT google DOT com Injection-Info: l24g2000yqm.googlegroups.com; posting-host=92.250.191.164; posting-account=v5xbdQoAAAAOGc9Ccc-kLZyobvPlN3Qr User-Agent: G2/1.0 X-HTTP-Via: 1.1 TAS-4-3.man-a X-Google-Web-Client: true X-Google-Header-Order: UALSERCVNKH X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.1.4) Gecko/20091016 Firefox/3.5.4,gzip(gfe) Bytes: 2950 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Hi Rod, thank you for looking into this. I was so happy that I got it working (on my PC at least) that I did not follow your suggestion. When I run your code I see that it finds and prints the master environment block, i.e. the environment of command.com and that does not contain the absolute path to the running program I am looking for. >dosmemget(the_psp+0x16, 2, &the_psp); reads the psp of the parent process and that is command.com. I do not fully understand the loop but it exits with the psp of command.com and then reads the environment from there. I can check that with the "mem / d |more" command. Georg By the way this is the output of my program on my PC: E:\myprogs\djtest>mcb4 MCB:21B0 M PSP:8 Blocksize:1ED MCB:4090 M PSP:40A Blocksize:BA ENV:4CD Program:COMMAND MCB:4C40 M PSP:0 Blocksize:7 MCB:4CC0 M PSP:40A Blocksize:7D MCB:54A0 M PSP:54B Blocksize:87A ENV:D312 Program:DOSX MCB:DC50 M PSP:FB5 Blocksize:70 Path:E:\MYPROGS\DJTEST \MCB4.EXE MCB:E360 M PSP:E37 Blocksize:17D ENV:DC6 Program:KB16 MCB:FB40 M PSP:FB5 Blocksize:410 ENV:187 Program:MCB4 MCB:13C50 M PSP:0 Blocksize:F00 MCB:22C60 Z PSP:0 Blocksize:7D38 E:\myprogs\djtest>