Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!hplabs!hp-pcd!hpcvlx!everett From: everett@hpcvlx.HP.COM (Everett Kaser) Newsgroups: comp.sys.ibm.pc Subject: Re: Dos File Access In TSR's Message-ID: <101000053@hpcvlx.HP.COM> Date: 23 Jun 89 17:55:21 GMT References: <157@wbcs.UUCP> Organization: Hewlett-Packard Co., Corvallis, OR, USA Lines: 27 Besides checking the INDOS flag to see if DOS is busy, you also need to check the IN_CRITICAL_ERROR flag, which (in DOS 3.x anyway) is usually the byte immediately preceding the INDOS flag. If the "foreground" program does a DOS call to open a file, for example, and a critical error occurs, DOS clears the INDOS flag and sets the IN_CRITICAL_ERROR flag. If, at that point, the INT 1C vector get's called (because the 18.2 Hz timer interrupt occurred), the INDOS flag will indicate that DOS is not busy, when in reality it is. Granted, this is a border case, but it CAN occur and will crash your system at very random times, and is almost impossible to track down if you don't know about it. Additionally, if you come into your "background" TSR routine (through INT 28 or INT 1C or however) and everything is in the proper state to allow you to call DOS, you DO need to save and take the CRITICAL ERROR and CTRL-C interrupt vectors, execute your code, then restore those two vectors (along with everything else) before exiting your "background" service routine. The reason for this is that if you do a DOS call that causes a critical error (such as a disk not being in drive A, etc.) and you HAVEN'T taken the criterr vector, the user will get an ABORT, RETRY, FAIL message, and if he FAILs it, DOS will terminate your TSR program, leaving all the interrupt vectors pointing into space, and your system will crash. Similarly, if the user hits CTRL-C (think- ing that he is CTRL-C'ing the "foreground" program, but actually nailing your "background" program), again, DOS will terminate your TSR and your system will crash. Everett Kaser !hplabs!hp-pcd!everett everett%hpcvlx@hplabs.hp.com