In the documentation, it is said:
(cite)
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
(/cite)
So, the driver is supposed to fail the IOCTL if the media was changed.
Now let’s see the CLASS.C source from NT4 DDK. If the additional
buffer was not specified, the code just treats IOCTL_DISK_CHECK_VERIFY
as TEST UNIT READY SCSI command, which can succeed even if the media
was changed (yes, media change introduces unit attention on the
target, but this condition can be cleared by any other IRP to the
target before IOCTL_DISK_CHECK_VERIFY),
If the additional buffer was specified - then CLASS.C still sends TEST
UNIT READY, and then fills the additional buffer in the TEST UNIT
READY completion.
DO_VERIFY_VOLUME stuff is done only in REQUEST SENSE path as a
reaction to unit attention reported.
Now the FSDs.
FASTFAT and CDFS treat the failure of IOCTL_DISK/CDROM_CHECK_VERIFY by
immediately reporting wrong volume condition to IoVerifyVolume,
without any verification reads. On IOCTL_DISK_CHECK_VERIFY success,
then the FSD compares the media change count. If it did not change -
then the FSD reports good volume condition to IoVerifyVolume, again
without any verification reads.
Verification reads are issued only when IOCTL_DISK_CHECK_VERIFY
succeeded and media change count changed.
STATUS_VERIFY_REQUIRED from IOCTL_DISK_CHECK_VERIFY seems to be not
handled, just handled as a generic failure.
Who is correct - the source or the documentation?
Max