mirror of
https://github.com/reactos/reactos.git
synced 2025-04-27 17:10:22 +00:00
[DISK] Properly implement querying partition information for partition 0.
In spite of what was implemented in our NT DDK sample, this is a legit operation. This may have been turned legit starting NT5 (reminder, our implementation is NT4 based...). So, in this situation, just return the information about the whole disk (and not a random size) and also, mark everything with default values. See disk_new for an example of how it works in NT5+. CORE-14124
This commit is contained in:
parent
1db8bd46d6
commit
b9b461bde9
1 changed files with 45 additions and 34 deletions
|
@ -2235,58 +2235,69 @@ Return Value:
|
|||
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 {
|
||||
|
||||
//
|
||||
// Note the drive is now ready.
|
||||
//
|
||||
|
||||
diskData->DriveNotReady = FALSE;
|
||||
|
||||
//
|
||||
// Handle the case were we query the whole disk
|
||||
//
|
||||
|
||||
if (diskData->PartitionNumber == 0) {
|
||||
|
||||
PPARTITION_INFORMATION outputBuffer;
|
||||
|
||||
if (diskData->PartitionNumber == 0) {
|
||||
DPRINT1("HACK: Handling partition 0 request!\n");
|
||||
//ASSERT(FALSE);
|
||||
}
|
||||
outputBuffer =
|
||||
(PPARTITION_INFORMATION)Irp->AssociatedIrp.SystemBuffer;
|
||||
|
||||
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;
|
||||
|
||||
//
|
||||
// Update the geometry in case it has changed.
|
||||
// We query a single partition here
|
||||
// FIXME: this can only work for MBR-based disks, check for this!
|
||||
//
|
||||
|
||||
status = UpdateRemovableGeometry (DeviceObject, Irp);
|
||||
|
||||
if (!NT_SUCCESS(status)) {
|
||||
|
||||
//
|
||||
// Note the drive is not ready.
|
||||
//
|
||||
|
||||
diskData->DriveNotReady = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Note the drive is now ready.
|
||||
//
|
||||
|
||||
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;
|
||||
|
|
Loading…
Reference in a new issue