IoRaiseHardError routine

The IoRaiseHardError routine causes a dialog box to appears that warns the user that a device I/O error has occurred, which might indicate that a physical device is failing.


VOID IoRaiseHardError(
  _In_     PIRP           Irp,
  _In_opt_ PVPB           Vpb,
  _In_     PDEVICE_OBJECT RealDeviceObject


Irp [in]

Pointer to the IRP that failed because of a device I/O error.

Vpb [in, optional]

Pointer to the volume parameter block (VPB), if any, for the mounted file object. This parameter is NULL if no VPB is associated with the device object.

RealDeviceObject [in]

Pointer to the device object that represents the physical device on which the I/O operation failed.

Return value



Highest-level drivers, particularly file system drivers, call IoRaiseHardError.

Warning  Because IoRaiseHardError uses a normal kernel APC to create a user dialog box, a deadlock can occur if normal kernel APCs are disabled when a device error occurs. For example:
  1. An upper-level filter driver calls KeEnterCriticalRegion (which disables normal kernel APCs) and sends an I/O request to a file system driver. The filter driver waits on the completion of the request by the file system driver before the filter driver calls KeLeaveCriticalRegion (which reenables normal kernel APCs).

  2. An error occurs on the file system, and the file system driver calls IoRaiseHardError to report the error to the user. The file system driver waits on the dialog box.

  3. Deadlock now exists: The normal kernel APC created by IoRaiseHardError to create the dialog box waits for normal kernel APCs to be enabled. The file system waits on the dialog box before it completes the I/O request. The filter driver waits on completion of the I/O request before it calls KeLeaveCriticalRegion (which reenables normal kernel APCs).

The behavior of this routine is dependent of the current state of hard errors for the running thread. If hard errors have been disabled by calling IoSetThreadHardErrorMode, this routine completes the IRP specified by Irp without transferring any data into user buffers. In addition, no message is sent to notify the user of this failure.


Target platform



Available starting with Windows 2000.


Ntddk.h (include Ntddk.h)







DDI compliance rules

IrqlIoApcLte, HwStorPortProhibitedDDIs

See also




Send comments about this topic to Microsoft