[comp.sys.atari.st] Obliterating your boot sector, Part I

rjd@cs.brown.edu (Rob Demillo) (03/29/89)

OK, here I am...peacefully working on a contract program. Suddenly,
I decide that, for various reasons, it would be a useful thing to 
be able to detect whether GDOS is installed on the user's machine.
If GDOS is not installed, maybe I can force it into memory...but the
first part of the project is just to see if GDOS is there at all...

Piece O' Cake, me thinks...I 'whip' together a 5 line assembler
routine which essentially does a 
		TRAP #2
and checks the D0 register. Low and behold this does work. I boot
my machine with GDOS, my routine finds it. I cold boot without GDOS
installed, and my routine informs me there is no GDOS on the system.

'Gosh,' I think to myself, 'I sure am smart.' 

Now I'm at the desktop after running my program. I open up the C:/AUTO/
directory, and rename a file. There is a disgusting flash as my machine
mysteriously tries to reboot. It does: sans hard disk! (Keep in mind
that it is now midnight, or thereabouts...) A quick check of drive
C: with a sector editor confirms my fears: sector 0 (the boot sector)
has been replaced with a copy of the FAT for C:/AUTO/...

After swearing, throwing up, wishing I was a chartered accountant, and
various other bad things...I sit down to rebuild my boot sector
by hand. (It took three bleary-eyed hours, but I got it back...)

My question is: was this a co-ink-ee-dink, or did the TRAP #2 put
my Atari into the twilight zone? 

Any responses, theories, or shots-in-the-dark are appreciated, since I
am hesitant to try this experiment again...

Thanks...


 - Rob DeMillo			| UUCP:   ...ima!brunix!rjd
   Brown University 		| BITnet: DEMILLO%BRNPSG.SPAN@STAR.STANFORD.EDU
   Planetary Science Group	| Reality: 401-863-3769
"I say you *are* the Messiah, Lord! And I ought to know, I've followed a few!"

kbad@atari.UUCP (Ken Badertscher) (03/31/89)

In article <2938@brunix.UUCP> rjd@cs.brown.edu (Rob Demillo) writes:
|OK, here I am...peacefully working on a contract program. Suddenly,
|I decide that, for various reasons, it would be a useful thing to 
|be able to detect whether GDOS is installed on the user's machine.
|
[stuff about HD boot sector mysteriously disappearing after TRAP #2]
|
|My question is: was this a co-ink-ee-dink, or did the TRAP #2 put
|my Atari into the twilight zone? 

Coincidence?  Maybe.  But there is no way that a GDOS Trap #2 inquiry
could waste your hard disk's boot sector.  Got any other evil, insidious
memory resident tools lurking in your system?

-- 
 Ken Badertscher                 | #include <disclaimer>
 Atari R&D Software Engine       | GEMDOS LIVES! ...or is that Frodo?
 {portal,ames,imagen}!atari!kbad | I can never remember these things...

rjd@brunix (Rob Demillo) (04/02/89)

In article <1418@atari.UUCP> kbad@atari.UUCP (Ken Badertscher) writes:
>In article <2938@brunix.UUCP> rjd@cs.brown.edu (Rob Demillo) writes:
>|My question is: was this a co-ink-ee-dink, or did the TRAP #2 put
>|my Atari into the twilight zone? 
>
>Coincidence?  Maybe.  But there is no way that a GDOS Trap #2 inquiry
>could waste your hard disk's boot sector.  Got any other evil, insidious
>memory resident tools lurking in your system?
>
>-- 
> Ken Badertscher                 | #include <disclaimer>
> Atari R&D Software Engine       | GEMDOS LIVES! ...or is that Frodo?
> {portal,ames,imagen}!atari!kbad | I can never remember these things...

Yeah, that's what I thought to. But when I pull out the assembler
routine, the program functions fine. When I put it back in: blammo!
(Don't worry, this time I had my ass covered because I was expecting it.)

I am now beginning to expect the Laser C shell. I wonder if it is
reacting badly with my TRAP #2 for some reason. Any comments?



 - Rob DeMillo			| UUCP:   ...ima!brunix!rjd
   Brown University 		| BITnet: DEMILLO%BRNPSG.SPAN@STAR.STANFORD.EDU
   Planetary Science Group	| Reality: 401-863-3769
"I say you *are* the Messiah, Lord! And I ought to know, I've followed a few!"

to_stdnet@stag.UUCP (04/07/89)

From: omni!emh@stag.UUCP (Eric Hopper)

In article <3179@brunix.UUCP> rjd@brunix (Rob Demillo) writes:
>In article <1418@atari.UUCP> kbad@atari.UUCP (Ken Badertscher) writes:
>>In article <2938@brunix.UUCP> rjd@cs.brown.edu (Rob Demillo) writes:
>>>My question is: was this a co-ink-ee-dink, or did the TRAP #2 put
>>>my Atari into the twilight zone? 

>>Coincidence?  Maybe.  But there is no way that a GDOS Trap #2 inquiry
>>could waste your hard disk's boot sector.  Got any other evil, insidious
>>memory resident tools lurking in your system?

>>-- 
>> Ken Badertscher                 | #include <disclaimer>
>> Atari R&D Software Engine       | GEMDOS LIVES! ...or is that Frodo?
>> {portal,ames,imagen}!atari!kbad | I can never remember these things...

>Yeah, that's what I thought to. But when I pull out the assembler
>routine, the program functions fine. When I put it back in: blammo!
>(Don't worry, this time I had my ass covered because I was expecting it.)

>I am now beginning to expect the Laser C shell. I wonder if it is
>reacting badly with my TRAP #2 for some reason. Any comments?

	I don't think so.  If you look at the Laser C demo programs,
they all use the trap #2 vector to check for GDOS.  It's in their
open_work() routines.  I don't think they would stick in demo programs
that they couldn't run from their shell.


Eric Hopper (Omnifarious) Don't try to send to emh@omni.uucp, because omni
is completely unkown to any system except stag.
omni!emh@stag.UUCP  or  ....{rosevax, ems, umn-cs}!pwcs!stag!omni!emh
/*****************************************************************************/
/* All opinions presented here are the result of my enviroment, or heredity. */
/* If you don't like them you only have yourselves or my parents to blame.   */
/*****************************************************************************/
                       \**************************/ /)
     __                 \* "I went insane to    */ //
    / ')                 \* preserve my sanity */ //  __.  __  o ____. . _
   /  / ______  ____  o   \* for later."      */_//__(_/|_/ (_<_(_) (_/_/_)_
  (__/ / / / <_/ / <_<_    \*  Ford Prefect  */ />
                            \****************/ </
 /****************************************************************************/