[CLASS2]
authorPierre Schweitzer <pierre@reactos.org>
Tue, 12 Oct 2010 20:17:55 +0000 (20:17 +0000)
committerPierre Schweitzer <pierre@reactos.org>
Tue, 12 Oct 2010 20:17:55 +0000 (20:17 +0000)
Switch use from DISK_GEOMETRY to DISK_GEOMETRY_EX. It's needed to handle some Windows 2003's kernel routines.

[CDROM]
Reflect changes in Class2.

[DISK]
Reflect changes in Class2.
Also added support for IOCTL_DISK_GET_DRIVE_GEOMETRY_EX.

svn path=/trunk/; revision=49129

reactos/drivers/storage/class/cdrom/cdrom.c
reactos/drivers/storage/class/class2/class2.c
reactos/drivers/storage/class/disk/disk.c
reactos/drivers/storage/class/include/class2.h

index ef46265..12531ba 100644 (file)
@@ -955,7 +955,7 @@ Return Value:
     //
 
     deviceExtension->DiskGeometry =
-        ExAllocatePool(NonPagedPool, sizeof(DISK_GEOMETRY));
+        ExAllocatePool(NonPagedPool, sizeof(DISK_GEOMETRY_EX));
 
     if (deviceExtension->DiskGeometry == NULL) {
 
@@ -1006,7 +1006,7 @@ Return Value:
     //
 
     status = ScsiClassReadDriveCapacity(deviceObject);
-    bps = deviceExtension->DiskGeometry->BytesPerSector;
+    bps = deviceExtension->DiskGeometry->Geometry.BytesPerSector;
 
     if (!NT_SUCCESS(status) || !bps) {
 
@@ -1037,7 +1037,7 @@ Return Value:
 
         bps = 1 << lastBit;
     }
-    deviceExtension->DiskGeometry->BytesPerSector = bps;
+    deviceExtension->DiskGeometry->Geometry.BytesPerSector = bps;
     DebugPrint((2, "CreateCdRomDeviceObject: Calc'd bps = %x\n", bps));
 
     //
@@ -2828,12 +2828,12 @@ Return Value:
     startingOffset.QuadPart = currentIrpStack->Parameters.Read.ByteOffset.QuadPart +
                               transferByteCount;
 
-    if (!deviceExtension->DiskGeometry->BytesPerSector) {
-        deviceExtension->DiskGeometry->BytesPerSector = 2048;
+    if (!deviceExtension->DiskGeometry->Geometry.BytesPerSector) {
+        deviceExtension->DiskGeometry->Geometry.BytesPerSector = 2048;
     }
 
     if ((startingOffset.QuadPart > deviceExtension->PartitionLength.QuadPart) ||
-        (transferByteCount & (deviceExtension->DiskGeometry->BytesPerSector - 1))) {
+        (transferByteCount & (deviceExtension->DiskGeometry->Geometry.BytesPerSector - 1))) {
 
         DebugPrint((1,"ScsiCdRomRead: Invalid I/O parameters\n"));
         DebugPrint((1, "\toffset %x:%x, Length %x:%x\n",
@@ -2841,7 +2841,7 @@ Return Value:
                     startingOffset.u.LowPart,
                     deviceExtension->PartitionLength.u.HighPart,
                     deviceExtension->PartitionLength.u.LowPart));
-        DebugPrint((1, "\tbps %x\n", deviceExtension->DiskGeometry->BytesPerSector));
+        DebugPrint((1, "\tbps %x\n", deviceExtension->DiskGeometry->Geometry.BytesPerSector));
 
         //
         // Fail request with status of invalid parameters.
@@ -3059,11 +3059,11 @@ CdRomDeviceControlCompletion(
 
                 bps = 1 << lastBit;
             }
-            deviceExtension->DiskGeometry->BytesPerSector = bps;
+            deviceExtension->DiskGeometry->Geometry.BytesPerSector = bps;
 
             DebugPrint((2,
                         "CdRomDeviceControlCompletion: Calculated bps %#x\n",
-                        deviceExtension->DiskGeometry->BytesPerSector));
+                        deviceExtension->DiskGeometry->Geometry.BytesPerSector));
 
             //
             // Copy last sector in reverse byte order.
@@ -3082,7 +3082,7 @@ CdRomDeviceControlCompletion(
             WHICH_BIT(bps, deviceExtension->SectorShift);
 
             DebugPrint((2,"SCSI ScsiClassReadDriveCapacity: Sector size is %d\n",
-                deviceExtension->DiskGeometry->BytesPerSector));
+                deviceExtension->DiskGeometry->Geometry.BytesPerSector));
 
             DebugPrint((2,"SCSI ScsiClassReadDriveCapacity: Number of Sectors is %d\n",
                 lastSector + 1));
@@ -3097,7 +3097,7 @@ CdRomDeviceControlCompletion(
             // Calculate number of cylinders.
             //
 
-            deviceExtension->DiskGeometry->Cylinders.QuadPart = (LONGLONG)((lastSector + 1)/(32 * 64));
+            deviceExtension->DiskGeometry->Geometry.Cylinders.QuadPart = (LONGLONG)((lastSector + 1)/(32 * 64));
 
             deviceExtension->PartitionLength.QuadPart =
                 (deviceExtension->PartitionLength.QuadPart << deviceExtension->SectorShift);
@@ -3108,7 +3108,7 @@ CdRomDeviceControlCompletion(
                 // This device supports removable media.
                 //
 
-                deviceExtension->DiskGeometry->MediaType = RemovableMedia;
+                deviceExtension->DiskGeometry->Geometry.MediaType = RemovableMedia;
 
             } else {
 
@@ -3116,20 +3116,20 @@ CdRomDeviceControlCompletion(
                 // Assume media type is fixed disk.
                 //
 
-                deviceExtension->DiskGeometry->MediaType = FixedMedia;
+                deviceExtension->DiskGeometry->Geometry.MediaType = FixedMedia;
             }
 
             //
             // Assume sectors per track are 32;
             //
 
-            deviceExtension->DiskGeometry->SectorsPerTrack = 32;
+            deviceExtension->DiskGeometry->Geometry.SectorsPerTrack = 32;
 
             //
             // Assume tracks per cylinder (number of heads) is 64.
             //
 
-            deviceExtension->DiskGeometry->TracksPerCylinder = 64;
+            deviceExtension->DiskGeometry->Geometry.TracksPerCylinder = 64;
 
             //
             // Copy the device extension's geometry info into the user buffer.
@@ -6530,7 +6530,7 @@ Return Value:
         //
 
         from = (PFOUR_BYTE) &readCapacityBuffer->BytesPerBlock;
-        to = (PFOUR_BYTE) &deviceExtension->DiskGeometry->BytesPerSector;
+        to = (PFOUR_BYTE) &deviceExtension->DiskGeometry->Geometry.BytesPerSector;
         to->Byte0 = from->Byte3;
         to->Byte1 = from->Byte2;
         to->Byte2 = from->Byte1;
@@ -6540,7 +6540,7 @@ Return Value:
         // Using the new BytesPerBlock, calculate and store the SectorShift.
         //
 
-        WHICH_BIT(deviceExtension->DiskGeometry->BytesPerSector, deviceExtension->SectorShift);
+        WHICH_BIT(deviceExtension->DiskGeometry->Geometry.BytesPerSector, deviceExtension->SectorShift);
 
         //
         // Copy last sector in reverse byte order.
@@ -6558,22 +6558,22 @@ Return Value:
         // Calculate number of cylinders.
         //
 
-        deviceExtension->DiskGeometry->Cylinders.QuadPart = (LONGLONG)((lastSector + 1)/(32 * 64));
+        deviceExtension->DiskGeometry->Geometry.Cylinders.QuadPart = (LONGLONG)((lastSector + 1)/(32 * 64));
         deviceExtension->PartitionLength.QuadPart =
             (deviceExtension->PartitionLength.QuadPart << deviceExtension->SectorShift);
-        deviceExtension->DiskGeometry->MediaType = RemovableMedia;
+        deviceExtension->DiskGeometry->Geometry.MediaType = RemovableMedia;
 
         //
         // Assume sectors per track are 32;
         //
 
-        deviceExtension->DiskGeometry->SectorsPerTrack = 32;
+        deviceExtension->DiskGeometry->Geometry.SectorsPerTrack = 32;
 
         //
         // Assume tracks per cylinder (number of heads) is 64.
         //
 
-        deviceExtension->DiskGeometry->TracksPerCylinder = 64;
+        deviceExtension->DiskGeometry->Geometry.TracksPerCylinder = 64;
 
     } else {
 
@@ -6660,11 +6660,11 @@ Return Value:
                 //
 
                 originalIrp->IoStatus.Status = STATUS_INSUFFICIENT_RESOURCES;
-                RtlZeroMemory(deviceExtension->DiskGeometry, sizeof(DISK_GEOMETRY));
-                deviceExtension->DiskGeometry->BytesPerSector = 2048;
+                RtlZeroMemory(deviceExtension->DiskGeometry, sizeof(DISK_GEOMETRY_EX));
+                deviceExtension->DiskGeometry->Geometry.BytesPerSector = 2048;
                 deviceExtension->SectorShift = 11;
                 deviceExtension->PartitionLength.QuadPart = (LONGLONG)(0x7fffffff);
-                deviceExtension->DiskGeometry->MediaType = RemovableMedia;
+                deviceExtension->DiskGeometry->Geometry.MediaType = RemovableMedia;
             }
         } else {
 
@@ -6672,11 +6672,11 @@ Return Value:
             // Set up reasonable defaults
             //
 
-            RtlZeroMemory(deviceExtension->DiskGeometry, sizeof(DISK_GEOMETRY));
-            deviceExtension->DiskGeometry->BytesPerSector = 2048;
+            RtlZeroMemory(deviceExtension->DiskGeometry, sizeof(DISK_GEOMETRY_EX));
+            deviceExtension->DiskGeometry->Geometry.BytesPerSector = 2048;
             deviceExtension->SectorShift = 11;
             deviceExtension->PartitionLength.QuadPart = (LONGLONG)(0x7fffffff);
-            deviceExtension->DiskGeometry->MediaType = RemovableMedia;
+            deviceExtension->DiskGeometry->Geometry.MediaType = RemovableMedia;
         }
     }
 
index cb8d1f7..befd665 100644 (file)
@@ -748,16 +748,16 @@ Retry:
         // in reverse byte order.
         //
 
-        ((PFOUR_BYTE)&deviceExtension->DiskGeometry->BytesPerSector)->Byte0 =
+        ((PFOUR_BYTE)&deviceExtension->DiskGeometry->Geometry.BytesPerSector)->Byte0 =
             ((PFOUR_BYTE)&readCapacityBuffer->BytesPerBlock)->Byte3;
 
-        ((PFOUR_BYTE)&deviceExtension->DiskGeometry->BytesPerSector)->Byte1 =
+        ((PFOUR_BYTE)&deviceExtension->DiskGeometry->Geometry.BytesPerSector)->Byte1 =
             ((PFOUR_BYTE)&readCapacityBuffer->BytesPerBlock)->Byte2;
 
-        ((PFOUR_BYTE)&deviceExtension->DiskGeometry->BytesPerSector)->Byte2 =
+        ((PFOUR_BYTE)&deviceExtension->DiskGeometry->Geometry.BytesPerSector)->Byte2 =
             ((PFOUR_BYTE)&readCapacityBuffer->BytesPerBlock)->Byte1;
 
-        ((PFOUR_BYTE)&deviceExtension->DiskGeometry->BytesPerSector)->Byte3 =
+        ((PFOUR_BYTE)&deviceExtension->DiskGeometry->Geometry.BytesPerSector)->Byte3 =
             ((PFOUR_BYTE)&readCapacityBuffer->BytesPerBlock)->Byte0;
 
         //
@@ -780,10 +780,10 @@ Retry:
         // Calculate sector to byte shift.
         //
 
-        WHICH_BIT(deviceExtension->DiskGeometry->BytesPerSector, deviceExtension->SectorShift);
+        WHICH_BIT(deviceExtension->DiskGeometry->Geometry.BytesPerSector, deviceExtension->SectorShift);
 
         DebugPrint((2,"SCSI ScsiClassReadDriveCapacity: Sector size is %d\n",
-            deviceExtension->DiskGeometry->BytesPerSector));
+            deviceExtension->DiskGeometry->Geometry.BytesPerSector));
 
         DebugPrint((2,"SCSI ScsiClassReadDriveCapacity: Number of Sectors is %d\n",
             lastSector + 1));
@@ -798,7 +798,7 @@ Retry:
         // Calculate number of cylinders.
         //
 
-        deviceExtension->DiskGeometry->Cylinders.QuadPart = (LONGLONG)((lastSector + 1)/(32 * 64));
+        deviceExtension->DiskGeometry->Geometry.Cylinders.QuadPart = (LONGLONG)((lastSector + 1)/(32 * 64));
 
         deviceExtension->PartitionLength.QuadPart =
             (deviceExtension->PartitionLength.QuadPart << deviceExtension->SectorShift);
@@ -809,7 +809,7 @@ Retry:
             // This device supports removable media.
             //
 
-            deviceExtension->DiskGeometry->MediaType = RemovableMedia;
+            deviceExtension->DiskGeometry->Geometry.MediaType = RemovableMedia;
 
         } else {
 
@@ -817,20 +817,20 @@ Retry:
             // Assume media type is fixed disk.
             //
 
-            deviceExtension->DiskGeometry->MediaType = FixedMedia;
+            deviceExtension->DiskGeometry->Geometry.MediaType = FixedMedia;
         }
 
         //
         // Assume sectors per track are 32;
         //
 
-        deviceExtension->DiskGeometry->SectorsPerTrack = 32;
+        deviceExtension->DiskGeometry->Geometry.SectorsPerTrack = 32;
 
         //
         // Assume tracks per cylinder (number of heads) is 64.
         //
 
-        deviceExtension->DiskGeometry->TracksPerCylinder = 64;
+        deviceExtension->DiskGeometry->Geometry.TracksPerCylinder = 64;
     }
 
     if (status == STATUS_VERIFY_REQUIRED) {
@@ -860,8 +860,8 @@ Retry:
         // except for the bytes per sector and sector shift.
         //
 
-        RtlZeroMemory(deviceExtension->DiskGeometry, sizeof(DISK_GEOMETRY));
-        deviceExtension->DiskGeometry->BytesPerSector = 512;
+        RtlZeroMemory(deviceExtension->DiskGeometry, sizeof(DISK_GEOMETRY_EX));
+        deviceExtension->DiskGeometry->Geometry.BytesPerSector = 512;
         deviceExtension->SectorShift = 9;
         deviceExtension->PartitionLength.QuadPart = (LONGLONG) 0;
 
@@ -871,7 +871,7 @@ Retry:
             // This device supports removable media.
             //
 
-            deviceExtension->DiskGeometry->MediaType = RemovableMedia;
+            deviceExtension->DiskGeometry->Geometry.MediaType = RemovableMedia;
 
         } else {
 
@@ -879,7 +879,7 @@ Retry:
             // Assume media type is fixed disk.
             //
 
-            deviceExtension->DiskGeometry->MediaType = FixedMedia;
+            deviceExtension->DiskGeometry->Geometry.MediaType = FixedMedia;
         }
     }
 
@@ -2752,7 +2752,7 @@ Return Value:
             errorLogEntry->DeviceOffset.QuadPart = (LONGLONG) badSector;
             errorLogEntry->DeviceOffset = RtlExtendedIntegerMultiply(
                                errorLogEntry->DeviceOffset,
-                               deviceExtension->DiskGeometry->BytesPerSector);
+                               deviceExtension->DiskGeometry->Geometry.BytesPerSector);
         }
 
         errorLogEntry->ErrorCode = logStatus;
index 895b2eb..bf380bc 100644 (file)
@@ -652,7 +652,7 @@ Return Value:
     NTSTATUS       status;
     PDEVICE_OBJECT deviceObject = NULL;
     PDEVICE_OBJECT physicalDevice;
-    PDISK_GEOMETRY diskGeometry = NULL;
+    PDISK_GEOMETRY_EX diskGeometry = NULL;
     PDEVICE_EXTENSION deviceExtension = NULL;
     PDEVICE_EXTENSION physicalDeviceExtension;
     UCHAR          pathId = LunInfo->PathId;
@@ -880,7 +880,7 @@ Return Value:
     // Allocate buffer for drive geometry.
     //
 
-    diskGeometry = ExAllocatePool(NonPagedPool, sizeof(DISK_GEOMETRY));
+    diskGeometry = ExAllocatePool(NonPagedPool, sizeof(DISK_GEOMETRY_EX));
 
     if (diskGeometry == NULL) {
 
@@ -1065,7 +1065,7 @@ CreatePartitionDeviceObjects(
     ULONG          partitionNumber = 0;
     NTSTATUS       status;
     PDEVICE_OBJECT deviceObject = NULL;
-    PDISK_GEOMETRY diskGeometry = NULL;
+    PDISK_GEOMETRY_EX diskGeometry = NULL;
     PDRIVE_LAYOUT_INFORMATION partitionList = NULL;
     PDEVICE_EXTENSION deviceExtension;
     PDEVICE_EXTENSION physicalDeviceExtension;
@@ -1087,7 +1087,7 @@ CreatePartitionDeviceObjects(
 
     physicalDeviceExtension = PhysicalDeviceObject->DeviceExtension;
     diskGeometry = physicalDeviceExtension->DiskGeometry;
-    bytesPerSector = diskGeometry->BytesPerSector;
+    bytesPerSector = diskGeometry->Geometry.BytesPerSector;
 
     //
     // Make sure sector size is not zero.
@@ -1099,7 +1099,7 @@ CreatePartitionDeviceObjects(
         // Default sector size for disk is 512.
         //
 
-        bytesPerSector = diskGeometry->BytesPerSector = 512;
+        bytesPerSector = diskGeometry->Geometry.BytesPerSector = 512;
     }
 
     sectorShift = physicalDeviceExtension->SectorShift;
@@ -1118,7 +1118,7 @@ CreatePartitionDeviceObjects(
     //
 
     HalExamineMBR(PhysicalDeviceObject,
-                  physicalDeviceExtension->DiskGeometry->BytesPerSector,
+                  physicalDeviceExtension->DiskGeometry->Geometry.BytesPerSector,
                   (ULONG)0x54,
                   (PVOID)&dmSkew);
 
@@ -1149,7 +1149,7 @@ CreatePartitionDeviceObjects(
     //
 
     status = IoReadPartitionTable(PhysicalDeviceObject,
-                                  physicalDeviceExtension->DiskGeometry->BytesPerSector,
+                                  physicalDeviceExtension->DiskGeometry->Geometry.BytesPerSector,
                                   TRUE,
                                   (PVOID)&partitionList);
 
@@ -1432,7 +1432,7 @@ CreatePartitionDeviceObjects(
             //
 
             deviceExtension->TimeOutValue = physicalDeviceExtension->TimeOutValue;
-            deviceExtension->DiskGeometry->BytesPerSector = bytesPerSector;
+            deviceExtension->DiskGeometry->Geometry.BytesPerSector = bytesPerSector;
             deviceExtension->SectorShift  = sectorShift;
             deviceExtension->DeviceObject = deviceObject;
             deviceExtension->DeviceFlags |= physicalDeviceExtension->DeviceFlags;
@@ -1512,7 +1512,7 @@ Return Value:
                                transferByteCount);
 
     if ((startingOffset.QuadPart > deviceExtension->PartitionLength.QuadPart) ||
-        (transferByteCount & (deviceExtension->DiskGeometry->BytesPerSector - 1))) {
+        (transferByteCount & (deviceExtension->DiskGeometry->Geometry.BytesPerSector - 1))) {
 
         //
         // This error maybe caused by the fact that the drive is not ready.
@@ -2014,6 +2014,7 @@ Return Value:
     }
 
     case IOCTL_DISK_GET_DRIVE_GEOMETRY:
+    case IOCTL_DISK_GET_DRIVE_GEOMETRY_EX:
         {
 
         PDEVICE_EXTENSION physicalDeviceExtension;
@@ -2021,8 +2022,12 @@ Return Value:
         BOOLEAN           removable = FALSE;
         BOOLEAN           listInitialized = FALSE;
 
-        if ( irpStack->Parameters.DeviceIoControl.OutputBufferLength <
-            sizeof( DISK_GEOMETRY ) ) {
+        if ((irpStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_DISK_GET_DRIVE_GEOMETRY &&
+             irpStack->Parameters.DeviceIoControl.OutputBufferLength <
+            sizeof(DISK_GEOMETRY)) ||
+             (irpStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_DISK_GET_DRIVE_GEOMETRY_EX &&
+             irpStack->Parameters.DeviceIoControl.OutputBufferLength <
+            sizeof(DISK_GEOMETRY_EX))) {
 
             status = STATUS_INFO_LENGTH_MISMATCH;
             break;
@@ -2083,10 +2088,15 @@ Return Value:
 
             RtlMoveMemory(Irp->AssociatedIrp.SystemBuffer,
                           deviceExtension->DiskGeometry,
-                          sizeof(DISK_GEOMETRY));
+                          (irpStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_DISK_GET_DRIVE_GEOMETRY) ?
+                          sizeof(DISK_GEOMETRY) : 
+                          sizeof(DISK_GEOMETRY_EX));
 
             status = STATUS_SUCCESS;
-            Irp->IoStatus.Information = sizeof(DISK_GEOMETRY);
+            Irp->IoStatus.Information =
+               (irpStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_DISK_GET_DRIVE_GEOMETRY) ?
+               sizeof(DISK_GEOMETRY) : 
+               sizeof(DISK_GEOMETRY_EX);
         }
 
         break;
@@ -2285,7 +2295,7 @@ Return Value:
 
             status = IoSetPartitionInformation(
                           deviceExtension->PhysicalDevice,
-                          deviceExtension->DiskGeometry->BytesPerSector,
+                          deviceExtension->DiskGeometry->Geometry.BytesPerSector,
                           diskData->PartitionOrdinal,
                           inputBuffer->PartitionType);
 
@@ -2323,7 +2333,7 @@ Return Value:
             //
 
             status = IoReadPartitionTable(deviceExtension->PhysicalDevice,
-                              deviceExtension->DiskGeometry->BytesPerSector,
+                              deviceExtension->DiskGeometry->Geometry.BytesPerSector,
                               FALSE,
                               &partitionList);
 
@@ -2504,9 +2514,9 @@ Return Value:
 
         status = IoWritePartitionTable(
                            deviceExtension->DeviceObject,
-                           deviceExtension->DiskGeometry->BytesPerSector,
-                           deviceExtension->DiskGeometry->SectorsPerTrack,
-                           deviceExtension->DiskGeometry->TracksPerCylinder,
+                           deviceExtension->DiskGeometry->Geometry.BytesPerSector,
+                           deviceExtension->DiskGeometry->Geometry.SectorsPerTrack,
+                           deviceExtension->DiskGeometry->Geometry.TracksPerCylinder,
                            partitionList);
         }
 
@@ -3455,7 +3465,7 @@ Return Value:
     // Get sector size.
     //
 
-    sectorSize = DeviceExtension->DiskGeometry->BytesPerSector;
+    sectorSize = DeviceExtension->DiskGeometry->Geometry.BytesPerSector;
 
     //
     // Make sure sector size is at least 512 bytes.
@@ -4102,9 +4112,11 @@ diskMatched:
     // Update the actual geometry information.
     //
 
-    DeviceExtension->DiskGeometry->SectorsPerTrack = sectorsPerTrack;
-    DeviceExtension->DiskGeometry->TracksPerCylinder = tracksPerCylinder;
-    DeviceExtension->DiskGeometry->Cylinders.QuadPart = (LONGLONG)cylinders;
+    DeviceExtension->DiskGeometry->Geometry.SectorsPerTrack = sectorsPerTrack;
+    DeviceExtension->DiskGeometry->Geometry.TracksPerCylinder = tracksPerCylinder;
+    DeviceExtension->DiskGeometry->Geometry.Cylinders.QuadPart = (LONGLONG)cylinders;
+    DeviceExtension->DiskGeometry->DiskSize.QuadPart = cylinders * tracksPerCylinder * sectorsPerTrack *
+                                                       DeviceExtension->DiskGeometry->Geometry.BytesPerSector;
 
     DebugPrint((3,
                "SCSIDISK: UpdateGeometry: BIOS spt %x, #heads %x, #cylinders %x\n",
@@ -4119,7 +4131,7 @@ diskMatched:
     if (!DeviceExtension->DMActive) {
 
         HalExamineMBR(DeviceExtension->DeviceObject,
-                      DeviceExtension->DiskGeometry->BytesPerSector,
+                      DeviceExtension->DiskGeometry->Geometry.BytesPerSector,
                       (ULONG)0x55,
                       &tmpPtr
                       );
@@ -4155,18 +4167,19 @@ diskMatched:
 
         cylinders -= 1;
 
-        DeviceExtension->DiskGeometry->Cylinders.QuadPart = cylinders + 1;
-        DeviceExtension->DiskGeometry->TracksPerCylinder = tracksPerCylinder + 1;
+        DeviceExtension->DiskGeometry->Geometry.Cylinders.QuadPart = cylinders + 1;
+        DeviceExtension->DiskGeometry->Geometry.TracksPerCylinder = tracksPerCylinder + 1;
 
         DeviceExtension->PartitionLength.QuadPart =
-            DeviceExtension->DiskGeometry->Cylinders.QuadPart *
-                DeviceExtension->DiskGeometry->SectorsPerTrack *
-                DeviceExtension->DiskGeometry->BytesPerSector *
-                DeviceExtension->DiskGeometry->TracksPerCylinder;
+        DeviceExtension->DiskGeometry->DiskSize.QuadPart =
+            DeviceExtension->DiskGeometry->Geometry.Cylinders.QuadPart *
+                DeviceExtension->DiskGeometry->Geometry.SectorsPerTrack *
+                DeviceExtension->DiskGeometry->Geometry.BytesPerSector *
+                DeviceExtension->DiskGeometry->Geometry.TracksPerCylinder;
 
         if (DeviceExtension->DMActive) {
 
-            DeviceExtension->DMByteSkew = DeviceExtension->DMSkew * DeviceExtension->DiskGeometry->BytesPerSector;
+            DeviceExtension->DMByteSkew = DeviceExtension->DMSkew * DeviceExtension->DiskGeometry->Geometry.BytesPerSector;
 
         }
 
@@ -4250,7 +4263,7 @@ Return Value:
     //
 
     status = IoReadPartitionTable(deviceExtension->PhysicalDevice,
-                      deviceExtension->DiskGeometry->BytesPerSector,
+                      deviceExtension->DiskGeometry->Geometry.BytesPerSector,
                       TRUE,
                       &partitionList);
 
index efd55a7..48aa271 100644 (file)
@@ -112,7 +112,7 @@ typedef struct _DEVICE_EXTENSION
   PCLASS_CREATE_CLOSE ClassCreateClose;
   PDRIVER_STARTIO ClassStartIo;
   PIO_SCSI_CAPABILITIES PortCapabilities;
-  PDISK_GEOMETRY DiskGeometry;
+  PDISK_GEOMETRY_EX DiskGeometry;
   PDEVICE_OBJECT PhysicalDevice;
   PSENSE_DATA SenseData;
   ULONG TimeOutValue;