Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
DosError (1.2)
◄Function Group► ◄Up► ◄Next► ◄Previous►
────────────────────────────────────────────────────────────────────────────
#define INCL_DOSMISC
USHORT DosError(fEnable)
USHORT fEnable; /* enable/disable error handling */
The DosError function enables or disables hard-error and exception
processing for a process. By default, the system displays a message and
prompts for user input when a hard error or exception occurs. A hard error
is typically an error that cannot be resolved by software──for example, when
the drive door is opened while a removable disk is being read.
The DosError function disables the default processing by forgoing the
displayed message and directing any function that encounters a hard error or
exception to return an appropriate error value. The process must determine
the appropriate action by referring to the error value.
The DosError function is a family API function.
Parameter Description
────────────────────────────────────────────────────────────────────────────
fEnable Specifies whether to disable or enable processing. This parameter
can be one of the following values:
Value Meaning
─────────────────────────────────────────────────────────────────
EXCEPTION_DISABLE Disable exception processing.
EXCEPTION_ENABLE Enable exception processing.
HARDERROR_DISABLE Disable hard-error processing.
HARDERROR_ENABLE Enable hard-error processing.
Return Value
The return value is zero if the function is successful. Otherwise, it is an
error value, which may be the following:
ERROR_INVALID_DATA
Comments
By default, the system terminates any process in which an exception occurs.
Although the DosError function can disable the message when an exception
occurs, it cannot disable the termination of the process. To prevent a
process from being terminated, use the DosSetVec function to trap the
exception and carry out process-specific exception processing.
Restrictions
In real mode, the following restriction applies to the DosError function:
♦ If the fEnable parameter is HARDERROR_DISABLE, all subsequent int 24h
requests fail until a call is made to the DosError function with fEnable
set to HARDERROR_ENABLE.
Example
This example calls the DosError function to turn off hard-error processing,
then calls the DosErrClass function to process any error that is received:
USHORT usAttribute, usError, usClass, fsAction, usLocus;
DosError(HARDERROR_DISABLE); /* turn off hard-error processing */
usError = DosQFileMode("a:\\abc.ext", &usAttribute, 0L);
if (usError) {
DosErrClass(usError, &usClass, &fsAction, &usLocus);
if (usClass == ERRCLASS_HRDFAIL)
DosExit(EXIT_PROCESS, 1);
See Also
DosErrClass, DosSetFHandState, DosSetVec
♦