mirror of
https://github.com/reactos/reactos.git
synced 2025-04-05 21:21:33 +00:00
** wip ** Investigate PartitionNumber on partmgr side
This commit is contained in:
parent
d0af99fcad
commit
b063438248
3 changed files with 25 additions and 17 deletions
|
@ -89,8 +89,8 @@ PartitionCreateDevice(
|
|||
partExt->DeviceName = deviceName;
|
||||
partExt->StartingOffset = PartitionEntry->StartingOffset.QuadPart;
|
||||
partExt->PartitionLength = PartitionEntry->PartitionLength.QuadPart;
|
||||
partExt->OnDiskNumber = PartitionEntry->PartitionNumber; // the "physical" partition number
|
||||
partExt->DetectedNumber = PdoNumber; // counts only partitions with PDO created
|
||||
partExt->OnDiskNumber = PartitionEntry->PartitionNumber; // The on-disk partition ordinal // HACK: using PartitionEntry->PartitionNumber is hackish
|
||||
partExt->DetectedNumber = PdoNumber; // Counts only partitions with PDO created
|
||||
partExt->VolumeNumber = volumeNum;
|
||||
|
||||
// The device is initialized
|
||||
|
@ -114,7 +114,7 @@ PartitionHandleStartDevice(
|
|||
UNICODE_STRING partitionSymlink, interfaceName;
|
||||
PFDO_EXTENSION fdoExtension = PartExt->LowerDevice->DeviceExtension;
|
||||
|
||||
// \\Device\\Harddisk%lu\\Partition%lu
|
||||
// "\\Device\\Harddisk%lu\\Partition%lu"
|
||||
swprintf(nameBuf, PartitionSymLinkFormat,
|
||||
fdoExtension->DiskData.DeviceNumber, PartExt->DetectedNumber);
|
||||
|
||||
|
@ -296,6 +296,7 @@ PartitionHandleRemove(
|
|||
UNICODE_STRING partitionSymlink;
|
||||
PFDO_EXTENSION fdoExtension = PartExt->LowerDevice->DeviceExtension;
|
||||
|
||||
// "\\Device\\Harddisk%lu\\Partition%lu"
|
||||
swprintf(nameBuf, PartitionSymLinkFormat,
|
||||
fdoExtension->DiskData.DeviceNumber, PartExt->DetectedNumber);
|
||||
|
||||
|
@ -685,12 +686,11 @@ PartitionHandleDeviceControl(
|
|||
|
||||
PartMgrAcquireLayoutLock(fdoExtension);
|
||||
|
||||
// these functions use on disk numbers, not detected ones
|
||||
// This function uses on-disk (ordinal) partition numbers, not detected ones
|
||||
status = IoSetPartitionInformation(fdoExtension->LowerDevice,
|
||||
fdoExtension->DiskData.BytesPerSector,
|
||||
partExt->OnDiskNumber,
|
||||
inputBuffer->PartitionType);
|
||||
|
||||
if (NT_SUCCESS(status))
|
||||
{
|
||||
partExt->Mbr.PartitionType = inputBuffer->PartitionType;
|
||||
|
@ -712,11 +712,10 @@ PartitionHandleDeviceControl(
|
|||
|
||||
PartMgrAcquireLayoutLock(fdoExtension);
|
||||
|
||||
// these functions use on disk numbers, not detected ones
|
||||
// This function uses on-disk (ordinal) partition numbers, not detected ones
|
||||
status = IoSetPartitionInformationEx(fdoExtension->LowerDevice,
|
||||
partExt->OnDiskNumber,
|
||||
inputBuffer);
|
||||
|
||||
if (NT_SUCCESS(status))
|
||||
{
|
||||
if (fdoExtension->DiskData.PartitionStyle == PARTITION_STYLE_MBR)
|
||||
|
|
|
@ -269,8 +269,8 @@ PartMgrUpdatePartitionDevices(
|
|||
RtlCopyMemory(partExt->Gpt.Name, partEntry->Gpt.Name, sizeof(partExt->Gpt.Name));
|
||||
}
|
||||
|
||||
partExt->OnDiskNumber = partNumber;
|
||||
partEntry->PartitionNumber = partNumber; // mark it as a found one
|
||||
partExt->OnDiskNumber = partNumber; // HACK??
|
||||
partEntry->PartitionNumber = partNumber; // HACK?? // mark it as a found one
|
||||
totalPartitions++;
|
||||
}
|
||||
else
|
||||
|
@ -332,7 +332,7 @@ PartMgrUpdatePartitionDevices(
|
|||
}
|
||||
}
|
||||
|
||||
partEntry->PartitionNumber = partNumber;
|
||||
partEntry->PartitionNumber = partNumber; // HACK for the partition ordinal
|
||||
|
||||
PDEVICE_OBJECT partitionDevice;
|
||||
status = PartitionCreateDevice(FdoExtension->DeviceObject,
|
||||
|
@ -352,7 +352,7 @@ PartMgrUpdatePartitionDevices(
|
|||
|
||||
totalPartitions++;
|
||||
|
||||
// insert the structure to the partition list
|
||||
// insert the structure in the partition list
|
||||
curEntry = FdoExtension->PartitionList.Next;
|
||||
prevEntry = NULL;
|
||||
while (curEntry != NULL)
|
||||
|
@ -360,7 +360,7 @@ PartMgrUpdatePartitionDevices(
|
|||
PPARTITION_EXTENSION curPart = CONTAINING_RECORD(curEntry,
|
||||
PARTITION_EXTENSION,
|
||||
ListEntry);
|
||||
if (curPart->OnDiskNumber < partNumber)
|
||||
if (curPart->OnDiskNumber < partNumber) // HACK: Investigate: should this be OnDiskNumber, or DetectedNumber/PdoNumber?
|
||||
{
|
||||
prevEntry = curEntry;
|
||||
curEntry = curPart->ListEntry.Next;
|
||||
|
|
|
@ -97,12 +97,21 @@ typedef struct _PARTITION_EXTENSION
|
|||
UINT64 PartitionLength;
|
||||
SINGLE_LIST_ENTRY ListEntry;
|
||||
|
||||
UINT32 VolumeNumber; // Volume number in the "\Device\HarddiskVolumeN" device name
|
||||
/* Volume number in the "\Device\HarddiskVolumeN" name */
|
||||
UINT32 VolumeNumber;
|
||||
|
||||
/* Partition number in the "\Device\HarddiskX\PartitionN" symlink name;
|
||||
* it is assigned to a partition in order to identify it to the system
|
||||
* and corresponds to the PDO number given to PartitionCreateDevice() */
|
||||
UINT32 DetectedNumber;
|
||||
UINT32 OnDiskNumber; // partition number for issuing Io requests to the kernel
|
||||
BOOLEAN IsEnumerated; // reported via IRP_MN_QUERY_DEVICE_RELATIONS
|
||||
|
||||
/* Partition ordinal (i.e. the order of the partition on a disk),
|
||||
* used for calling IoSetPartitionInformation(Ex)() API */
|
||||
UINT32 OnDiskNumber;
|
||||
|
||||
BOOLEAN IsEnumerated; //< Reported via IRP_MN_QUERY_DEVICE_RELATIONS
|
||||
BOOLEAN SymlinkCreated;
|
||||
BOOLEAN Attached; // attached to PartitionList of the FDO
|
||||
BOOLEAN Attached; //< Attached to PartitionList of the FDO
|
||||
union
|
||||
{
|
||||
struct
|
||||
|
@ -130,7 +139,7 @@ NTSTATUS
|
|||
PartitionCreateDevice(
|
||||
_In_ PDEVICE_OBJECT FDObject,
|
||||
_In_ PPARTITION_INFORMATION_EX PartitionEntry,
|
||||
_In_ UINT32 OnDiskNumber,
|
||||
_In_ UINT32 PdoNumber,
|
||||
_In_ PARTITION_STYLE PartitionStyle,
|
||||
_Out_ PDEVICE_OBJECT *PDO);
|
||||
|
||||
|
|
Loading…
Reference in a new issue