Check for removable media and Partition length is 0, for DiskClassCheckReadWrite.
authorJames Tabor <james.tabor@reactos.org>
Sun, 27 Feb 2005 21:17:24 +0000 (21:17 +0000)
committerJames Tabor <james.tabor@reactos.org>
Sun, 27 Feb 2005 21:17:24 +0000 (21:17 +0000)
svn path=/trunk/; revision=13768

reactos/drivers/storage/disk/disk.c

index 2d68cf8..b0e8904 100644 (file)
@@ -406,10 +406,26 @@ DiskClassCheckReadWrite(IN PDEVICE_OBJECT DeviceObject,
       return(STATUS_INVALID_PARAMETER);
     }
 
       return(STATUS_INVALID_PARAMETER);
     }
 
+
+
   IrpStack = IoGetCurrentIrpStackLocation(Irp);  
   EndingOffset.QuadPart = IrpStack->Parameters.Read.ByteOffset.QuadPart +
                           IrpStack->Parameters.Read.Length;
 
   IrpStack = IoGetCurrentIrpStackLocation(Irp);  
   EndingOffset.QuadPart = IrpStack->Parameters.Read.ByteOffset.QuadPart +
                           IrpStack->Parameters.Read.Length;
 
+
+  DPRINT("Ending %I64d, and RealEnding %I64d! PartSize %I64d\n",EndingOffset.QuadPart,
+          DeviceExtension->PartitionLength.QuadPart,
+         DeviceExtension->PartitionLength.QuadPart /
+          DeviceExtension->DiskGeometry->BytesPerSector);
+
+  if ((DeviceObject->Characteristics & FILE_REMOVABLE_MEDIA) &&
+      (DeviceExtension->DiskGeometry->MediaType == RemovableMedia))
+    {
+/* Assume if removable media and if Partition length is 0, Partition not built yet! */
+       if (DeviceExtension->PartitionLength.QuadPart == 0)
+            return(STATUS_SUCCESS);
+    }
+
   if (EndingOffset.QuadPart > DeviceExtension->PartitionLength.QuadPart)
     {
       Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
   if (EndingOffset.QuadPart > DeviceExtension->PartitionLength.QuadPart)
     {
       Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;