IoSetHardErrorOrVerifyDevice function (ntddk.h)

Lower-level drivers call the IoSetHardErrorOrVerifyDevice routine to identify a removable media device that has encountered an error, so that a file system driver can prompt the user to verify that the medium is valid.

Syntax

void IoSetHardErrorOrVerifyDevice(
  [in] PIRP           Irp,
  [in] PDEVICE_OBJECT DeviceObject
);

Parameters

[in] Irp

Pointer to the IRP for which the driver encountered a user-induced error.

[in] DeviceObject

Pointer to the target device to be verified for the I/O operation.

Return value

None

Remarks

Lower-level drivers for removal media devices must call IoSetHardErrorOrVerifyDevice before completing an IRP, if a call to IoIsErrorUserInduced returns TRUE. For more information, see Supporting Removable Media.

Subsequently, a file system driver will use information supplied in the specified device object to send a dialog box to the user, who can correct the error and retry the operation or cancel it.

The IRP passed to IoSetHardErrorOrVerifyDevice must be associated with a thread. Therefore, before a driver calls IoSetHardErrorOrVerifyDevice, it must verify that irp->Tail.Overlay.Thread is not NULL. If the value is NULL, IoSetHardErrorOrVerifyDevice must not be called using the current IRP. Instead, the driver should check all IRPs subsequently received and processed, until one is received for which irp->Tail.Overlay.Thread is not NULL. At that point, IoSetHardErrorOrVerifyDevice can be called.

Requirements

Requirement Value
Minimum supported client Available starting with Windows 2000.
Target Platform Universal
Header ntddk.h (include Ntddk.h)
Library NtosKrnl.lib
DLL NtosKrnl.exe
IRQL <=DISPATCH_LEVEL

See also

IoIsErrorUserInduced

IoRaiseHardError

IoRaiseInformationalHardError