IoRaiseHardError function (ntddk.h)

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.

Syntax

void IoRaiseHardError(
  [in]           PIRP           Irp,
  [in, optional] PVPB           Vpb,
  [in]           PDEVICE_OBJECT RealDeviceObject
);

Parameters

[in] Irp

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

[in, optional] Vpb

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.

[in] RealDeviceObject

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

Return value

None

Remarks

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.

Requirements

Requirement Value
Target Platform Universal
Header ntddk.h (include Ntddk.h)
Library NtosKrnl.lib
DLL NtosKrnl.exe
IRQL IRQL <= APC_LEVEL
DDI compliance rules HwStorPortProhibitedDDIs(storport), IrqlIoApcLte(wdm)

See also

IoGetRelatedDeviceObject

IoSetHardErrorOrVerifyDevice

IoSetThreadHardErrorMode