Mail Archives: djgpp/1997/07/05/11:08:07
>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 -