delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/05/23/23:55:06

From: sandmann AT clio DOT rice DOT edu (Charles Sandmann)
Message-Id: <10105240351.AA12474@clio.rice.edu>
Subject: Re: Crashes due to selector depletion
To: eliz AT is DOT elta DOT co DOT il
Date: Wed, 23 May 2001 22:51:54 -0500 (CDT)
Cc: djgpp-workers AT delorie DOT com
In-Reply-To: <4331-Wed23May2001214623+0300-eliz@is.elta.co.il> from "Eli Zaretskii" at May 23, 2001 09:46:24 PM
X-Mailer: ELM [version 2.5 PL2]
Mime-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> I don't want to get fancy here, just print some legible message and
> exit.  But it ain't easy: without _dos_ds set, we cannot use dosmemput
> and such likes to put the message text into the transfer buffer.  A
> bummer.

> (I originally considered to use the PSP selector, since the transfer
> buffer follows the PSP, but that selector seems to have a 100h-byte
> limit, or at least could be like that according to the DPMI spec.)

You could use the 128 bytes of the command line area, overwriting it
with the message string, since you are getting ready to exit.  This
should be guaranteed to be enough for a message, and fit in the limit.

> Question: is it safe to overwrite the program's environment by using
> the environment block as the transfer buffer?  Note that I don't want
> to modify the selector itself -- this is verboten by the DPMI rules --
> only to write over the environment strings accessing them via the
> selector stuffed by the DPMI host at offset 2Ch in the PSP.

This would probably work also, since I don't think the environment will
be needed anymore.  But what if the environment is very short?  Probably
unlikely (especially if you are in an environment which runs out of 
selectors), but the possibility of dos memory block corruption.

- Raw text -


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