www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/07/05/11:08:07

Date: Sat, 5 Jul 1997 08:06:18 -0700 (PDT)
Message-Id: <199707051506.IAA24400@adit.ap.net>
Mime-Version: 1.0
To: trill AT netbook DOT demon DOT co DOT uk
From: Nate Eldredge <eldredge AT ap DOT net>
Subject: Re: Low level stuff w/DJGPP (floppy drive blitzing, etc)
Cc: djgpp AT delorie DOT com

>In an application I'm writing, I need to be able to turn off the floppy
>drive so that when the program exits it is disabled. The program loads
>on startup, waits for a keypress within 3 seconds with kbhit(), and then
>if a key is pressed requests a password. If no key is pressed or the
>password is incorrect, the floppy drive should be disabled and the
>program should exit. If the password is correct the program should
>simply exit.

You could hook INT 13h, check the DL register for which drive is being
accessed, and return doing nothing if it's the wrong one. Maybe even set the
error code (in AH) to something like 80h, which means "drive not ready". If
it's not the disk you're worried about, chain to the old INT 13h. I'm not
sure offhand how to do that in C, but take a look at the _go32_dpmi functions.

Note that you will have to terminate and stay resident to make this work,
and it is theoretically possible to circumvent.

It would be a lot easier to write this in real-mode C or assembler, but I
guess that's the breaks.



Nate Eldredge
eldredge AT ap DOT net



- Raw text -


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