delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2011/11/30/12:45:18

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: Georg <dosusb AT googlemail DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: argv[0]
Date: Wed, 30 Nov 2011 09:13:52 -0800 (PST)
Organization: http://groups.google.com
Lines: 33
Message-ID: <cc43d375-8e59-425d-a32e-b4ca200ae5cc@4g2000yqu.googlegroups.com>
References: <16b04d29-8317-4c7f-929c-1a22a328fa32 AT p9g2000vbb DOT googlegroups DOT com>
<jaueod$2t8$1 AT speranza DOT aioe DOT org> <9bf257a7-a0f8-43ba-a65f-36c6027f68cb AT r28g2000yqj DOT googlegroups DOT com>
<jb1ejh$hm8$1 AT speranza DOT aioe DOT org>
NNTP-Posting-Host: 92.250.191.164
Mime-Version: 1.0
X-Trace: posting.google.com 1322674147 18134 127.0.0.1 (30 Nov 2011 17:29:07 GMT)
X-Complaints-To: groups-abuse AT google DOT com
NNTP-Posting-Date: Wed, 30 Nov 2011 17:29:07 +0000 (UTC)
Complaints-To: groups-abuse AT google DOT com
Injection-Info: 4g2000yqu.googlegroups.com; posting-host=92.250.191.164; posting-account=v5xbdQoAAAAOGc9Ccc-kLZyobvPlN3Qr
User-Agent: G2/1.0
X-HTTP-Via: 1.1 TAS-4-4.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: 2169
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 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.

Regards

Georg Potthast

#include <stdio.h>
#include <go32.h>
#include <sys/movedata.h>
#define env_size 2049

int main()
{
	int i;
	unsigned int env_address = 0;
	unsigned long the_psp = 0;
    static char environment[env_size];

	the_psp = _go32_info_block.linear_address_of_original_psp;
	dosmemget(the_psp + 0x2C, 2, &env_address);
	env_address <<= 4; //make linear address
	printf("\nENV:%04X\n",env_address);
	dosmemget(env_address, sizeof(environment), &environment);
 	for (i=0;i<env_size;i++) {printf("%c",environment[i]);}
 return 0;
}


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019