delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/08/16/16:38:05

Date: Mon, 16 Aug 1999 16:04:23 +0200
From: Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de>
Message-Id: <199908161404.QAA20035@acp3bf.physik.rwth-aachen.de>
To: matej DOT baric AT guest DOT arnes DOT si (Matej)
Cc: djgpp AT delorie DOT com
Subject: Re: How to reset machnie using pointers?
Newsgroups: comp.os.msdos.djgpp
Organization: RWTH Aachen, III. physikalisches Institut B
X-Newsreader: TIN [version 1.2 PL2]
Reply-To: djgpp AT delorie DOT com

In article <7p8lmn$np3$1 AT planja DOT arnes DOT si> you wrote:

> int main()
> {
>     int* i;
>     i = (int*)0x0;
>     *i = 1;

This *should* crash with a SIGSEGV because of a NULL pointer access.

>     return(0);
> }

> What's wrong with this? Isn't the data to reset at number 0x0???

You don't even care to tell us what you observed, to make you think
there's something wrong with it. I don't understand what 'the data to
reset' is supposed to mean.

The above program will behave differently, depending on which DPMI
host you run it under:

1) In the DOS box of Win9x: program will probabably run silently, and
without signalling any error. That's because silly Win9x doesn't care
to catch NULL pointer derereferences.

2) Run in raw DOS, with CWSDPMI as the DPMI provider, you'll get a
crash and register dump, as it should be.

--
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.

- Raw text -


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