Contents of the CRITTER.DOC file
No Copyright 1989, John Crouch
Copywrong 1989, John Crouch
(And any other cute way to say it's
public doman and it's all yours)
CRITTER.C is a small program written for Turbo C users. It is
intended to handle the DOS Critical Error Interrupt with a graceful
CXL window oriented error message.
I compiled it with CXL 5.1 and Turbo C 2.0 it seems to work fine. I
have included a lot of information about DOS and it's errors in the
source file. With this information you should be able to modify the
source code to make this program work exactly as you would like it
In Turbo C there is a function named harderr(). This function
allows you to install your own function to be called by DOS when a
DOS Critical Error occurs. One example of a DOS critical error is
when you try to access drive A: and there is no floyy in the disk
drive. DOS usually prompts "Abort, Retry, Ignore". This can really
mess up a nice looking window display!
CRITTER.C contains a function named handler(). This function is
meant to be taken out of this source file and inserted into your
application. CRITTER.C is a testing program for the handler
function. The main() function in CRITTER.C installs this as the
critical error handler and then tries to access either the AUX port
(COM1), or do a findfirst() on a path name you specify on the
Syntax: CRITTER [path]
Example: CRITTER A:\
Try this with no disk in drive A: and you should get a nice looking
window popup telling you the error and allowing you to do a Retry,
The handler() function is rather smart at this time. If it is a
drive error it figures out which drive was in error and tells you.
It determines if it was a Write or Read error too. If it was a
device, like AUX or COM1 or COM2 or PRN, it will tell you that too.
This handler can be expanded by you if you feel like taking the time
to do some work on it. I have included a lot of information on DOS
and it's error handler function which will allow you to understand
what I have already written, and allow you to write your own changes
to the routine.
PLEASE NOTE: This program will only work with the small data
models. Meaning the small and medium libraries.
Why??? When the program is inside the DOS critical error handler,
it is not allowed to call any DOS function above 0x0C. If it does,
the program will end up crashing when you return from the handler.
This is just the way DOS works. Well, from what I can tell CXL
calls malloc() to allocate memory for a lot of the window functions.
When malloc() is used in the large data models, malloc() actually
ends up calling a DOS function (above 0x0C) to allocate some memory
from DOS. This makes the program crash into the ground when it
returns from the handler.
But, the program works fine in the small and medium memory models.
Good luck and have fun. If you like experimenting with these kinds
of hard-to-code programs, be my guest and have some fun. I wish I
could fine a way to make this thing work with the large memory
models. If you do, please upload a copy to the CXL Support BBS.
THIS CODE IS FREE! USE IT AS YOU WISH. USE IT, CHANGE IT, EAT IT,
BURN IT, DO WHATEVER YOU WANT WITH IT, JUST DON'T USE MY NAME WHEN
YOU DO! IT BELONGS TO NOBODY, ESPECIALLY _NOT_ ME! I WILL NOT BE
HELD RESPONSIBLE FOR IT'S GREATNESS OR IT'S NOT-SO-GREATNESS IN ANY
If you would like to chat about this code, I can be found in the
following places in order of the my visiting frequency.
The New Micro Connection BBS (301-698-0212 1200-14400 HST 8-N-1)
The RelayNet Mail Network (C Conference)
Interlink Mail Network (C Conference)
CXL Tech Support BBS (512-590-0460 1200-14400 HST 8-N-1)
CompuServe ID# 71310,2612 (EasyPlex Mail)
One word about CXL. GREAT! One word does not describe the CXL
Function Library! Mike Smedley has done a great job with this
library. I have used other Shareware libraries and commercial
libraries, both costing much more than CXL, and have found CXL to be
superior in every way! It's amazing what kind of programs you can
crank out in a short time with the CXL library at your side. If you
have not registered CXL yet, do it today! I can think of a lot
worse ways to spend $35.