CRITTER A TSR replacement Critical Error Handler Copyright 1990-1992 by TANSTAAFL Software Version 1.30 March 26, 1992 CRITTER is a full-featured replacement for the DOS critical error handler. CRITTER uses a pop-up window that does not change the displayed program, and provides many options that DOS does not have. All errors can be logged to a printer. CRITTER can use automatic responses to an error, with a variable time delay. With this version of CRITTER, a "response pattern" can be used to behave in a predictable manner, such as "retry three times then fail". CRITTER was originally written to handle normal critical errors with more aplomb than DOS. It seemed that most programs back then did not have their own critical error handlers, so any error would ruin some of the application's display. To this day, many commercial applications ignore critical errors. According to user feedback, CRITTER really shines on systems that are unattended. Several users use CRITTER on their bulletin board systems to ensure round-the-clock operations. One user has CRITTER running on a remote packet radio repeater. Another user has integrated CRITTER into a robotic manufacturing system. CRITTER should be installed in your autoexec.bat file, so it can be loaded every time you boot the system. CRITTER is not sensitive to the order in which it is loaded with other TSR's, so can be placed anywhere in the autoexec.bat file. Command Line Options -------------------- CRITTER [/U] [/M] [/S] [/Bcolors] [/Tcolors] [/Ncolors] [/Aresponse] [/Otimeout] [/Lprinter] [/Rresponses] [/Etimeticks] Regular Options: /U Unloads the TSR. Like all TSR's that allow themselves to be unloaded, this feature only works if this TSR was the last one loaded. This TSR will unload correctly from high DOS RAM (above 640K). /M Monochrome switch. Allows correct display on systems with monochrome monitors connected to color display adapters. /S Sound switch. Turns off the beep when an error is detected. Normally a beep is generated to signal an error. /B Used to set border colors (see Color Options). /T Used to set title colors (see Color Options). /N Used to set normal text colors (see Color Options). Advanced Options: /A Enables automatic response to an error (see Automatic Response). Response can be one of the following: Response Action Response Action --------------- --------------- A Abort R Retry I Ignore F Fail S Soft reboot H Hard reboot /O Allows user to specify the number of seconds to wait for a user response before triggering the automatic response specified by the /A option (see Automatic Response). /L Printer log. Allows user to specify a printer number to log errors to. Valid printer numbers are 1, 2, or 3 and correspond to printers on LPT1, LPT2, or LPT3. /R Response pattern. Allows the user to specify a pattern of responses. The normal response characters (A, R, I, F, S, H) can be used (see Response Patterns). /E Error timer ticks. Allows the user to specify how many timer ticks should pass between errors before the response pattern starts over (see Response Patterns). Color Options ------------- Each color command is followed by characters that determine the color to use. Each color is designated by a single character, as shown in the chart below. If the character is in upper case, it sets the background color. A lower case character sets the foreground color. Adding a [+] to the string makes the fore- ground color bright, while adding a [*] makes it blink. Color commands may be used in any order. Color Character Color Character --------------------------------------------------------- Black K, k Blue B, b Green G, g Cyan C, c Red R, r Magenta M, m Yellow Y, y White W, w Bright + Blink * Examples: /bwK border is dim white on black /ty+*R title is blinking bright yellow on red /ncB text is cyan on blue Automatic Response ------------------ The automatic response feature allows the user to specify a default action and timeout duration. If a critical error occurs and the timeout value is specified, CRITTER shows the error window and waits for a key to be pressed as usual (A-abort, R-retry, etc). The window will now contain an extra countdown timer line. If the user does not respond before this count reaches zero, then the automatic response is triggered. All four possible responses to the error are supported (Abort, Retry, Ignore, and Fail). Not all errors support all responses, however, Abort is always enabled, as is Fail on DOS versions 3.x, 4.x & 5.x. Retry also appears to be always enabled. If the automatic response is enabled but the delay is not, no error screen will be displayed and the response will take place immediately. The automatic response unit can also reboot the computer as a default response. Either a hard (reset) or soft (Ctrl-Alt-Del) reboot can be triggered. This is useful for network or BBS systems that must run unattended. The soft reboot feature does not work consistently on some PCs. This seems to be caused by minor BIOS incompatibilities. Before relying on a soft reboot, test it once to ensure it works on your computer. Examples: /af /o10 Wait 10 seconds for response, then fail. /ar /o30 Wait 30 seconds for response, then retry. Printer Logging --------------- With the printer logging feature, errors detected by CRITTER may be logged to your printer. This is particularly handy when used in conjunction with the automatic response feature. The error log contains the same three error lines displayed when CRITTER pops up, preceded by a header line and followed by a blank line... Critical Error Report from CRITTER follows: Drive not ready Read error on Drive A: Located in File Allocation Table CRITTER only supports parallel printers. If you have a serial printer, try using the MODE command to route it to LPT1. If you try this, let us know the results. Response Patterns ----------------- Response patterns were designed for the user who wants to retry a fixed number of times and then do something else. This feature allows the user to specify up to 16 responses for an error. Any of the normal responses may be used. A timeout duration (/O) may be specified to allow a user to break out of the pattern. How does CRITTER know that the error it just got is the same error it just retried? CRITTER saves the registers describing the error. If CRITTER gets an error that is the same as the previous error AND not much time has passed, it assumes that it is the same error. How much time has to pass before the error is considered a different error? The error timer ticks option (/E) allows the user to specify how many timer ticks must elapse (at 18.2 per second) before the error is treated as a different error. When some errors are retried, they may take a long time before returning as an error. This is particularly prevalent with network errors, where a retry may take more than several seconds to fail again. The default error timer ticks is set at 18 (1 second). If your system behaves unusually, try changing this value. The /R and /A commands may be used together. If an error cycles all the way through the response pattern, then the /A response is used. Examples: /rrrrf /o10 Retry 3 times, then fail, with 10-second wait between each response. /rrh /o5 /e100 Retry once, then perform a hard reboot. Wait 5 seconds before each, and allow five seconds for the retry to fail. /rrfa Retry once, then fail. If the error comes back again after the fail, then abort. Critical Error Handler Theory ----------------------------- Critical errors are caused by hardware errors, generally in disk drives. These errors may be minor (such as printer out of paper, or drive door open) or fairly catastrophic (like a scrambled FAT or dead hard disk). A critical error can be caused by virtually any DOS call EXCEPT interrupts 25h and 26h (Absolute Disk Read & Write). A critical error is associated with a device and can be either a block device (disk drives) or a character device (printer, keyboard, clock, etc.). Each time the error handler is called, parameters are passed that indicate which error occurred and where it happened. The DOS critical error handler is entered via software interrupt 24. DOS will allow a program to replace the DOS critical error handler with its own, but only for the duration of program execution. When the program exits, DOS replaces the address of the program's handler, routing all further critical errors to DOS. CRITTER patches the resident portion of COMMAND.COM so that CRITTER has control of critical errors. The disk file COMMAND.COM is NOT changed. Due to the unusual way DOS handles INT 24, CRITTER can only be unloaded with the /U command line option. If a TSR manager is used (such as MARK and RELEASE), the resident portion of COMMAND.COM will not be "unpatched" and the next critical error will cause the computer to loop until reset. The CRITTER critical error handler gives the following information: Error (DOS) Write protected disk Unknown unit Drive not ready Unknown command CRC error in data Bad drive request Seek error Unknown media type Sector not found Printer out of paper Write fault Read fault General failure Sharing violation Lock violation Invalid disk change FCB unavailable Sharing buffer overflow Error (Network) Network busy Network device no longer exists NetBIOS command limit exceeded Network adapter hardware error Incorrect response from network Incompatible remote adapter Print queue full Not enough space for print file Print file was deleted Network name was deleted Error Cause Read operation Write operation Error Location System area File Allocation Table Directory Data area Internal copy of FAT Other Info (char) Device name (block) Drive designator Possible responses to a critical error are Abort, Ignore, Retry, or Fail. Not all responses are possible at all times -- it depends on the error and the version of DOS. The CRITTER software enables only those responses that DOS will allow at the time. Test Results ------------ CRITTER has been tested with various DOS versions from 2.1 through 5.00. It was tested with various programs and found to allow the tested program to install its own error handler for the duration of its execution. Upon return to DOS, CRITTER continued to handle errors correctly. For those text mode programs that don't install their own error handlers, CRITTER takes care of it for them. Unfortunately, CRITTER is hard to test completely. Several easy errors can be generated, including the write protect error, the drive not ready error, the paper out error, and the read & write faults. Other errors could be tested if they were physically produced, such as unplugging the clock chip or crashing the hard disk (not recommended). CRITTER can be loaded high with the loadhigh command under DOS 5, or by using similar commands for 386MAX or QEMM. CRITTER does not work in the DOS compatibility box under OS/2. In the event that the display is in graphics mode, CRITTER will use the DOS handler. This may result in the screen being scrolled. Fortunately, most programs that use graphics modes contain their own critical error handlers. Files In This Archive Include: ------------------------------ critter.txt (this file) critter.exe CRITTER program Future Enhancements ------------------- No future enhancements to CRITTER are planned. If you desire a new feature, please contact the authors. All features since version 1.00 are the result of user requests. This version of CRITTER is sufficient for our needs. All users are invited to suggest enhancements. Please contact the authors at the communications addresses on the next page Terms And Conditions -------------------- You may use this software freely in any non-military environment. You may distribute this software freely as long as the archive file contains all of the files mentioned above. The shareware version refuses to load after December 31, 1992, and will display a message to that effect. Of course, the standard registered version is good forever. The following purchasing terms are available: Standard Registration $ 20 Latest version, disk size of your choice. Shareware Distribution License $100 Special version for shareware authors wishing to distribute CRITTER with their products. Allows unlimited distribution. Source Code in C and Assembler $200 * Includes unusual design tricks and well-commented source code. Commercial Distribution License $300 * Special version for authors of commercial software, allows unlimited distribution. Includes source code. And of course, if your shipping address is in Colorado, include sales tax (currently 6.3% if you're in Lakewood, 4.3% in Jefferson County, 3.8% in the Denver Metro area, or 3% elsewhere). (whew!) If you desire a site license or are a special interest group, please contact the authors. * Microsoft C v6.0a and the Microsoft Macro Assembler v5.1 are required to assemble and/or compile the source. Communications -------------- We may be reached by the following methods for feedback: on GENIE TANSTAAFL (Dana Cline) on INTERNET dcline@isis.cs.du.edu (Dana Cline) on CompuServe 74606,525 (Dean McCrory) 73700,3053 (Dana Cline) by phone (303) 989-7389 After 8 AM and before 10 PM MST (Thanks!). I do have an answering machine, which has an unlimited message length. I am generally not in during the day (I have to work, too). by mail Dana W. Cline TANSTAAFL Software P. O. Box 260075 Lakewood, CO 80226 Feedback of all types is appreciated. Disclaimer ---------- The authors claim no responsibility for any damage caused by the use or misuse of this product. This product is distributed "as is" with no warranty expressed or implied. The authors will not be responsible for any losses incurred, either directly or indirectly, by the use or misuse of this product. The authors reserve the right to make modifications at any time. Prices are subject to change without notice. Thanks to: ---------- Dean McCrory, for making CRITTER go TSR! Holly Miller, for much help on the original manual. Judy Wolff, for much help on this manual. Floyd Pretz, for suggesting the automatic response feature. Rob Cosgrove, for suggesting the response pattern feature. Jerry Pournelle, for continually harping about the drawbacks of MS-DOS. Information Sources: -------------------- MS-DOS Programmer's Reference, from Microsoft Press MS-DOS Developer's Guide, from the Waite Group Microsoft C 5.1 Manual, from Microsoft MS-DOS Functions, from Microsoft Press Trademarks ---------- Because of the nature of this manual, numerous software products are mentioned by their trade names. In most, if not all, cases these designations are claimed as trademarks by the respective companies. CRITTER is not a registered trademark, but, hey, we did use it first. Order Form TANSTAAFL Software NAME: ______________________________________________________ COMPANY: ______________________________________________________ ADDRESS: ______________________________________________________ ______________________________________________________ CITY: ______________________________________________________ STATE: ________________________ ZIP CODE: _________________ PHONE: ______________________________________________________ E-MAIL ADDRESS: _______________________________________________ WHERE DID YOU RECEIVE CRITTER? ________________________________ ________________________________________________________________ DISK SIZE NEEDED: [ ] 3-1/2 [ ] 5-1/4 COMMENTS: _____________________________________________________ ________________________________________________________________ ________________________________________________________________ Basic Registration @ $ 20.00 __________ Shareware Distribution License @ $100.00 __________ Source Code in C and Assembler @ $200.00 __________ Commercial Distribution License @ $300.00 __________ Colorado sales tax (see rates above) __________ Non-US Shipping @ $5.00 __________ (Payments must be in US Dollars, US bank) TOTAL: $__________ Checks or money orders only. Sorry, no company P.O.'s or credit cards. Remit to: Dana W. Cline TANSTAAFL Software P.O. Box 260075 Lakewood, CO 80226 CRITTER Version History --------------- Version Date Features / Bug Fixes ---------------------------------------------------- 1.00 04/26/90 Original release. 1.10 05/11/90 Automatic response and timeout feature added. 1.20 07/20/91 Printer logging. Reduce resident size by about 700 bytes. Use C6 compiler. 1.30 03/26/92 Added response patterns. Note for BBS Sysops or Shareware Libraries ------------------------------------------ The shareware copy of CRITTER will not run after December 31, 1992. Please contact TANSTAAFL software about getting a 1993 version.