[FLOPPY] Correctly return media changed information

If disk changed since last time, we must either return STATUS_IO_DEVICE_ERROR
or STATUS_VERIFY_REQUIRED, depending of VPB_MOUNTED flag.
This is already handled by the SignalMediaChanged() function.

CORE-18244
This commit is contained in:
Hervé Poussineau 2022-09-10 22:25:19 +02:00
parent 55343f04b0
commit 0676247932
2 changed files with 5 additions and 16 deletions

View file

@ -153,16 +153,10 @@ DeviceIoctlPassive(PDRIVE_INFO DriveInfo, PIRP Irp)
if(DiskChanged)
{
INFO_(FLOPPY, "DeviceIoctl(): detected disk changed; signalling media change and completing\n");
SignalMediaChanged(DriveInfo->DeviceObject, Irp);
/*
* Just guessing here - I have a choice of returning NO_MEDIA or VERIFY_REQUIRED. If there's
* really no disk in the drive, I'm thinking I can save time by just reporting that fact, rather
* than forcing windows to ask me twice. If this doesn't work, we'll need to split this up and
* handle the CHECK_VERIFY IOCTL separately.
*/
if(ResetChangeFlag(DriveInfo) == STATUS_NO_MEDIA_IN_DEVICE)
Irp->IoStatus.Status = STATUS_NO_MEDIA_IN_DEVICE;
/* The following call sets IoStatus.Status and IoStatus.Information */
SignalMediaChanged(DriveInfo->DeviceObject, Irp);
ResetChangeFlag(DriveInfo);
IoCompleteRequest(Irp, IO_NO_INCREMENT);
StopMotor(DriveInfo->ControllerInfo);

View file

@ -478,16 +478,11 @@ ReadWritePassive(PDRIVE_INFO DriveInfo, PIRP Irp)
if(DiskChanged)
{
INFO_(FLOPPY, "ReadWritePhase1(): signalling media changed; Completing with STATUS_MEDIA_CHANGED\n");
INFO_(FLOPPY, "ReadWritePhase1(): detected disk changed: signalling media change and completing\n");
/* The following call sets IoStatus.Status and IoStatus.Information */
SignalMediaChanged(DeviceObject, Irp);
/*
* Guessing at something... see ioctl.c for more info
*/
if(ResetChangeFlag(DriveInfo) == STATUS_NO_MEDIA_IN_DEVICE)
Irp->IoStatus.Status = STATUS_NO_MEDIA_IN_DEVICE;
ResetChangeFlag(DriveInfo);
IoCompleteRequest(Irp, IO_NO_INCREMENT);
StopMotor(DriveInfo->ControllerInfo);