Mail Archives: djgpp/1993/12/21/09:08:59
Hi
On Mon, 20 Dec 1993, Bob Babcock wrote:
> I've had several requests for the critical error handler I mentioned, so here
> it is. The basic idea is to allocate a small amount of DOS memory (one
[deleted]
> _go32_dpmi_allocate_dos_memory(&new_handler_info);
> dosmemput(handler, 16, new_handler_info.rm_segment * 16);
[deleted]
First of all, thanks for the handler...
Maybe I am over looking something, but while reading your handler,
it surprised me that you didn't check the return code from
_go32_dpmi_allocate_dos_memory(). Suppose that all conventional
memory is allocated, so you don't get the space you ask for.
Then when you call dosmemput(handler, 16, new_handler_info.rm_segment* 16);
you'll overwrite memory without noticing...
Of course you always install this kind of handlers at the begin of
your program, and usually you won't have problems with memory but....
who knows?
I also sugest the use of sizeof() when calling dosmemput(). Then you
can modify the handler array without having to touch the arguments
to dosmemput:
dosmemput(handler, sizeof(handler), new_handler_info.rm_segment * 16);
Merry Christmas to every body.
Jorge
======================================================================
name: Jorge Fernandez Arnaiz
org: Instituto Nacional de Investigaciones Nucleares
country: Mexico, D.F.
p-mail: Sierra Mojada #447, Lomas de Chapultepec, Mexico D.F.
e-mail: arnaiz AT redvax1 DOT dgsca DOT unam DOT mx
======================================================================
- Raw text -