- Recognize up to 4 partitions inside every primary partition table. However, installation will be performed to the first partition anyway.

svn path=/trunk/; revision=40428
This commit is contained in:
Aleksey Bragin 2009-04-09 12:42:09 +00:00
parent 8cd1519932
commit fbd73e2e9e
2 changed files with 109 additions and 21 deletions

View file

@ -928,6 +928,7 @@ CreatePartitionList (SHORT Left,
List->CurrentDisk = NULL; List->CurrentDisk = NULL;
List->CurrentPartition = NULL; List->CurrentPartition = NULL;
List->CurrentPartitionNumber = 0;
InitializeListHead (&List->DiskListHead); InitializeListHead (&List->DiskListHead);
InitializeListHead (&List->BiosDiskListHead); InitializeListHead (&List->BiosDiskListHead);
@ -984,6 +985,7 @@ CreatePartitionList (SHORT Left,
{ {
List->CurrentDisk = NULL; List->CurrentDisk = NULL;
List->CurrentPartition = NULL; List->CurrentPartition = NULL;
List->CurrentPartitionNumber = 0;
} }
else else
{ {
@ -995,6 +997,7 @@ CreatePartitionList (SHORT Left,
if (IsListEmpty (&List->CurrentDisk->PartListHead)) if (IsListEmpty (&List->CurrentDisk->PartListHead))
{ {
List->CurrentPartition = 0; List->CurrentPartition = 0;
List->CurrentPartitionNumber = 0;
} }
else else
{ {
@ -1002,6 +1005,7 @@ CreatePartitionList (SHORT Left,
CONTAINING_RECORD (List->CurrentDisk->PartListHead.Flink, CONTAINING_RECORD (List->CurrentDisk->PartListHead.Flink,
PARTENTRY, PARTENTRY,
ListEntry); ListEntry);
List->CurrentPartitionNumber = 0;
} }
} }
@ -1091,7 +1095,8 @@ PrintEmptyLine (PPARTLIST List)
static VOID static VOID
PrintPartitionData (PPARTLIST List, PrintPartitionData (PPARTLIST List,
PDISKENTRY DiskEntry, PDISKENTRY DiskEntry,
PPARTENTRY PartEntry) PPARTENTRY PartEntry,
ULONG PartNumber)
{ {
CHAR LineBuffer[128]; CHAR LineBuffer[128];
COORD coPos; COORD coPos;
@ -1147,44 +1152,44 @@ PrintPartitionData (PPARTLIST List,
} }
else if (PartEntry->Unpartitioned == FALSE) else if (PartEntry->Unpartitioned == FALSE)
{ {
if ((PartEntry->PartInfo[0].PartitionType == PARTITION_FAT_12) || if ((PartEntry->PartInfo[PartNumber].PartitionType == PARTITION_FAT_12) ||
(PartEntry->PartInfo[0].PartitionType == PARTITION_FAT_16) || (PartEntry->PartInfo[PartNumber].PartitionType == PARTITION_FAT_16) ||
(PartEntry->PartInfo[0].PartitionType == PARTITION_HUGE) || (PartEntry->PartInfo[PartNumber].PartitionType == PARTITION_HUGE) ||
(PartEntry->PartInfo[0].PartitionType == PARTITION_XINT13)) (PartEntry->PartInfo[PartNumber].PartitionType == PARTITION_XINT13))
{ {
PartType = "FAT"; PartType = "FAT";
} }
else if ((PartEntry->PartInfo[0].PartitionType == PARTITION_FAT32) || else if ((PartEntry->PartInfo[PartNumber].PartitionType == PARTITION_FAT32) ||
(PartEntry->PartInfo[0].PartitionType == PARTITION_FAT32_XINT13)) (PartEntry->PartInfo[PartNumber].PartitionType == PARTITION_FAT32_XINT13))
{ {
PartType = "FAT32"; PartType = "FAT32";
} }
else if (PartEntry->PartInfo[0].PartitionType == PARTITION_EXT2) else if (PartEntry->PartInfo[PartNumber].PartitionType == PARTITION_EXT2)
{ {
PartType = "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! */ PartType = "NTFS"; /* FIXME: Not quite correct! */
} }
} }
#if 0 #if 0
if (PartEntry->PartInfo[0].PartitionLength.QuadPart >= 0x280000000LL) /* 10 GB */ if (PartEntry->PartInfo[PartNumber].PartitionLength.QuadPart >= 0x280000000LL) /* 10 GB */
{ {
PartSize.QuadPart = (PartEntry->PartInfo[0].PartitionLength.QuadPart + (1 << 29)) >> 30; PartSize.QuadPart = (PartEntry->PartInfo[PartNumber].PartitionLength.QuadPart + (1 << 29)) >> 30;
Unit = MUIGetString(STRING_GB); Unit = MUIGetString(STRING_GB);
} }
else else
#endif #endif
if (PartEntry->PartInfo[0].PartitionLength.QuadPart >= 0xA00000LL) /* 10 MB */ if (PartEntry->PartInfo[PartNumber].PartitionLength.QuadPart >= 0xA00000LL) /* 10 MB */
{ {
PartSize.QuadPart = (PartEntry->PartInfo[0].PartitionLength.QuadPart + (1 << 19)) >> 20; PartSize.QuadPart = (PartEntry->PartInfo[PartNumber].PartitionLength.QuadPart + (1 << 19)) >> 20;
Unit = MUIGetString(STRING_MB); Unit = MUIGetString(STRING_MB);
} }
else 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); Unit = MUIGetString(STRING_KB);
} }
@ -1194,7 +1199,7 @@ PrintPartitionData (PPARTLIST List,
MUIGetString(STRING_HDDINFOUNK5), MUIGetString(STRING_HDDINFOUNK5),
(PartEntry->DriveLetter == 0) ? '-' : PartEntry->DriveLetter, (PartEntry->DriveLetter == 0) ? '-' : PartEntry->DriveLetter,
(PartEntry->DriveLetter == 0) ? '-' : ':', (PartEntry->DriveLetter == 0) ? '-' : ':',
PartEntry->PartInfo[0].PartitionType, PartEntry->PartInfo[PartNumber].PartitionType,
PartSize.u.LowPart, PartSize.u.LowPart,
Unit); Unit);
} }
@ -1211,7 +1216,8 @@ PrintPartitionData (PPARTLIST List,
} }
Attribute = (List->CurrentDisk == DiskEntry && Attribute = (List->CurrentDisk == DiskEntry &&
List->CurrentPartition == PartEntry) ? List->CurrentPartition == PartEntry &&
List->CurrentPartitionNumber == PartNumber) ?
FOREGROUND_BLUE | BACKGROUND_WHITE : FOREGROUND_BLUE | BACKGROUND_WHITE :
FOREGROUND_WHITE | BACKGROUND_BLUE; FOREGROUND_WHITE | BACKGROUND_BLUE;
@ -1259,6 +1265,7 @@ PrintDiskData (PPARTLIST List,
USHORT Height; USHORT Height;
ULARGE_INTEGER DiskSize; ULARGE_INTEGER DiskSize;
PCHAR Unit; PCHAR Unit;
ULONG i;
Width = List->Right - List->Left - 1; Width = List->Right - List->Left - 1;
Height = List->Bottom - List->Top - 2; Height = List->Bottom - List->Top - 2;
@ -1338,9 +1345,16 @@ PrintDiskData (PPARTLIST List,
LIST_FOR_EACH(PartEntry, &DiskEntry->PartListHead, PARTENTRY, ListEntry) LIST_FOR_EACH(PartEntry, &DiskEntry->PartListHead, PARTENTRY, ListEntry)
{ {
/* Print disk entry */ /* Print disk entry */
PrintPartitionData (List, for (i=0; i<4; i++)
DiskEntry, {
PartEntry); if (PartEntry->PartInfo[i].PartitionType != PARTITION_ENTRY_UNUSED)
{
PrintPartitionData (List,
DiskEntry,
PartEntry,
i);
}
}
} }
/* Print separator line */ /* Print separator line */
@ -1589,6 +1603,7 @@ SelectPartition(PPARTLIST List, ULONG DiskNumber, ULONG PartitionNumber)
{ {
List->CurrentDisk = DiskEntry; List->CurrentDisk = DiskEntry;
List->CurrentPartition = PartEntry; List->CurrentPartition = PartEntry;
List->CurrentPartitionNumber = i;
DrawPartitionList (List); DrawPartitionList (List);
return TRUE; return TRUE;
} }
@ -1610,6 +1625,7 @@ ScrollDownPartitionList (PPARTLIST List)
PPARTENTRY PartEntry; PPARTENTRY PartEntry;
PLIST_ENTRY Entry1; PLIST_ENTRY Entry1;
PLIST_ENTRY Entry2; PLIST_ENTRY Entry2;
UCHAR i;
/* Check for empty disks */ /* Check for empty disks */
if (IsListEmpty (&List->DiskListHead)) if (IsListEmpty (&List->DiskListHead))
@ -1618,7 +1634,30 @@ ScrollDownPartitionList (PPARTLIST List)
/* Check for next usable entry on current disk */ /* Check for next usable entry on current disk */
if (List->CurrentPartition != NULL) 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) while (Entry2 != &List->CurrentDisk->PartListHead)
{ {
PartEntry = CONTAINING_RECORD (Entry2, PARTENTRY, ListEntry); PartEntry = CONTAINING_RECORD (Entry2, PARTENTRY, ListEntry);
@ -1626,6 +1665,7 @@ ScrollDownPartitionList (PPARTLIST List)
// if (PartEntry->HidePartEntry == FALSE) // if (PartEntry->HidePartEntry == FALSE)
{ {
List->CurrentPartition = PartEntry; List->CurrentPartition = PartEntry;
List->CurrentPartitionNumber = 0;
DrawPartitionList (List); DrawPartitionList (List);
return; return;
} }
@ -1650,6 +1690,7 @@ ScrollDownPartitionList (PPARTLIST List)
{ {
List->CurrentDisk = DiskEntry; List->CurrentDisk = DiskEntry;
List->CurrentPartition = PartEntry; List->CurrentPartition = PartEntry;
List->CurrentPartitionNumber = 0;
DrawPartitionList (List); DrawPartitionList (List);
return; return;
} }
@ -1670,6 +1711,7 @@ ScrollUpPartitionList (PPARTLIST List)
PPARTENTRY PartEntry; PPARTENTRY PartEntry;
PLIST_ENTRY Entry1; PLIST_ENTRY Entry1;
PLIST_ENTRY Entry2; PLIST_ENTRY Entry2;
UCHAR i;
/* Check for empty disks */ /* Check for empty disks */
if (IsListEmpty (&List->DiskListHead)) if (IsListEmpty (&List->DiskListHead))
@ -1678,7 +1720,28 @@ ScrollUpPartitionList (PPARTLIST List)
/* check for previous usable entry on current disk */ /* check for previous usable entry on current disk */
if (List->CurrentPartition != NULL) 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) while (Entry2 != &List->CurrentDisk->PartListHead)
{ {
PartEntry = CONTAINING_RECORD (Entry2, PARTENTRY, ListEntry); PartEntry = CONTAINING_RECORD (Entry2, PARTENTRY, ListEntry);
@ -1686,6 +1749,18 @@ ScrollUpPartitionList (PPARTLIST List)
// if (PartEntry->HidePartEntry == FALSE) // if (PartEntry->HidePartEntry == FALSE)
{ {
List->CurrentPartition = PartEntry; 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); DrawPartitionList (List);
return; return;
} }
@ -1711,6 +1786,18 @@ ScrollUpPartitionList (PPARTLIST List)
{ {
List->CurrentDisk = DiskEntry; List->CurrentDisk = DiskEntry;
List->CurrentPartition = PartEntry; 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); DrawPartitionList (List);
return; return;
} }

View file

@ -132,6 +132,7 @@ typedef struct _PARTLIST
PDISKENTRY CurrentDisk; PDISKENTRY CurrentDisk;
PPARTENTRY CurrentPartition; PPARTENTRY CurrentPartition;
UCHAR CurrentPartitionNumber;
PDISKENTRY ActiveBootDisk; PDISKENTRY ActiveBootDisk;
PPARTENTRY ActiveBootPartition; PPARTENTRY ActiveBootPartition;