1.12 Error Handling

IoAllocateErrorLogEntry 
Allocates and initializes an error log packet; returns a pointer so the caller can supply error-log data and call IoWriteErrorLogEntry with the packet.
IoWriteErrorLogEntry 
Queues a previously allocated error log packet, filled in by the driver, to the system error logging thread.
IoIsErrorUserInduced 
Returns a Boolean indicating whether an I/O request failed due to one of the following (user-correctable) conditions: STATUS_IO_TIMEOUT, STATUS_DEVICE_NOT_READY, STATUS_UNRECOGNIZED_MEDIA, STATUS_VERIFY_REQUIRED, STATUS_WRONG_VOLUME, STATUS_MEDIA_WRITE_PROTECTED, or STATUS_NO_MEDIA_IN_DEVICE. If the result is TRUE, a removable-media driver must call IoSetHardErrorOrVerifyDevice before completing the IRP.
IoSetHardErrorOrVerifyDevice 
Supplies the device object for which the given IRP was failed due to a user-induced error, such as supplying the incorrect media for the requested operation or changing the media before the requested operation was completed. (A file system driver uses the associated device object to send a popup to the user, who can then correct the error and/or retry the operation.)
IoGetDeviceToVerify 
Returns a pointer to the device object, representing a removable-media device, that is the target of the given thread’s I/O request. (This routine is useful only to file systems or other highest-level drivers.)
IoRaiseHardError 
Causes a popup to be sent to the user indicating that the given IRP was failed on the given device object for an optional VPB, so that the user can correct the error and/or can retry the operation.
IoRaiseInformationalHardError
Causes a popup to be sent to the user, showing an I/O error status and optional string supplying more information.
ExRaiseStatus 
Raises an error status so that a caller-supplied structured exception handler is called. (This routine is useful only to highest-level drivers that supply exception handlers, in particular to file systems.)
KeBugCheckEx 
Brings down the system in a controlled manner, displaying the bugcheck code and possibly more information, when the caller discovers an unrecoverable inconsistency that will corrupt the system unless it is brought down. (This routine can be called when debugging under-development drivers. Otherwise, drivers should never call this routine when they can handle an error by failing an IRP and by calling IoAllocateErrorLogEntry and IoWriteErrorLogEntry.)
KeBugCheck 
Brings down the system in a controlled manner when the caller discovers an unrecoverable inconsistency that will corrupt the system if the caller continues to run. KeBugCheckEx is preferable.
KeInitializeCallbackRecord 
Initializes a bug-check callback record before a device driver calls KeRegisterBugCheckCallback.
KeRegisterBugCheckCallback
Registers a device driver’s bug-check callback routine, which is called if a system bug check occurs. Such a driver-supplied routine saves driver-determined state information, such as the contents of device registers, that would not otherwise be written into the system crash-dump file.
KeDeregisterBugCheckCallback
Removes a device driver’s callback routine from the set of registered bug-check callbacks.