mirror of
https://github.com/reactos/reactos.git
synced 2025-05-22 18:45:00 +00:00
[SETUPLIB] Partitioning code fixes and improvements.
CORE-7749 - Correctly insert discovered partitions in sorted order of StartSector, and verify that they do not overlap (-> check for broken partitioning). May help for CORE-10898. - Use the correct reported partition numbers that may be modified after partitioning changes, and that need to be used when opening \Device\Harddisk'M'\Partition'N' files. This is achieving by retrieving the returned value of the IOCTL_DISK_SET_DRIVE_LAYOUT call. Distinguish them from the "on-disk" partition numbers that are the ones that enumerate the partition in partition-table order (and is the order known by e.g. the BIOS), and that should be used to construct the destination ARC path. May help for CORE-4870, CORE-13205. - Simplify a lot of duplicated code by using helper functions.
This commit is contained in:
parent
958ae44599
commit
7df9296692
3 changed files with 417 additions and 386 deletions
|
@ -642,7 +642,7 @@ InitDestinationPaths(
|
|||
RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
|
||||
L"multi(0)disk(0)rdisk(%lu)partition(%lu)\\",
|
||||
DiskEntry->BiosDiskNumber,
|
||||
PartEntry->PartitionNumber);
|
||||
PartEntry->OnDiskPartitionNumber);
|
||||
ConcatPaths(PathBuffer, ARRAYSIZE(PathBuffer), 1, InstallationDir);
|
||||
RtlCreateUnicodeString(&pSetupData->DestinationArcPath, PathBuffer);
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -46,8 +46,9 @@ typedef struct _PARTENTRY
|
|||
BOOLEAN BootIndicator;
|
||||
UCHAR PartitionType;
|
||||
ULONG HiddenSectors;
|
||||
ULONG PartitionNumber; /* Enumerated partition number (primary partitions first -- excluding the extended partition container --, then the logical partitions) */
|
||||
ULONG PartitionIndex; /* Index in the LayoutBuffer->PartitionEntry[] cached array of the corresponding DiskEntry */
|
||||
ULONG OnDiskPartitionNumber; /* Enumerated partition number (primary partitions first, excluding the extended partition container, then the logical partitions) */
|
||||
ULONG PartitionNumber; /* Current partition number, only valid for the currently running NTOS instance */
|
||||
ULONG PartitionIndex; /* Index in the LayoutBuffer->PartitionEntry[] cached array of the corresponding DiskEntry */
|
||||
|
||||
WCHAR DriveLetter;
|
||||
WCHAR VolumeLabel[20];
|
||||
|
@ -116,8 +117,8 @@ typedef struct _DISKENTRY
|
|||
/* Has the partition list been modified? */
|
||||
BOOLEAN Dirty;
|
||||
|
||||
BOOLEAN NewDisk;
|
||||
BOOLEAN NoMbr; /* MBR is absent */ // See r40437
|
||||
BOOLEAN NewDisk; /* If TRUE, the disk is uninitialized */
|
||||
BOOLEAN NoMbr; /* If TRUE, the MBR is absent */ // See r40437
|
||||
|
||||
UNICODE_STRING DriverName;
|
||||
|
||||
|
@ -127,11 +128,11 @@ typedef struct _DISKENTRY
|
|||
// the disk is MBR, GPT, or unknown (uninitialized).
|
||||
// Depending on the style, either use the MBR or GPT partition info.
|
||||
|
||||
/* Pointer to the unique extended partition on this disk */
|
||||
PPARTENTRY ExtendedPartition;
|
||||
LIST_ENTRY PrimaryPartListHead; /* List of primary partitions */
|
||||
LIST_ENTRY LogicalPartListHead; /* List of logical partitions (Valid only for MBR-partitioned disks) */
|
||||
|
||||
LIST_ENTRY PrimaryPartListHead;
|
||||
LIST_ENTRY LogicalPartListHead;
|
||||
/* Pointer to the unique extended partition on this disk (Valid only for MBR-partitioned disks) */
|
||||
PPARTENTRY ExtendedPartition;
|
||||
|
||||
} DISKENTRY, *PDISKENTRY;
|
||||
|
||||
|
|
Loading…
Reference in a new issue