Author: fireball Date: Thu Apr 9 16:42:09 2009 New Revision: 40428
URL: http://svn.reactos.org/svn/reactos?rev=40428&view=rev Log: - Recognize up to 4 partitions inside every primary partition table. However, installation will be performed to the first partition anyway.
Modified: trunk/reactos/base/setup/usetup/partlist.c trunk/reactos/base/setup/usetup/partlist.h
Modified: trunk/reactos/base/setup/usetup/partlist.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/partlist.... ============================================================================== --- trunk/reactos/base/setup/usetup/partlist.c [iso-8859-1] (original) +++ trunk/reactos/base/setup/usetup/partlist.c [iso-8859-1] Thu Apr 9 16:42:09 2009 @@ -928,6 +928,7 @@
List->CurrentDisk = NULL; List->CurrentPartition = NULL; + List->CurrentPartitionNumber = 0;
InitializeListHead (&List->DiskListHead); InitializeListHead (&List->BiosDiskListHead); @@ -984,6 +985,7 @@ { List->CurrentDisk = NULL; List->CurrentPartition = NULL; + List->CurrentPartitionNumber = 0; } else { @@ -995,6 +997,7 @@ if (IsListEmpty (&List->CurrentDisk->PartListHead)) { List->CurrentPartition = 0; + List->CurrentPartitionNumber = 0; } else { @@ -1002,6 +1005,7 @@ CONTAINING_RECORD (List->CurrentDisk->PartListHead.Flink, PARTENTRY, ListEntry); + List->CurrentPartitionNumber = 0; } }
@@ -1091,7 +1095,8 @@ static VOID PrintPartitionData (PPARTLIST List, PDISKENTRY DiskEntry, - PPARTENTRY PartEntry) + PPARTENTRY PartEntry, + ULONG PartNumber) { CHAR LineBuffer[128]; COORD coPos; @@ -1147,44 +1152,44 @@ } else if (PartEntry->Unpartitioned == FALSE) { - if ((PartEntry->PartInfo[0].PartitionType == PARTITION_FAT_12) || - (PartEntry->PartInfo[0].PartitionType == PARTITION_FAT_16) || - (PartEntry->PartInfo[0].PartitionType == PARTITION_HUGE) || - (PartEntry->PartInfo[0].PartitionType == PARTITION_XINT13)) + if ((PartEntry->PartInfo[PartNumber].PartitionType == PARTITION_FAT_12) || + (PartEntry->PartInfo[PartNumber].PartitionType == PARTITION_FAT_16) || + (PartEntry->PartInfo[PartNumber].PartitionType == PARTITION_HUGE) || + (PartEntry->PartInfo[PartNumber].PartitionType == PARTITION_XINT13)) { PartType = "FAT"; } - else if ((PartEntry->PartInfo[0].PartitionType == PARTITION_FAT32) || - (PartEntry->PartInfo[0].PartitionType == PARTITION_FAT32_XINT13)) + else if ((PartEntry->PartInfo[PartNumber].PartitionType == PARTITION_FAT32) || + (PartEntry->PartInfo[PartNumber].PartitionType == PARTITION_FAT32_XINT13)) { PartType = "FAT32"; } - else if (PartEntry->PartInfo[0].PartitionType == PARTITION_EXT2) + else if (PartEntry->PartInfo[PartNumber].PartitionType == PARTITION_EXT2) { PartType = "EXT2"; } - else if (PartEntry->PartInfo[0].PartitionType == PARTITION_IFS) + else if (PartEntry->PartInfo[PartNumber].PartitionType == PARTITION_IFS) { PartType = "NTFS"; /* FIXME: Not quite correct! */ } }
#if 0 - if (PartEntry->PartInfo[0].PartitionLength.QuadPart >= 0x280000000LL) /* 10 GB */ - { - PartSize.QuadPart = (PartEntry->PartInfo[0].PartitionLength.QuadPart + (1 << 29)) >> 30; + if (PartEntry->PartInfo[PartNumber].PartitionLength.QuadPart >= 0x280000000LL) /* 10 GB */ + { + PartSize.QuadPart = (PartEntry->PartInfo[PartNumber].PartitionLength.QuadPart + (1 << 29)) >> 30; Unit = MUIGetString(STRING_GB); } else #endif - if (PartEntry->PartInfo[0].PartitionLength.QuadPart >= 0xA00000LL) /* 10 MB */ - { - PartSize.QuadPart = (PartEntry->PartInfo[0].PartitionLength.QuadPart + (1 << 19)) >> 20; + if (PartEntry->PartInfo[PartNumber].PartitionLength.QuadPart >= 0xA00000LL) /* 10 MB */ + { + PartSize.QuadPart = (PartEntry->PartInfo[PartNumber].PartitionLength.QuadPart + (1 << 19)) >> 20; Unit = MUIGetString(STRING_MB); } else { - PartSize.QuadPart = (PartEntry->PartInfo[0].PartitionLength.QuadPart + (1 << 9)) >> 10; + PartSize.QuadPart = (PartEntry->PartInfo[PartNumber].PartitionLength.QuadPart + (1 << 9)) >> 10; Unit = MUIGetString(STRING_KB); }
@@ -1194,7 +1199,7 @@ MUIGetString(STRING_HDDINFOUNK5), (PartEntry->DriveLetter == 0) ? '-' : PartEntry->DriveLetter, (PartEntry->DriveLetter == 0) ? '-' : ':', - PartEntry->PartInfo[0].PartitionType, + PartEntry->PartInfo[PartNumber].PartitionType, PartSize.u.LowPart, Unit); } @@ -1211,7 +1216,8 @@ }
Attribute = (List->CurrentDisk == DiskEntry && - List->CurrentPartition == PartEntry) ? + List->CurrentPartition == PartEntry && + List->CurrentPartitionNumber == PartNumber) ? FOREGROUND_BLUE | BACKGROUND_WHITE : FOREGROUND_WHITE | BACKGROUND_BLUE;
@@ -1259,6 +1265,7 @@ USHORT Height; ULARGE_INTEGER DiskSize; PCHAR Unit; + ULONG i;
Width = List->Right - List->Left - 1; Height = List->Bottom - List->Top - 2; @@ -1338,9 +1345,16 @@ LIST_FOR_EACH(PartEntry, &DiskEntry->PartListHead, PARTENTRY, ListEntry) { /* Print disk entry */ - PrintPartitionData (List, - DiskEntry, - PartEntry); + for (i=0; i<4; i++) + { + if (PartEntry->PartInfo[i].PartitionType != PARTITION_ENTRY_UNUSED) + { + PrintPartitionData (List, + DiskEntry, + PartEntry, + i); + } + } }
/* Print separator line */ @@ -1589,6 +1603,7 @@ { List->CurrentDisk = DiskEntry; List->CurrentPartition = PartEntry; + List->CurrentPartitionNumber = i; DrawPartitionList (List); return TRUE; } @@ -1610,6 +1625,7 @@ PPARTENTRY PartEntry; PLIST_ENTRY Entry1; PLIST_ENTRY Entry2; + UCHAR i;
/* Check for empty disks */ if (IsListEmpty (&List->DiskListHead)) @@ -1618,7 +1634,30 @@ /* Check for next usable entry on current disk */ if (List->CurrentPartition != NULL) { - Entry2 = List->CurrentPartition->ListEntry.Flink; + Entry2 = &List->CurrentPartition->ListEntry; + PartEntry = CONTAINING_RECORD (Entry2, PARTENTRY, ListEntry); + + /* Check if we can move inside primary partitions */ + for (i = List->CurrentPartitionNumber + 1; i < 4; i++) + { + if (PartEntry->PartInfo[i].PartitionType != PARTITION_ENTRY_UNUSED) + break; + } + + if (i == 4) + { + /* We're out of partitions in the current partition table. + Try to move to the next one if possible. */ + Entry2 = Entry2->Flink; + } + else + { + /* Just advance to the next partition */ + List->CurrentPartitionNumber = i; + DrawPartitionList (List); + return; + } + while (Entry2 != &List->CurrentDisk->PartListHead) { PartEntry = CONTAINING_RECORD (Entry2, PARTENTRY, ListEntry); @@ -1626,6 +1665,7 @@ // if (PartEntry->HidePartEntry == FALSE) { List->CurrentPartition = PartEntry; + List->CurrentPartitionNumber = 0; DrawPartitionList (List); return; } @@ -1650,6 +1690,7 @@ { List->CurrentDisk = DiskEntry; List->CurrentPartition = PartEntry; + List->CurrentPartitionNumber = 0; DrawPartitionList (List); return; } @@ -1670,6 +1711,7 @@ PPARTENTRY PartEntry; PLIST_ENTRY Entry1; PLIST_ENTRY Entry2; + UCHAR i;
/* Check for empty disks */ if (IsListEmpty (&List->DiskListHead)) @@ -1678,7 +1720,28 @@ /* check for previous usable entry on current disk */ if (List->CurrentPartition != NULL) { - Entry2 = List->CurrentPartition->ListEntry.Blink; + Entry2 = &List->CurrentPartition->ListEntry; + PartEntry = CONTAINING_RECORD (Entry2, PARTENTRY, ListEntry); + + /* Check if we can move inside primary partitions */ + if (List->CurrentPartitionNumber > 0) + { + /* Find a previous partition */ + for (i = List->CurrentPartitionNumber - 1; i > 0; i--) + { + if (PartEntry->PartInfo[i].PartitionType != PARTITION_ENTRY_UNUSED) + break; + } + + /* Move to it and return */ + List->CurrentPartitionNumber = i; + DrawPartitionList (List); + return; + } + + /* Move to the previous entry */ + Entry2 = Entry2->Blink; + while (Entry2 != &List->CurrentDisk->PartListHead) { PartEntry = CONTAINING_RECORD (Entry2, PARTENTRY, ListEntry); @@ -1686,6 +1749,18 @@ // if (PartEntry->HidePartEntry == FALSE) { List->CurrentPartition = PartEntry; + + /* Find last existing partition in the table */ + for (i = 3; i > 0; i--) + { + if (PartEntry->PartInfo[i].PartitionType != PARTITION_ENTRY_UNUSED) + break; + } + + /* Move to it */ + List->CurrentPartitionNumber = i; + + /* Draw partition list and return */ DrawPartitionList (List); return; } @@ -1711,6 +1786,18 @@ { List->CurrentDisk = DiskEntry; List->CurrentPartition = PartEntry; + + /* Find last existing partition in the table */ + for (i = 3; i > 0; i--) + { + if (PartEntry->PartInfo[i].PartitionType != PARTITION_ENTRY_UNUSED) + break; + } + + /* Move to it */ + List->CurrentPartitionNumber = i; + + /* Draw partition list and return */ DrawPartitionList (List); return; }
Modified: trunk/reactos/base/setup/usetup/partlist.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/partlist.... ============================================================================== --- trunk/reactos/base/setup/usetup/partlist.h [iso-8859-1] (original) +++ trunk/reactos/base/setup/usetup/partlist.h [iso-8859-1] Thu Apr 9 16:42:09 2009 @@ -132,6 +132,7 @@
PDISKENTRY CurrentDisk; PPARTENTRY CurrentPartition; + UCHAR CurrentPartitionNumber;
PDISKENTRY ActiveBootDisk; PPARTENTRY ActiveBootPartition;