www.delorie.com/djgpp/v2faq/faq183.html | search |
| Previous | Next | Up | Top |
Q: Other DOS compilers supply a function named harderr
or _harderr
to hook the critical-error interrupt 24h, but DJGPP doesn't seem to have these...
IRET
, thus silently failing the DOS call that triggered Int 24h. The DJGPP startup code also hooks the protected-mode Int 24h with a handler that fails the DOS call as described above.
So in most circumstances you won't see that DOS prompt at all; your program will just see a failed DOS call. However, some DPMI hosts (notably, QDPMI), will sometimes crash your program if it generates Int 24h, for instance when you access an empty floppy drive. In such cases, or when the default action of failing the DOS call is not good enough, you will have to hook Int 24h with your handler. This should be done in exactly the same manner as hooking hardware interrupts (see how to set an interrupt handler), because Int 24h is one of the few software interrupts that, like all hardware interrupts, are always reflected to the protected-mode handler first. Note that CWSDPMI currently doesn't support hooking Int 24h; if you set an interrupt handler, it won't be called.
There are ways to avoid program crashes due to Int 24h (under those DPMI hosts that exhibit this buggy behavior) other than to install a handler for it. For instance, you can test if the floppy
drive is empty with a BIOS call before accessing it with DOS functions; there are also similar ways to check if a CD-ROM drive is empty. The library function getmntent
(see
the "getmntent" section of the "libc.a reference".) can be used to detect all the drives that can be safely accessed by
DOS; or you can borrow some of the internal functions used by getmntent
from the library source distribution, or
from the zip picker.
webmaster donations bookstore | delorie software privacy |
Copyright ⌐ 1998 by Eli Zaretskii | Updated Nov 1998 |
You can help support this site by visiting the advertisers that sponsor it! (only once each, though)