sizeof(PARTITION_INFORMATION)) {
status = STATUS_INFO_LENGTH_MISMATCH;
-
+ break;
}
-#if 0 // HACK: ReactOS partition numbers must be wrong
- else if (diskData->PartitionNumber == 0) {
+
+ //
+ // Update the geometry in case it has changed.
+ //
+
+ status = UpdateRemovableGeometry (DeviceObject, Irp);
+
+ if (!NT_SUCCESS(status)) {
//
- // Partition zero is not a partition so this is not a
- // reasonable request.
+ // Note the drive is not ready.
//
- status = STATUS_INVALID_DEVICE_REQUEST;
-
+ diskData->DriveNotReady = TRUE;
+ break;
}
-#endif
- else {
- PPARTITION_INFORMATION outputBuffer;
+ //
+ // Note the drive is now ready.
+ //
- if (diskData->PartitionNumber == 0) {
- DPRINT1("HACK: Handling partition 0 request!\n");
- //ASSERT(FALSE);
- }
+ diskData->DriveNotReady = FALSE;
- //
- // Update the geometry in case it has changed.
- //
+ //
+ // Handle the case were we query the whole disk
+ //
- status = UpdateRemovableGeometry (DeviceObject, Irp);
+ if (diskData->PartitionNumber == 0) {
- if (!NT_SUCCESS(status)) {
+ PPARTITION_INFORMATION outputBuffer;
- //
- // Note the drive is not ready.
- //
+ outputBuffer =
+ (PPARTITION_INFORMATION)Irp->AssociatedIrp.SystemBuffer;
- diskData->DriveNotReady = TRUE;
- break;
- }
+ outputBuffer->PartitionType = PARTITION_ENTRY_UNUSED;
+ outputBuffer->StartingOffset = deviceExtension->StartingOffset;
+ outputBuffer->PartitionLength.QuadPart = deviceExtension->PartitionLength.QuadPart;
+ outputBuffer->HiddenSectors = 0;
+ outputBuffer->PartitionNumber = diskData->PartitionNumber;
+ outputBuffer->BootIndicator = FALSE;
+ outputBuffer->RewritePartition = FALSE;
+ outputBuffer->RecognizedPartition = FALSE;
+
+ status = STATUS_SUCCESS;
+ Irp->IoStatus.Information = sizeof(PARTITION_INFORMATION);
+
+ } else {
+
+ PPARTITION_INFORMATION outputBuffer;
//
- // Note the drive is now ready.
+ // We query a single partition here
+ // FIXME: this can only work for MBR-based disks, check for this!
//
- diskData->DriveNotReady = FALSE;
-
outputBuffer =
(PPARTITION_INFORMATION)Irp->AssociatedIrp.SystemBuffer;
outputBuffer->PartitionType = diskData->PartitionType;
outputBuffer->StartingOffset = deviceExtension->StartingOffset;
- outputBuffer->PartitionLength.QuadPart = (diskData->PartitionNumber) ?
- deviceExtension->PartitionLength.QuadPart : 0x1FFFFFFFFFFFFFFFLL; // HACK
+ outputBuffer->PartitionLength.QuadPart = deviceExtension->PartitionLength.QuadPart;
outputBuffer->HiddenSectors = diskData->HiddenSectors;
outputBuffer->PartitionNumber = diskData->PartitionNumber;
outputBuffer->BootIndicator = diskData->BootIndicator;