Responding to Check-Verify Requests from the File System
At its discretion, the file system can send an IRP to the device driver's Dispatch entry point for IRP_MJ_DEVICE_CONTROL requests with Parameters.DeviceIoControl.IoControlCode in the I/O stack location set to the following:
IOCTL_XXX_CHECK_VERIFY
where XXX is the type of device, such as DISK, TAPE, or CDROM.
The type DISK includes both unpartitionable (floppy) and partitionable removable-media devices.
If the underlying device driver determines that the media has not changed, the driver should complete the IRP, returning the IoStatus block with the following values:
Status |
Set to STATUS_SUCCESS |
Information |
Set to zero |
In addition, if the device type is DISK or CDROM and the caller specified an output buffer, the driver returns the media change count in the buffer at Irp->AssociatedIrp.SystemBuffer and sets Irp->IoStatus.Information to sizeof(ULONG). By returning this count, the driver gives the caller an opportunity to determine whether the media has changed from its perspective.
If the underlying device driver determines that the media has changed, it takes a different action depending on whether the volume is mounted. If the volume is mounted (the VPB_MOUNTED flag is set in the VPB), the driver should do the following:
Set the Flags in the DeviceObject by ORing Flags with DO_VERIFY_VOLUME.
Set the IoStatus block in the IRP to the following:
- Status set to STATUS_VERIFY_REQUIRED
- Information set to zero
Call IoCompleteRequest with the input IRP.
If the volume is not mounted, the driver must not set the DO_VERIFY_VOLUME bit. The driver should set IoStatus.Status to STATUS_IO_DEVICE_ERROR, set IoStatus.Information to zero, and call IoCompleteRequest with the IRP.