https://git.reactos.org/?p=reactos.git;a=commitdiff;h=0676247932d1f707e9b02d46073d022c02a7893b

commit 0676247932d1f707e9b02d46073d022c02a7893b
Author:     Hervé Poussineau <[email protected]>
AuthorDate: Sat Sep 10 22:25:19 2022 +0200
Commit:     Hervé Poussineau <[email protected]>
CommitDate: Sat Sep 10 22:52:00 2022 +0200

    [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
---
 drivers/storage/floppy/floppy/ioctl.c     | 12 +++---------
 drivers/storage/floppy/floppy/readwrite.c |  9 ++-------
 2 files changed, 5 insertions(+), 16 deletions(-)

diff --git a/drivers/storage/floppy/floppy/ioctl.c 
b/drivers/storage/floppy/floppy/ioctl.c
index 11875e51838..7673a0fd0f0 100644
--- a/drivers/storage/floppy/floppy/ioctl.c
+++ b/drivers/storage/floppy/floppy/ioctl.c
@@ -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);
diff --git a/drivers/storage/floppy/floppy/readwrite.c 
b/drivers/storage/floppy/floppy/readwrite.c
index 2ce3a6ccf17..35d1c60d79b 100644
--- a/drivers/storage/floppy/floppy/readwrite.c
+++ b/drivers/storage/floppy/floppy/readwrite.c
@@ -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);

Reply via email to