[comp.sys.ibm.pc] critical error handling in TC/MSC

burleigh@cica.cica.indiana.edu (Frank Burleigh) (10/30/89)

how does one handle disk errors in the standard ms-dos c compilers
(especially, e.g. tc 2.0)?

tc has the HARDERR function, which takes a pointer to a user-supplied
critical error handler.  the meager documentation suggests that when
we issue HARDERR the appropriate interupt vector is made to point to
the user-supplied error handler, replacing the dos handler that we all
love so much:

      abort, retry, fail?

one would think that the handler function would then be called.  but
in my experiments, it does not work that way.  my experiment is to
issue a findfirst on "a:\*.*" with the disk not fully inserted.  the
operation fails, but the problem is captured by the IF in which the
FINDFIRST is embedded.  the error handler never is called.  granted,
the test handler is just HARDRTN* (perhaps drive not ready is not
'critical?'  the documented tc2.0 example uses fopen as its sample
operation).

so:

     does anyone have a sample handler to look at -- say one that
     captures that the drive is not ready.  really we want to
     distinguish between a bad filespec and a no disk condition!

     or, once we know the operation failed, can we immediately
     issue a BDOS 0x21, 0x59?  that is, if we do this right after
     the failure, can we assume anything about registers' contents?

e-mail or posted replys are appreciated and eagerly anticipated.

*i inserted to fake assignments in the nearly-empty handler just
to give it something to do.

-- 
Frank Burleigh  burleigh@cica.cica.indiana.edu
USENET: ...rutgers!iuvax!cica!burleigh BITNET: BURLEIGH@IUBACS.BITNET
Department of Sociology, Indiana University, Bloomington, Indiana 47405