[FDC]
authorEric Kohl <eric.kohl@reactos.org>
Sun, 1 Dec 2013 01:32:26 +0000 (01:32 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Sun, 1 Dec 2013 01:32:26 +0000 (01:32 +0000)
Fix a bug that overwrites drive data if two FDDs are attached to a controller. Only the second drive is detected in this case.

svn path=/trunk/; revision=61162

reactos/drivers/storage/fdc/fdc/fdc.rc
reactos/drivers/storage/fdc/fdc/fdo.c

index b88c8fa..af4cf04 100644 (file)
@@ -6,7 +6,6 @@
  * PROGRAMMERS:    Eric Kohl
  */
 
 #define REACTOS_VERSION_DLL
 #define REACTOS_STR_FILE_DESCRIPTION   "Floppy Disk Controller Driver\0"
 #define REACTOS_STR_INTERNAL_NAME      "fdc\0"
index 58d04b2..0872417 100644 (file)
@@ -216,8 +216,6 @@ FdcFdoConfigCallback(
     PeripheralResourceDescriptor = (PCM_FULL_RESOURCE_DESCRIPTOR)((PCHAR)PeripheralFullDescriptor +
                                                                   PeripheralFullDescriptor->DataOffset);
 
-    DeviceExtension->ControllerInfo.NumberOfDrives = 0;
-
     /* learn about drives attached to controller */
     for(i = 0; i < PeripheralResourceDescriptor->PartialResourceList.Count; i++)
     {
@@ -228,10 +226,10 @@ FdcFdoConfigCallback(
 
         FloppyDeviceData = (PCM_FLOPPY_DEVICE_DATA)(PartialDescriptor + 1);
 
-        DriveInfo = &DeviceExtension->ControllerInfo.DriveInfo[i];
+        DriveInfo = &DeviceExtension->ControllerInfo.DriveInfo[DeviceExtension->ControllerInfo.NumberOfDrives];
 
         DriveInfo->ControllerInfo = &DeviceExtension->ControllerInfo;
-        DriveInfo->UnitNumber = i;
+        DriveInfo->UnitNumber = DeviceExtension->ControllerInfo.NumberOfDrives;
         DriveInfo->PeripheralNumber = PeripheralNumber;
 
         DriveInfo->FloppyDeviceData.MaxDensity = FloppyDeviceData->MaxDensity;