Author: ekohl
Date: Sat Jun 7 20:02:26 2014
New Revision: 63547
URL:
http://svn.reactos.org/svn/reactos?rev=63547&view=rev
Log:
[USETUP]
Implement scolling through the list of logical partitions. Multiple disks are not
supported yet.
Modified:
trunk/reactos/base/setup/usetup/interface/usetup.c
trunk/reactos/base/setup/usetup/partlist.c
trunk/reactos/base/setup/usetup/partlist.h
Modified: trunk/reactos/base/setup/usetup/interface/usetup.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/interfac…
==============================================================================
--- trunk/reactos/base/setup/usetup/interface/usetup.c [iso-8859-1] (original)
+++ trunk/reactos/base/setup/usetup/interface/usetup.c [iso-8859-1] Sat Jun 7 20:02:26
2014
@@ -1581,12 +1581,14 @@
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
{
- ScrollDownPartitionList(PartitionList);
+ if (ScrollDownPartitionList(PartitionList))
+ DrawPartitionList(PartitionList);
}
else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
(Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
{
- ScrollUpPartitionList(PartitionList);
+ if (ScrollUpPartitionList(PartitionList))
+ DrawPartitionList(PartitionList);
}
else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_RETURN) /* ENTER */
{
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] Sat Jun 7 20:02:26 2014
@@ -1174,6 +1174,29 @@
DumpPartitionTable(DiskEntry);
#endif
+ if (DiskEntry->LayoutBuffer->PartitionEntry[0].StartingOffset.QuadPart != 0
&&
+ DiskEntry->LayoutBuffer->PartitionEntry[0].PartitionLength.QuadPart !=
0 &&
+ DiskEntry->LayoutBuffer->PartitionEntry[0].PartitionType != 0)
+ {
+ if ((DiskEntry->LayoutBuffer->PartitionEntry[0].StartingOffset.QuadPart
/ DiskEntry->BytesPerSector) % DiskEntry->SectorsPerTrack == 0)
+ {
+ DPRINT1("Use %lu Sector alignment!\n",
DiskEntry->SectorsPerTrack);
+ }
+ else if
(DiskEntry->LayoutBuffer->PartitionEntry[0].StartingOffset.QuadPart % 1048756 == 0)
+ {
+ DPRINT1("Use megabyte (%lu Sectors) alignment!\n", 1048756 /
DiskEntry->BytesPerSector);
+ }
+ else
+ {
+ DPRINT1("No matching aligment found! Partiton 1 starts at
%I64u\n", DiskEntry->LayoutBuffer->PartitionEntry[0].StartingOffset.QuadPart);
+ }
+ }
+ else
+ {
+ DPRINT1("No valid partiton table found! Use megabyte (%lu Sectors)
alignment!\n", 1048756 / DiskEntry->BytesPerSector);
+ }
+
+
if (DiskEntry->LayoutBuffer->PartitionCount == 0)
{
DiskEntry->NewDisk = TRUE;
@@ -1986,32 +2009,79 @@
}
-VOID
+BOOL
ScrollDownPartitionList(
PPARTLIST List)
{
// PDISKENTRY DiskEntry;
PPARTENTRY PartEntry;
-// PLIST_ENTRY Entry1;
- PLIST_ENTRY Entry2;
+ PLIST_ENTRY Entry;
/* Check for empty disks */
if (IsListEmpty(&List->DiskListHead))
- return;
+ return FALSE;
+
/* Check for next usable entry on current disk */
if (List->CurrentPartition != NULL)
{
- Entry2 = List->CurrentPartition->ListEntry.Flink;
- if (Entry2 != &List->CurrentDisk->PrimaryPartListHead)
- {
- PartEntry = CONTAINING_RECORD(Entry2, PARTENTRY, ListEntry);
-
- List->CurrentPartition = PartEntry;
- DrawPartitionList(List);
- return;
- }
- }
+ if (List->CurrentPartition->LogicalPartition)
+ {
+ /* Logical partition */
+
+ Entry = List->CurrentPartition->ListEntry.Flink;
+ if (Entry != &List->CurrentDisk->LogicalPartListHead)
+ {
+ /* Next logical partition */
+ PartEntry = CONTAINING_RECORD(Entry, PARTENTRY, ListEntry);
+
+ List->CurrentPartition = PartEntry;
+ return TRUE;
+ }
+ else
+ {
+ Entry = List->CurrentDisk->ExtendedPartition->ListEntry.Flink;
+ if (Entry != &List->CurrentDisk->PrimaryPartListHead)
+ {
+ PartEntry = CONTAINING_RECORD(Entry, PARTENTRY, ListEntry);
+
+ List->CurrentPartition = PartEntry;
+ return TRUE;
+ }
+ }
+ }
+ else
+ {
+ /* Primary or extended partition */
+
+ if (IsContainerPartition(List->CurrentPartition->PartitionType))
+ {
+ /* First logical partition */
+ Entry = List->CurrentDisk->LogicalPartListHead.Flink;
+ if (Entry != &List->CurrentDisk->LogicalPartListHead)
+ {
+ PartEntry = CONTAINING_RECORD(Entry, PARTENTRY, ListEntry);
+
+ List->CurrentPartition = PartEntry;
+ return TRUE;
+ }
+ }
+ else
+ {
+ /* Next primary partition */
+ Entry = List->CurrentPartition->ListEntry.Flink;
+ if (Entry != &List->CurrentDisk->PrimaryPartListHead)
+ {
+ PartEntry = CONTAINING_RECORD(Entry, PARTENTRY, ListEntry);
+
+ List->CurrentPartition = PartEntry;
+ return TRUE;
+ }
+ }
+ }
+ }
+
+ DPRINT1("TODO: Check the next drive!\n");
#if 0
/* Check for first usable entry on next disk */
@@ -2037,37 +2107,67 @@
}
}
#endif
-}
-
-
-VOID
+
+ return FALSE;
+}
+
+
+BOOL
ScrollUpPartitionList(
PPARTLIST List)
{
// PDISKENTRY DiskEntry;
PPARTENTRY PartEntry;
-// PLIST_ENTRY Entry1;
- PLIST_ENTRY Entry2;
+ PLIST_ENTRY Entry;
/* Check for empty disks */
if (IsListEmpty(&List->DiskListHead))
- return;
-
- /* check for previous usable entry on current disk */
+ return FALSE;
+
+ /* Check for previous usable entry on current disk */
if (List->CurrentPartition != NULL)
{
- Entry2 = List->CurrentPartition->ListEntry.Blink;
- if (Entry2 != &List->CurrentDisk->PrimaryPartListHead)
- {
- PartEntry = CONTAINING_RECORD(Entry2, PARTENTRY, ListEntry);
+ if (List->CurrentPartition->LogicalPartition)
+ {
+ /* Logical partition */
+ Entry = List->CurrentPartition->ListEntry.Blink;
+ if (Entry != &List->CurrentDisk->LogicalPartListHead)
+ {
+ /* Previous logical partition */
+ PartEntry = CONTAINING_RECORD(Entry, PARTENTRY, ListEntry);
+ }
+ else
+ {
+ /* Extended partition*/
+ PartEntry = List->CurrentDisk->ExtendedPartition;
+ }
List->CurrentPartition = PartEntry;
-
- /* Draw partition list and return */
- DrawPartitionList(List);
- return;
- }
- }
+ return TRUE;
+ }
+ else
+ {
+ /* Primary or extended partition */
+
+ Entry = List->CurrentPartition->ListEntry.Blink;
+ if (Entry != &List->CurrentDisk->PrimaryPartListHead)
+ {
+ PartEntry = CONTAINING_RECORD(Entry, PARTENTRY, ListEntry);
+
+ if (IsContainerPartition(PartEntry->PartitionType))
+ {
+ Entry = List->CurrentDisk->LogicalPartListHead.Blink;
+ PartEntry = CONTAINING_RECORD(Entry, PARTENTRY, ListEntry);
+ }
+
+ List->CurrentPartition = PartEntry;
+ return TRUE;
+ }
+
+ }
+ }
+
+ DPRINT1("TODO: Check the previous drive!\n");
#if 0
/* check for last usable entry on previous disk */
@@ -2095,6 +2195,8 @@
}
}
#endif
+
+ return FALSE;
}
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] Sat Jun 7 20:02:26 2014
@@ -211,11 +211,11 @@
SetMountedDeviceValues(
PPARTLIST List);
-VOID
+BOOL
ScrollDownPartitionList(
PPARTLIST List);
-VOID
+BOOL
ScrollUpPartitionList(
PPARTLIST List);