X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f From: "Rod Pemberton" Newsgroups: comp.os.msdos.djgpp Subject: Re: argv[0] Date: Sat, 3 Dec 2011 19:24:02 -0500 Organization: Aioe.org NNTP Server Lines: 27 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: qBjb0U1QTH77eiTXJSCpEw.user.speranza.aioe.org X-Complaints-To: abuse AT aioe DOT org X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.2001 X-Notice: Filtered by postfilter v. 0.8.2 X-Newsreader: Microsoft Outlook Express 6.00.2800.2001 X-Priority: 3 X-MSMail-Priority: Normal Bytes: 2232 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com "Georg" wrote in message news:cc43d375-8e59-425d-a32e-b4ca200ae5cc AT 4g2000yqu DOT googlegroups DOT com... > > thank you for your message. I tried to follow your suggestion 2, but > did not succeed. It seems to read the environment segment ok but does > not read the right environment data. Can you spot what I am doing > wrong? I am testing in a Windows XP DOS box. > Ok, I think I located the issue. First, _go32_info_block.linear_address_of_original_psp is the same value as returned by Int 21h, ah=51h and Int 21h, ah=62h. So, that is good. However, the ENV seems to be available on the parent PSP. The PSP we're looking at is not the parent. There seems to be a linked list of PSPs. PSP+0x16 points to the parent of the current PSP. You need a loop to trace back through multiple PSPs until the word at PSP+0x16 stops changing values. It's possible this value gets set to zero on some DOS' according to RBIL ... I didn't see that. What I saw is PSP+0x16 eventually points to itself. Then, you'll have the parent PSP with a word at 0x2c that points to the correct ENV. My loop that I added to your C was somewhat messed up, but I'll attempt to clean it up and post it, if you want. Rod Pemberton