mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 18:15:11 +00:00
[SETUPLIB][USETUP] Remove CurrentDisk/Partition from the partlist lib code, and move these into the UI code.
- Add also some validation ASSERTs and simplify the code here and there. - The installation partition is called "InstallPartition", while the global "CurrentPartition" is the disk region currently selected in the partition UI list, on which prtitioning operations are effectued. - Extend CheckActiveSystemPartition() to use an optional alternative disk or partition in case the actual system partition (present in the first disk) cannot be used, e.g. because we don't support writes on it.
This commit is contained in:
parent
0d9ebb67ce
commit
84f3e2df5d
8 changed files with 383 additions and 356 deletions
|
@ -624,11 +624,11 @@ NTSTATUS
|
|||
InitDestinationPaths(
|
||||
IN OUT PUSETUP_DATA pSetupData,
|
||||
IN PCWSTR InstallationDir,
|
||||
IN PDISKENTRY DiskEntry, // FIXME: HACK!
|
||||
IN PPARTENTRY PartEntry) // FIXME: HACK!
|
||||
{
|
||||
WCHAR PathBuffer[MAX_PATH];
|
||||
NTSTATUS Status;
|
||||
PDISKENTRY DiskEntry = PartEntry->DiskEntry;
|
||||
WCHAR PathBuffer[MAX_PATH];
|
||||
|
||||
ASSERT(PartEntry->IsPartitioned && PartEntry->PartitionNumber != 0);
|
||||
|
||||
|
|
|
@ -159,7 +159,6 @@ NTSTATUS
|
|||
InitDestinationPaths(
|
||||
IN OUT PUSETUP_DATA pSetupData,
|
||||
IN PCWSTR InstallationDir,
|
||||
IN PDISKENTRY DiskEntry, // FIXME: HACK!
|
||||
IN PPARTENTRY PartEntry); // FIXME: HACK!
|
||||
|
||||
// NTSTATUS
|
||||
|
|
|
@ -1407,6 +1407,8 @@ AddDiskToList(
|
|||
return;
|
||||
}
|
||||
|
||||
DiskEntry->PartList = List;
|
||||
|
||||
// DiskEntry->Checksum = Checksum;
|
||||
// DiskEntry->Signature = Signature;
|
||||
DiskEntry->BiosFound = FALSE;
|
||||
|
@ -1670,9 +1672,6 @@ CreatePartitionList(VOID)
|
|||
if (List == NULL)
|
||||
return NULL;
|
||||
|
||||
List->CurrentDisk = NULL;
|
||||
List->CurrentPartition = NULL;
|
||||
|
||||
List->SystemPartition = NULL;
|
||||
List->OriginalSystemPartition = NULL;
|
||||
|
||||
|
@ -1727,30 +1726,6 @@ CreatePartitionList(VOID)
|
|||
|
||||
AssignDriveLetters(List);
|
||||
|
||||
/* Search for first usable disk and partition */
|
||||
if (IsListEmpty(&List->DiskListHead))
|
||||
{
|
||||
List->CurrentDisk = NULL;
|
||||
List->CurrentPartition = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
List->CurrentDisk = CONTAINING_RECORD(List->DiskListHead.Flink,
|
||||
DISKENTRY,
|
||||
ListEntry);
|
||||
|
||||
if (IsListEmpty(&List->CurrentDisk->PrimaryPartListHead))
|
||||
{
|
||||
List->CurrentPartition = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
List->CurrentPartition = CONTAINING_RECORD(List->CurrentDisk->PrimaryPartListHead.Flink,
|
||||
PARTENTRY,
|
||||
ListEntry);
|
||||
}
|
||||
}
|
||||
|
||||
return List;
|
||||
}
|
||||
|
||||
|
@ -2006,7 +1981,7 @@ GetDiskOrPartition(
|
|||
//
|
||||
// NOTE: Was introduced broken in r6258 by Casper
|
||||
//
|
||||
BOOLEAN
|
||||
PPARTENTRY
|
||||
SelectPartition(
|
||||
IN PPARTLIST List,
|
||||
IN ULONG DiskNumber,
|
||||
|
@ -2017,59 +1992,55 @@ SelectPartition(
|
|||
|
||||
DiskEntry = GetDiskByNumber(List, DiskNumber);
|
||||
if (!DiskEntry)
|
||||
return FALSE;
|
||||
return NULL;
|
||||
|
||||
PartEntry = GetPartition(/*List,*/ DiskEntry, PartitionNumber);
|
||||
if (!PartEntry)
|
||||
return FALSE;
|
||||
return NULL;
|
||||
|
||||
ASSERT(PartEntry->DiskEntry == DiskEntry);
|
||||
ASSERT(DiskEntry->DiskNumber == DiskNumber);
|
||||
ASSERT(PartEntry->PartitionNumber == PartitionNumber);
|
||||
|
||||
List->CurrentDisk = DiskEntry;
|
||||
List->CurrentPartition = PartEntry;
|
||||
return TRUE;
|
||||
return PartEntry;
|
||||
}
|
||||
|
||||
PPARTENTRY
|
||||
GetNextPartition(
|
||||
IN PPARTLIST List)
|
||||
IN PPARTLIST List,
|
||||
IN PPARTENTRY CurrentPart OPTIONAL)
|
||||
{
|
||||
PLIST_ENTRY DiskListEntry;
|
||||
PLIST_ENTRY PartListEntry;
|
||||
PDISKENTRY DiskEntry;
|
||||
PPARTENTRY PartEntry;
|
||||
PDISKENTRY CurrentDisk;
|
||||
|
||||
/* Fail if no disks are available */
|
||||
if (IsListEmpty(&List->DiskListHead))
|
||||
return NULL;
|
||||
|
||||
/* Check for next usable entry on current disk */
|
||||
if (List->CurrentPartition != NULL)
|
||||
/* Check for the next usable entry on the current partition's disk */
|
||||
if (CurrentPart != NULL)
|
||||
{
|
||||
if (List->CurrentPartition->LogicalPartition)
|
||||
CurrentDisk = CurrentPart->DiskEntry;
|
||||
|
||||
if (CurrentPart->LogicalPartition)
|
||||
{
|
||||
/* Logical partition */
|
||||
|
||||
PartListEntry = List->CurrentPartition->ListEntry.Flink;
|
||||
if (PartListEntry != &List->CurrentDisk->LogicalPartListHead)
|
||||
PartListEntry = CurrentPart->ListEntry.Flink;
|
||||
if (PartListEntry != &CurrentDisk->LogicalPartListHead)
|
||||
{
|
||||
/* Next logical partition */
|
||||
PartEntry = CONTAINING_RECORD(PartListEntry, PARTENTRY, ListEntry);
|
||||
|
||||
List->CurrentPartition = PartEntry;
|
||||
return List->CurrentPartition;
|
||||
CurrentPart = CONTAINING_RECORD(PartListEntry, PARTENTRY, ListEntry);
|
||||
return CurrentPart;
|
||||
}
|
||||
else
|
||||
{
|
||||
PartListEntry = List->CurrentDisk->ExtendedPartition->ListEntry.Flink;
|
||||
if (PartListEntry != &List->CurrentDisk->PrimaryPartListHead)
|
||||
PartListEntry = CurrentDisk->ExtendedPartition->ListEntry.Flink;
|
||||
if (PartListEntry != &CurrentDisk->PrimaryPartListHead)
|
||||
{
|
||||
PartEntry = CONTAINING_RECORD(PartListEntry, PARTENTRY, ListEntry);
|
||||
|
||||
List->CurrentPartition = PartEntry;
|
||||
return List->CurrentPartition;
|
||||
CurrentPart = CONTAINING_RECORD(PartListEntry, PARTENTRY, ListEntry);
|
||||
return CurrentPart;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2077,55 +2048,49 @@ GetNextPartition(
|
|||
{
|
||||
/* Primary or extended partition */
|
||||
|
||||
if (List->CurrentPartition->IsPartitioned &&
|
||||
IsContainerPartition(List->CurrentPartition->PartitionType))
|
||||
if (CurrentPart->IsPartitioned &&
|
||||
IsContainerPartition(CurrentPart->PartitionType))
|
||||
{
|
||||
/* First logical partition */
|
||||
PartListEntry = List->CurrentDisk->LogicalPartListHead.Flink;
|
||||
if (PartListEntry != &List->CurrentDisk->LogicalPartListHead)
|
||||
PartListEntry = CurrentDisk->LogicalPartListHead.Flink;
|
||||
if (PartListEntry != &CurrentDisk->LogicalPartListHead)
|
||||
{
|
||||
PartEntry = CONTAINING_RECORD(PartListEntry, PARTENTRY, ListEntry);
|
||||
|
||||
List->CurrentPartition = PartEntry;
|
||||
return List->CurrentPartition;
|
||||
CurrentPart = CONTAINING_RECORD(PartListEntry, PARTENTRY, ListEntry);
|
||||
return CurrentPart;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Next primary partition */
|
||||
PartListEntry = List->CurrentPartition->ListEntry.Flink;
|
||||
if (PartListEntry != &List->CurrentDisk->PrimaryPartListHead)
|
||||
PartListEntry = CurrentPart->ListEntry.Flink;
|
||||
if (PartListEntry != &CurrentDisk->PrimaryPartListHead)
|
||||
{
|
||||
PartEntry = CONTAINING_RECORD(PartListEntry, PARTENTRY, ListEntry);
|
||||
|
||||
List->CurrentPartition = PartEntry;
|
||||
return List->CurrentPartition;
|
||||
CurrentPart = CONTAINING_RECORD(PartListEntry, PARTENTRY, ListEntry);
|
||||
return CurrentPart;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Search for the first partition entry on the next disk */
|
||||
for (DiskListEntry = List->CurrentDisk->ListEntry.Flink;
|
||||
for (DiskListEntry = (CurrentPart ? CurrentDisk->ListEntry.Flink
|
||||
: List->DiskListHead.Flink);
|
||||
DiskListEntry != &List->DiskListHead;
|
||||
DiskListEntry = DiskListEntry->Flink)
|
||||
{
|
||||
DiskEntry = CONTAINING_RECORD(DiskListEntry, DISKENTRY, ListEntry);
|
||||
CurrentDisk = CONTAINING_RECORD(DiskListEntry, DISKENTRY, ListEntry);
|
||||
|
||||
if (DiskEntry->DiskStyle == PARTITION_STYLE_GPT)
|
||||
if (CurrentDisk->DiskStyle == PARTITION_STYLE_GPT)
|
||||
{
|
||||
DPRINT("GPT-partitioned disk detected, not currently supported by SETUP!\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
PartListEntry = DiskEntry->PrimaryPartListHead.Flink;
|
||||
if (PartListEntry != &DiskEntry->PrimaryPartListHead)
|
||||
PartListEntry = CurrentDisk->PrimaryPartListHead.Flink;
|
||||
if (PartListEntry != &CurrentDisk->PrimaryPartListHead)
|
||||
{
|
||||
PartEntry = CONTAINING_RECORD(PartListEntry, PARTENTRY, ListEntry);
|
||||
|
||||
List->CurrentDisk = DiskEntry;
|
||||
List->CurrentPartition = PartEntry;
|
||||
return List->CurrentPartition;
|
||||
CurrentPart = CONTAINING_RECORD(PartListEntry, PARTENTRY, ListEntry);
|
||||
return CurrentPart;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2134,96 +2099,92 @@ GetNextPartition(
|
|||
|
||||
PPARTENTRY
|
||||
GetPrevPartition(
|
||||
IN PPARTLIST List)
|
||||
IN PPARTLIST List,
|
||||
IN PPARTENTRY CurrentPart OPTIONAL)
|
||||
{
|
||||
PLIST_ENTRY DiskListEntry;
|
||||
PLIST_ENTRY PartListEntry;
|
||||
PDISKENTRY DiskEntry;
|
||||
PPARTENTRY PartEntry;
|
||||
PDISKENTRY CurrentDisk;
|
||||
|
||||
/* Fail if no disks are available */
|
||||
if (IsListEmpty(&List->DiskListHead))
|
||||
return NULL;
|
||||
|
||||
/* Check for previous usable entry on current disk */
|
||||
if (List->CurrentPartition != NULL)
|
||||
/* Check for the previous usable entry on the current partition's disk */
|
||||
if (CurrentPart != NULL)
|
||||
{
|
||||
if (List->CurrentPartition->LogicalPartition)
|
||||
CurrentDisk = CurrentPart->DiskEntry;
|
||||
|
||||
if (CurrentPart->LogicalPartition)
|
||||
{
|
||||
/* Logical partition */
|
||||
PartListEntry = List->CurrentPartition->ListEntry.Blink;
|
||||
if (PartListEntry != &List->CurrentDisk->LogicalPartListHead)
|
||||
|
||||
PartListEntry = CurrentPart->ListEntry.Blink;
|
||||
if (PartListEntry != &CurrentDisk->LogicalPartListHead)
|
||||
{
|
||||
/* Previous logical partition */
|
||||
PartEntry = CONTAINING_RECORD(PartListEntry, PARTENTRY, ListEntry);
|
||||
CurrentPart = CONTAINING_RECORD(PartListEntry, PARTENTRY, ListEntry);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Extended partition */
|
||||
PartEntry = List->CurrentDisk->ExtendedPartition;
|
||||
CurrentPart = CurrentDisk->ExtendedPartition;
|
||||
}
|
||||
|
||||
List->CurrentPartition = PartEntry;
|
||||
return List->CurrentPartition;
|
||||
return CurrentPart;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Primary or extended partition */
|
||||
|
||||
PartListEntry = List->CurrentPartition->ListEntry.Blink;
|
||||
if (PartListEntry != &List->CurrentDisk->PrimaryPartListHead)
|
||||
PartListEntry = CurrentPart->ListEntry.Blink;
|
||||
if (PartListEntry != &CurrentDisk->PrimaryPartListHead)
|
||||
{
|
||||
PartEntry = CONTAINING_RECORD(PartListEntry, PARTENTRY, ListEntry);
|
||||
CurrentPart = CONTAINING_RECORD(PartListEntry, PARTENTRY, ListEntry);
|
||||
|
||||
if (PartEntry->IsPartitioned &&
|
||||
IsContainerPartition(PartEntry->PartitionType))
|
||||
if (CurrentPart->IsPartitioned &&
|
||||
IsContainerPartition(CurrentPart->PartitionType))
|
||||
{
|
||||
PartListEntry = List->CurrentDisk->LogicalPartListHead.Blink;
|
||||
PartEntry = CONTAINING_RECORD(PartListEntry, PARTENTRY, ListEntry);
|
||||
PartListEntry = CurrentDisk->LogicalPartListHead.Blink;
|
||||
CurrentPart = CONTAINING_RECORD(PartListEntry, PARTENTRY, ListEntry);
|
||||
}
|
||||
|
||||
List->CurrentPartition = PartEntry;
|
||||
return List->CurrentPartition;
|
||||
return CurrentPart;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Search for the last partition entry on the previous disk */
|
||||
for (DiskListEntry = List->CurrentDisk->ListEntry.Blink;
|
||||
for (DiskListEntry = (CurrentPart ? CurrentDisk->ListEntry.Blink
|
||||
: List->DiskListHead.Blink);
|
||||
DiskListEntry != &List->DiskListHead;
|
||||
DiskListEntry = DiskListEntry->Blink)
|
||||
{
|
||||
DiskEntry = CONTAINING_RECORD(DiskListEntry, DISKENTRY, ListEntry);
|
||||
CurrentDisk = CONTAINING_RECORD(DiskListEntry, DISKENTRY, ListEntry);
|
||||
|
||||
if (DiskEntry->DiskStyle == PARTITION_STYLE_GPT)
|
||||
if (CurrentDisk->DiskStyle == PARTITION_STYLE_GPT)
|
||||
{
|
||||
DPRINT("GPT-partitioned disk detected, not currently supported by SETUP!\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
PartListEntry = DiskEntry->PrimaryPartListHead.Blink;
|
||||
if (PartListEntry != &DiskEntry->PrimaryPartListHead)
|
||||
PartListEntry = CurrentDisk->PrimaryPartListHead.Blink;
|
||||
if (PartListEntry != &CurrentDisk->PrimaryPartListHead)
|
||||
{
|
||||
PartEntry = CONTAINING_RECORD(PartListEntry, PARTENTRY, ListEntry);
|
||||
CurrentPart = CONTAINING_RECORD(PartListEntry, PARTENTRY, ListEntry);
|
||||
|
||||
if (PartEntry->IsPartitioned &&
|
||||
IsContainerPartition(PartEntry->PartitionType))
|
||||
if (CurrentPart->IsPartitioned &&
|
||||
IsContainerPartition(CurrentPart->PartitionType))
|
||||
{
|
||||
PartListEntry = DiskEntry->LogicalPartListHead.Blink;
|
||||
if (PartListEntry != &DiskEntry->LogicalPartListHead)
|
||||
PartListEntry = CurrentDisk->LogicalPartListHead.Blink;
|
||||
if (PartListEntry != &CurrentDisk->LogicalPartListHead)
|
||||
{
|
||||
PartEntry = CONTAINING_RECORD(PartListEntry, PARTENTRY, ListEntry);
|
||||
|
||||
List->CurrentDisk = DiskEntry;
|
||||
List->CurrentPartition = PartEntry;
|
||||
return List->CurrentPartition;
|
||||
CurrentPart = CONTAINING_RECORD(PartListEntry, PARTENTRY, ListEntry);
|
||||
return CurrentPart;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
List->CurrentDisk = DiskEntry;
|
||||
List->CurrentPartition = PartEntry;
|
||||
return List->CurrentPartition;
|
||||
return CurrentPart;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2553,9 +2514,9 @@ UpdateDiskLayout(
|
|||
static
|
||||
PPARTENTRY
|
||||
GetPrevUnpartitionedEntry(
|
||||
IN PDISKENTRY DiskEntry,
|
||||
IN PPARTENTRY PartEntry)
|
||||
{
|
||||
PDISKENTRY DiskEntry = PartEntry->DiskEntry;
|
||||
PPARTENTRY PrevPartEntry;
|
||||
PLIST_ENTRY ListHead;
|
||||
|
||||
|
@ -2575,7 +2536,7 @@ GetPrevUnpartitionedEntry(
|
|||
PrevPartEntry = CONTAINING_RECORD(PartEntry->ListEntry.Blink,
|
||||
PARTENTRY,
|
||||
ListEntry);
|
||||
if (PrevPartEntry->IsPartitioned == FALSE)
|
||||
if (!PrevPartEntry->IsPartitioned)
|
||||
{
|
||||
ASSERT(PrevPartEntry->PartitionType == PARTITION_ENTRY_UNUSED);
|
||||
return PrevPartEntry;
|
||||
|
@ -2588,9 +2549,9 @@ GetPrevUnpartitionedEntry(
|
|||
static
|
||||
PPARTENTRY
|
||||
GetNextUnpartitionedEntry(
|
||||
IN PDISKENTRY DiskEntry,
|
||||
IN PPARTENTRY PartEntry)
|
||||
{
|
||||
PDISKENTRY DiskEntry = PartEntry->DiskEntry;
|
||||
PPARTENTRY NextPartEntry;
|
||||
PLIST_ENTRY ListHead;
|
||||
|
||||
|
@ -2610,7 +2571,7 @@ GetNextUnpartitionedEntry(
|
|||
NextPartEntry = CONTAINING_RECORD(PartEntry->ListEntry.Flink,
|
||||
PARTENTRY,
|
||||
ListEntry);
|
||||
if (NextPartEntry->IsPartitioned == FALSE)
|
||||
if (!NextPartEntry->IsPartitioned)
|
||||
{
|
||||
ASSERT(NextPartEntry->PartitionType == PARTITION_ENTRY_UNUSED);
|
||||
return NextPartEntry;
|
||||
|
@ -2892,10 +2853,11 @@ DismountVolume(
|
|||
return Status;
|
||||
}
|
||||
|
||||
VOID
|
||||
BOOLEAN
|
||||
DeletePartition(
|
||||
IN PPARTLIST List,
|
||||
IN PPARTENTRY PartEntry)
|
||||
IN PPARTENTRY PartEntry,
|
||||
OUT PPARTENTRY* FreeRegion OPTIONAL)
|
||||
{
|
||||
PDISKENTRY DiskEntry;
|
||||
PPARTENTRY PrevPartEntry;
|
||||
|
@ -2908,7 +2870,7 @@ DeletePartition(
|
|||
PartEntry->DiskEntry == NULL ||
|
||||
PartEntry->IsPartitioned == FALSE)
|
||||
{
|
||||
return;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
ASSERT(PartEntry->PartitionType != PARTITION_ENTRY_UNUSED);
|
||||
|
@ -2949,56 +2911,49 @@ DeletePartition(
|
|||
DismountVolume(PartEntry);
|
||||
}
|
||||
|
||||
/* Adjust unpartitioned disk space entries */
|
||||
/* Adjust the unpartitioned disk space entries */
|
||||
|
||||
/* Get pointer to previous and next unpartitioned entries */
|
||||
PrevPartEntry = GetPrevUnpartitionedEntry(DiskEntry, PartEntry);
|
||||
NextPartEntry = GetNextUnpartitionedEntry(DiskEntry, PartEntry);
|
||||
PrevPartEntry = GetPrevUnpartitionedEntry(PartEntry);
|
||||
NextPartEntry = GetNextUnpartitionedEntry(PartEntry);
|
||||
|
||||
if (PrevPartEntry != NULL && NextPartEntry != NULL)
|
||||
{
|
||||
/* Merge previous, current and next unpartitioned entry */
|
||||
/* Merge the previous, current and next unpartitioned entries */
|
||||
|
||||
/* Adjust the previous entries length */
|
||||
/* Adjust the previous entry length */
|
||||
PrevPartEntry->SectorCount.QuadPart += (PartEntry->SectorCount.QuadPart + NextPartEntry->SectorCount.QuadPart);
|
||||
|
||||
/* Remove the current entry */
|
||||
/* Remove the current and next entries */
|
||||
RemoveEntryList(&PartEntry->ListEntry);
|
||||
RtlFreeHeap(ProcessHeap, 0, PartEntry);
|
||||
|
||||
/* Remove the next entry */
|
||||
RemoveEntryList(&NextPartEntry->ListEntry);
|
||||
RtlFreeHeap(ProcessHeap, 0, NextPartEntry);
|
||||
|
||||
/* Update current partition */
|
||||
if (List->CurrentPartition == PartEntry ||
|
||||
List->CurrentPartition == NextPartEntry)
|
||||
{
|
||||
List->CurrentPartition = PrevPartEntry;
|
||||
}
|
||||
/* Optionally return the freed region */
|
||||
if (FreeRegion)
|
||||
*FreeRegion = PrevPartEntry;
|
||||
}
|
||||
else if (PrevPartEntry != NULL && NextPartEntry == NULL)
|
||||
{
|
||||
/* Merge current and previous unpartitioned entry */
|
||||
/* Merge the current and the previous unpartitioned entries */
|
||||
|
||||
/* Adjust the previous entries length */
|
||||
/* Adjust the previous entry length */
|
||||
PrevPartEntry->SectorCount.QuadPart += PartEntry->SectorCount.QuadPart;
|
||||
|
||||
/* Remove the current entry */
|
||||
RemoveEntryList(&PartEntry->ListEntry);
|
||||
RtlFreeHeap(ProcessHeap, 0, PartEntry);
|
||||
|
||||
/* Update current partition */
|
||||
if (List->CurrentPartition == PartEntry)
|
||||
{
|
||||
List->CurrentPartition = PrevPartEntry;
|
||||
}
|
||||
/* Optionally return the freed region */
|
||||
if (FreeRegion)
|
||||
*FreeRegion = PrevPartEntry;
|
||||
}
|
||||
else if (PrevPartEntry == NULL && NextPartEntry != NULL)
|
||||
{
|
||||
/* Merge current and next unpartitioned entry */
|
||||
/* Merge the current and the next unpartitioned entries */
|
||||
|
||||
/* Adjust the next entries offset and length */
|
||||
/* Adjust the next entry offset and length */
|
||||
NextPartEntry->StartSector.QuadPart = PartEntry->StartSector.QuadPart;
|
||||
NextPartEntry->SectorCount.QuadPart += PartEntry->SectorCount.QuadPart;
|
||||
|
||||
|
@ -3006,15 +2961,13 @@ DeletePartition(
|
|||
RemoveEntryList(&PartEntry->ListEntry);
|
||||
RtlFreeHeap(ProcessHeap, 0, PartEntry);
|
||||
|
||||
/* Update current partition */
|
||||
if (List->CurrentPartition == PartEntry)
|
||||
{
|
||||
List->CurrentPartition = NextPartEntry;
|
||||
}
|
||||
/* Optionally return the freed region */
|
||||
if (FreeRegion)
|
||||
*FreeRegion = NextPartEntry;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Nothing to merge but change current entry */
|
||||
/* Nothing to merge but change the current entry */
|
||||
PartEntry->IsPartitioned = FALSE;
|
||||
PartEntry->PartitionType = PARTITION_ENTRY_UNUSED;
|
||||
PartEntry->FormatState = Unformatted;
|
||||
|
@ -3023,18 +2976,17 @@ DeletePartition(
|
|||
PartEntry->OnDiskPartitionNumber = 0;
|
||||
PartEntry->PartitionNumber = 0;
|
||||
// PartEntry->PartitionIndex = 0;
|
||||
|
||||
/* Optionally return the freed region */
|
||||
if (FreeRegion)
|
||||
*FreeRegion = PartEntry;
|
||||
}
|
||||
|
||||
UpdateDiskLayout(DiskEntry);
|
||||
|
||||
AssignDriveLetters(List);
|
||||
}
|
||||
|
||||
VOID
|
||||
DeleteCurrentPartition(
|
||||
IN PPARTLIST List)
|
||||
{
|
||||
DeletePartition(List, List->CurrentPartition);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -3185,7 +3137,10 @@ IsSupportedActivePartition(
|
|||
|
||||
VOID
|
||||
CheckActiveSystemPartition(
|
||||
IN PPARTLIST List)
|
||||
IN PPARTLIST List,
|
||||
IN BOOLEAN ForceSelect,
|
||||
IN PDISKENTRY AlternateDisk OPTIONAL,
|
||||
IN PPARTENTRY AlternatePart OPTIONAL)
|
||||
{
|
||||
PLIST_ENTRY ListEntry;
|
||||
PDISKENTRY DiskEntry;
|
||||
|
@ -3199,7 +3154,7 @@ CheckActiveSystemPartition(
|
|||
/* No system partition! */
|
||||
List->SystemPartition = NULL;
|
||||
List->OriginalSystemPartition = NULL;
|
||||
return;
|
||||
goto NoSystemPartition;
|
||||
}
|
||||
|
||||
if (List->SystemPartition != NULL)
|
||||
|
@ -3216,11 +3171,21 @@ CheckActiveSystemPartition(
|
|||
List->SystemPartition = NULL;
|
||||
List->OriginalSystemPartition = NULL;
|
||||
|
||||
/* Adjust the optional alternate disk if needed */
|
||||
if (!AlternateDisk && AlternatePart)
|
||||
AlternateDisk = AlternatePart->DiskEntry;
|
||||
|
||||
/* Ensure that the alternate partition is on the alternate disk */
|
||||
if (AlternatePart)
|
||||
ASSERT(AlternateDisk && (AlternatePart->DiskEntry == AlternateDisk));
|
||||
|
||||
/* Ensure that the alternate disk is in the list */
|
||||
if (AlternateDisk)
|
||||
ASSERT(AlternateDisk->PartList == List);
|
||||
|
||||
//
|
||||
// Pass == 1 : Checking the first disk.
|
||||
// Pass == 1 : Check the first (system) disk.
|
||||
//
|
||||
DPRINT("We are here (1)!\n");
|
||||
|
||||
/*
|
||||
* First, check whether the first disk (the one that will be booted
|
||||
|
@ -3230,13 +3195,11 @@ CheckActiveSystemPartition(
|
|||
DiskEntry = CONTAINING_RECORD(List->DiskListHead.Flink,
|
||||
DISKENTRY, ListEntry);
|
||||
|
||||
// if (DiskEntry->DiskStyle == PARTITION_STYLE_GPT)
|
||||
// {
|
||||
// DPRINT1("GPT-partitioned disk detected, not currently supported by SETUP!\n");
|
||||
// continue;
|
||||
// }
|
||||
|
||||
DPRINT("We are here (1a)!\n");
|
||||
if (DiskEntry->DiskStyle == PARTITION_STYLE_GPT)
|
||||
{
|
||||
DPRINT1("First (system) disk -- GPT-partitioned disk detected, not currently supported by SETUP!\n");
|
||||
goto UseAlternateDisk;
|
||||
}
|
||||
|
||||
ActivePartition = GetActiveDiskPartition(DiskEntry);
|
||||
if (ActivePartition)
|
||||
|
@ -3252,14 +3215,13 @@ CheckActiveSystemPartition(
|
|||
}
|
||||
}
|
||||
|
||||
DPRINT("We are here (1b)!\n");
|
||||
|
||||
/* If this first disk is not the current installation disk, do the minimal checks */
|
||||
if (DiskEntry != List->CurrentDisk)
|
||||
/* If this first disk is not the optional alternate disk, perform the minimal checks */
|
||||
if (DiskEntry != AlternateDisk)
|
||||
{
|
||||
/*
|
||||
* We don't. Enumerate all the (primary) partitions in the first disk,
|
||||
* excluding the current active partition, to find a candidate new one.
|
||||
* No active partition has been recognized. Enumerate all the (primary)
|
||||
* partitions in the first disk, excluding the possible current active
|
||||
* partition, to find a new candidate.
|
||||
*/
|
||||
for (ListEntry = DiskEntry->PrimaryPartListHead.Flink;
|
||||
ListEntry != &DiskEntry->PrimaryPartListHead;
|
||||
|
@ -3336,26 +3298,24 @@ CheckActiveSystemPartition(
|
|||
}
|
||||
|
||||
|
||||
/**** Case where we don't have an active partition on the first disk ****/
|
||||
|
||||
//
|
||||
// Pass == 2 : Checking the CurrentDisk on which we install.
|
||||
// Pass == 2 : No active partition found: Check the alternate disk if specified.
|
||||
//
|
||||
DPRINT("We are here (2)!\n");
|
||||
|
||||
if (DiskEntry != List->CurrentDisk)
|
||||
UseAlternateDisk:
|
||||
if (!AlternateDisk || (!ForceSelect && (DiskEntry != AlternateDisk)))
|
||||
goto NoSystemPartition;
|
||||
|
||||
if (AlternateDisk->DiskStyle == PARTITION_STYLE_GPT)
|
||||
{
|
||||
/* Choose the currently selected disk */
|
||||
DiskEntry = List->CurrentDisk;
|
||||
DPRINT1("Alternate disk -- GPT-partitioned disk detected, not currently supported by SETUP!\n");
|
||||
goto NoSystemPartition;
|
||||
}
|
||||
|
||||
if (DiskEntry->DiskStyle == PARTITION_STYLE_GPT)
|
||||
{
|
||||
DPRINT1("Current disk?! -- GPT-partitioned disk detected, not currently supported by SETUP!\n");
|
||||
DPRINT1("No supported active partition found on this system!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
DPRINT("We are here (2x)!\n");
|
||||
if (DiskEntry != AlternateDisk)
|
||||
{
|
||||
/* Choose the alternate disk */
|
||||
DiskEntry = AlternateDisk;
|
||||
|
||||
ActivePartition = GetActiveDiskPartition(DiskEntry);
|
||||
if (ActivePartition)
|
||||
|
@ -3369,19 +3329,16 @@ CheckActiveSystemPartition(
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**** Here, we either don't have an active partition, or we have one BUT it is not supported ****/
|
||||
/* We now may have an unsupported active partition, or none */
|
||||
|
||||
/***
|
||||
*** TODO: Improve the selection:
|
||||
*** - If we want a really separate system partition from the partition where
|
||||
*** we install, do something similar to what's done below in the code.
|
||||
*** - Otherwise if we allow for the system partition to be also the partition
|
||||
*** where we install, just directly fall down to List->CurrentPartition.
|
||||
*** where we install, just directly fall down to using AlternatePart.
|
||||
***/
|
||||
|
||||
DPRINT("We are here (2a)!\n");
|
||||
|
||||
/* Retrieve the first partition of the disk */
|
||||
PartEntry = CONTAINING_RECORD(DiskEntry->PrimaryPartListHead.Flink,
|
||||
PARTENTRY, ListEntry);
|
||||
|
@ -3416,8 +3373,6 @@ CheckActiveSystemPartition(
|
|||
DPRINT1("NewDisk TRUE but first partition is used?\n");
|
||||
}
|
||||
|
||||
DPRINT("We are here (3)!\n");
|
||||
|
||||
/*
|
||||
* The disk is not new, check if any partition is initialized;
|
||||
* if not, the first one becomes the system partition.
|
||||
|
@ -3455,20 +3410,27 @@ CheckActiveSystemPartition(
|
|||
goto SetSystemPartition;
|
||||
}
|
||||
|
||||
DPRINT("We are here (4)!\n");
|
||||
|
||||
/*
|
||||
* The disk is not new, we did not find any actual active partition,
|
||||
* or the one we found was not supported, or any possible other canditate
|
||||
* is not supported. We then use the current (installation) partition.
|
||||
* is not supported. We then use the alternate partition if specified.
|
||||
*/
|
||||
/* Nothing, use the alternative system partition */
|
||||
DPRINT1("No system partition found, use the alternative partition!\n");
|
||||
CandidatePartition = List->CurrentPartition;
|
||||
goto UseAlternativeSystemPartition;
|
||||
if (AlternatePart)
|
||||
{
|
||||
DPRINT1("No system partition found, use the alternative partition!\n");
|
||||
CandidatePartition = AlternatePart;
|
||||
goto UseAlternativeSystemPartition;
|
||||
}
|
||||
else
|
||||
{
|
||||
NoSystemPartition:
|
||||
DPRINT1("No valid or supported system partition has been found on this system!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
SystemPartitionFound:
|
||||
ASSERT(CandidatePartition);
|
||||
List->SystemPartition = CandidatePartition;
|
||||
|
||||
DPRINT1("Use existing active system partition %lu in disk %lu, drive letter %C\n",
|
||||
|
@ -3498,6 +3460,7 @@ FindAndUseAlternativeSystemPartition:
|
|||
}
|
||||
|
||||
UseAlternativeSystemPartition:
|
||||
ASSERT(CandidatePartition);
|
||||
List->SystemPartition = CandidatePartition;
|
||||
|
||||
DPRINT1("Use alternative active system partition %lu in disk %lu, drive letter %C\n",
|
||||
|
|
|
@ -89,6 +89,9 @@ typedef struct _DISKENTRY
|
|||
{
|
||||
LIST_ENTRY ListEntry;
|
||||
|
||||
/* The list of disks/partitions this disk belongs to */
|
||||
struct _PARTLIST *PartList;
|
||||
|
||||
/* Disk geometry */
|
||||
|
||||
ULONGLONG Cylinders;
|
||||
|
@ -138,17 +141,6 @@ typedef struct _DISKENTRY
|
|||
|
||||
typedef struct _PARTLIST
|
||||
{
|
||||
/*
|
||||
* Disk & Partition iterators.
|
||||
*
|
||||
* NOTE that when CurrentPartition != NULL, then CurrentPartition->DiskEntry
|
||||
* must be the same as CurrentDisk. We should however keep the two members
|
||||
* separated as we can have a current (selected) disk without any current
|
||||
* partition, if the former does not contain any.
|
||||
*/
|
||||
PDISKENTRY CurrentDisk;
|
||||
PPARTENTRY CurrentPartition;
|
||||
|
||||
/*
|
||||
* The system partition where the boot manager resides.
|
||||
* The corresponding system disk is obtained via:
|
||||
|
@ -275,7 +267,7 @@ GetDiskOrPartition(
|
|||
OUT PDISKENTRY* pDiskEntry,
|
||||
OUT PPARTENTRY* pPartEntry OPTIONAL);
|
||||
|
||||
BOOLEAN
|
||||
PPARTENTRY
|
||||
SelectPartition(
|
||||
IN PPARTLIST List,
|
||||
IN ULONG DiskNumber,
|
||||
|
@ -283,11 +275,13 @@ SelectPartition(
|
|||
|
||||
PPARTENTRY
|
||||
GetNextPartition(
|
||||
IN PPARTLIST List);
|
||||
IN PPARTLIST List,
|
||||
IN PPARTENTRY CurrentPart OPTIONAL);
|
||||
|
||||
PPARTENTRY
|
||||
GetPrevPartition(
|
||||
IN PPARTLIST List);
|
||||
IN PPARTLIST List,
|
||||
IN PPARTENTRY CurrentPart OPTIONAL);
|
||||
|
||||
BOOLEAN
|
||||
CreatePrimaryPartition(
|
||||
|
@ -309,18 +303,18 @@ CreateLogicalPartition(
|
|||
IN ULONGLONG SectorCount,
|
||||
IN BOOLEAN AutoCreate);
|
||||
|
||||
VOID
|
||||
BOOLEAN
|
||||
DeletePartition(
|
||||
IN PPARTLIST List,
|
||||
IN PPARTENTRY PartEntry);
|
||||
|
||||
VOID
|
||||
DeleteCurrentPartition(
|
||||
IN PPARTLIST List);
|
||||
IN PPARTENTRY PartEntry,
|
||||
OUT PPARTENTRY* FreeRegion OPTIONAL);
|
||||
|
||||
VOID
|
||||
CheckActiveSystemPartition(
|
||||
IN PPARTLIST List);
|
||||
IN PPARTLIST List,
|
||||
IN BOOLEAN ForceSelect,
|
||||
IN PDISKENTRY AlternateDisk OPTIONAL,
|
||||
IN PPARTENTRY AlternatePart OPTIONAL);
|
||||
|
||||
NTSTATUS
|
||||
WritePartitions(
|
||||
|
|
|
@ -792,12 +792,13 @@ DisableWizNext:
|
|||
PARTENTRY PartEntry;
|
||||
DiskEntry.DiskNumber = 0;
|
||||
DiskEntry.BiosDiskNumber = 0;
|
||||
PartEntry.DiskEntry = &DiskEntry;
|
||||
PartEntry.PartitionNumber = 1; // 4;
|
||||
/****/
|
||||
|
||||
Status = InitDestinationPaths(&pSetupData->USetupData,
|
||||
NULL, // pSetupData->USetupData.InstallationDirectory,
|
||||
&DiskEntry, &PartEntry);
|
||||
&PartEntry);
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
|
|
|
@ -73,6 +73,7 @@ VOID
|
|||
InitPartitionListUi(
|
||||
IN OUT PPARTLIST_UI ListUi,
|
||||
IN PPARTLIST List,
|
||||
IN PPARTENTRY CurrentEntry OPTIONAL,
|
||||
IN SHORT Left,
|
||||
IN SHORT Top,
|
||||
IN SHORT Right,
|
||||
|
@ -91,6 +92,37 @@ InitPartitionListUi(
|
|||
ListUi->Offset = 0;
|
||||
|
||||
// ListUi->Redraw = TRUE;
|
||||
|
||||
/* Search for first usable disk and partition */
|
||||
if (!CurrentEntry)
|
||||
{
|
||||
ListUi->CurrentDisk = NULL;
|
||||
ListUi->CurrentPartition = NULL;
|
||||
|
||||
if (!IsListEmpty(&List->DiskListHead))
|
||||
{
|
||||
ListUi->CurrentDisk = CONTAINING_RECORD(List->DiskListHead.Flink,
|
||||
DISKENTRY, ListEntry);
|
||||
|
||||
if (!IsListEmpty(&ListUi->CurrentDisk->PrimaryPartListHead))
|
||||
{
|
||||
ListUi->CurrentPartition = CONTAINING_RECORD(ListUi->CurrentDisk->PrimaryPartListHead.Flink,
|
||||
PARTENTRY, ListEntry);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* The CurrentEntry must belong to the associated partition list,
|
||||
* and the latter must therefore not be empty.
|
||||
*/
|
||||
ASSERT(!IsListEmpty(&List->DiskListHead));
|
||||
ASSERT(CurrentEntry->DiskEntry->PartList == List);
|
||||
|
||||
ListUi->CurrentPartition = CurrentEntry;
|
||||
ListUi->CurrentDisk = CurrentEntry->DiskEntry;
|
||||
}
|
||||
}
|
||||
|
||||
static
|
||||
|
@ -134,7 +166,6 @@ PrintPartitionData(
|
|||
IN PDISKENTRY DiskEntry,
|
||||
IN PPARTENTRY PartEntry)
|
||||
{
|
||||
PPARTLIST List = ListUi->List;
|
||||
CHAR LineBuffer[128];
|
||||
COORD coPos;
|
||||
ULONG Written;
|
||||
|
@ -226,8 +257,8 @@ PrintPartitionData(
|
|||
}
|
||||
}
|
||||
|
||||
Attribute = (List->CurrentDisk == DiskEntry &&
|
||||
List->CurrentPartition == PartEntry) ?
|
||||
Attribute = (ListUi->CurrentDisk == DiskEntry &&
|
||||
ListUi->CurrentPartition == PartEntry) ?
|
||||
FOREGROUND_BLUE | BACKGROUND_WHITE :
|
||||
FOREGROUND_WHITE | BACKGROUND_BLUE;
|
||||
|
||||
|
@ -269,7 +300,6 @@ PrintDiskData(
|
|||
IN PPARTLIST_UI ListUi,
|
||||
IN PDISKENTRY DiskEntry)
|
||||
{
|
||||
// PPARTLIST List = ListUi->List;
|
||||
PPARTENTRY PrimaryPartEntry, LogicalPartEntry;
|
||||
PLIST_ENTRY PrimaryEntry, LogicalEntry;
|
||||
CHAR LineBuffer[128];
|
||||
|
@ -432,7 +462,7 @@ DrawPartitionList(
|
|||
while (Entry2 != &DiskEntry->PrimaryPartListHead)
|
||||
{
|
||||
PartEntry = CONTAINING_RECORD(Entry2, PARTENTRY, ListEntry);
|
||||
if (PartEntry == List->CurrentPartition)
|
||||
if (PartEntry == ListUi->CurrentPartition)
|
||||
{
|
||||
CurrentPartLineFound = TRUE;
|
||||
}
|
||||
|
@ -452,7 +482,7 @@ DrawPartitionList(
|
|||
while (Entry2 != &DiskEntry->LogicalPartListHead)
|
||||
{
|
||||
PartEntry = CONTAINING_RECORD(Entry2, PARTENTRY, ListEntry);
|
||||
if (PartEntry == List->CurrentPartition)
|
||||
if (PartEntry == ListUi->CurrentPartition)
|
||||
{
|
||||
CurrentPartLineFound = TRUE;
|
||||
}
|
||||
|
@ -467,7 +497,7 @@ DrawPartitionList(
|
|||
}
|
||||
}
|
||||
|
||||
if (DiskEntry == List->CurrentDisk)
|
||||
if (DiskEntry == ListUi->CurrentDisk)
|
||||
{
|
||||
CurrentDiskLineFound = TRUE;
|
||||
}
|
||||
|
@ -642,16 +672,26 @@ VOID
|
|||
ScrollDownPartitionList(
|
||||
IN PPARTLIST_UI ListUi)
|
||||
{
|
||||
if (GetNextPartition(ListUi->List))
|
||||
PPARTENTRY NextPart = GetNextPartition(ListUi->List, ListUi->CurrentPartition);
|
||||
if (NextPart)
|
||||
{
|
||||
ListUi->CurrentPartition = NextPart;
|
||||
ListUi->CurrentDisk = NextPart->DiskEntry;
|
||||
DrawPartitionList(ListUi);
|
||||
}
|
||||
}
|
||||
|
||||
VOID
|
||||
ScrollUpPartitionList(
|
||||
IN PPARTLIST_UI ListUi)
|
||||
{
|
||||
if (GetPrevPartition(ListUi->List))
|
||||
PPARTENTRY PrevPart = GetPrevPartition(ListUi->List, ListUi->CurrentPartition);
|
||||
if (PrevPart)
|
||||
{
|
||||
ListUi->CurrentPartition = PrevPart;
|
||||
ListUi->CurrentDisk = PrevPart->DiskEntry;
|
||||
DrawPartitionList(ListUi);
|
||||
}
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -45,6 +45,16 @@ typedef struct _PARTLIST_UI
|
|||
{
|
||||
PPARTLIST List;
|
||||
|
||||
/*
|
||||
* Selected partition.
|
||||
*
|
||||
* NOTE that when CurrentPartition != NULL, then CurrentPartition->DiskEntry
|
||||
* must be the same as CurrentDisk. We should however keep the two members
|
||||
* separated as we can have a selected disk without any partition.
|
||||
*/
|
||||
PDISKENTRY CurrentDisk;
|
||||
PPARTENTRY CurrentPartition;
|
||||
|
||||
// PLIST_ENTRY FirstShown;
|
||||
// PLIST_ENTRY LastShown;
|
||||
|
||||
|
@ -70,6 +80,7 @@ VOID
|
|||
InitPartitionListUi(
|
||||
IN OUT PPARTLIST_UI ListUi,
|
||||
IN PPARTLIST List,
|
||||
IN PPARTENTRY CurrentEntry OPTIONAL,
|
||||
IN SHORT Left,
|
||||
IN SHORT Top,
|
||||
IN SHORT Right,
|
||||
|
|
|
@ -45,6 +45,10 @@ BOOLEAN IsUnattendedSetup = FALSE;
|
|||
|
||||
static USETUP_DATA USetupData;
|
||||
|
||||
/* Partition where to perform the installation */
|
||||
static PPARTENTRY InstallPartition = NULL;
|
||||
// static PPARTENTRY SystemPartition = NULL; // The system partition we will actually use (can be different from PartitionList->SystemPartition in case we install on removable disk)
|
||||
|
||||
// FIXME: Is it really useful?? Just used for SetDefaultPagefile...
|
||||
static WCHAR DestinationDriveLetter;
|
||||
|
||||
|
@ -60,7 +64,10 @@ static BOOLEAN RepairUpdateFlag = FALSE;
|
|||
/* Global partition list on the system */
|
||||
static PPARTLIST PartitionList = NULL;
|
||||
|
||||
/* List of currently supported file systems for the partition to be formatted */
|
||||
/* Currently selected partition entry in the list */
|
||||
static PPARTENTRY CurrentPartition = NULL;
|
||||
|
||||
/* List of supported file systems for the partition to be formatted */
|
||||
static PFILE_SYSTEM_LIST FileSystemList = NULL;
|
||||
|
||||
/* Machine state for the formatter */
|
||||
|
@ -1474,14 +1481,18 @@ SelectPartitionPage(PINPUT_RECORD Ir)
|
|||
|
||||
if (RepairUpdateFlag)
|
||||
{
|
||||
ASSERT(CurrentInstallation);
|
||||
|
||||
/* Determine the selected installation disk & partition */
|
||||
if (!SelectPartition(PartitionList,
|
||||
CurrentInstallation->DiskNumber,
|
||||
CurrentInstallation->PartitionNumber))
|
||||
InstallPartition = SelectPartition(PartitionList,
|
||||
CurrentInstallation->DiskNumber,
|
||||
CurrentInstallation->PartitionNumber);
|
||||
if (!InstallPartition)
|
||||
{
|
||||
DPRINT1("RepairUpdateFlag == TRUE, SelectPartition() returned FALSE, assert!\n");
|
||||
ASSERT(FALSE);
|
||||
}
|
||||
ASSERT(!IsContainerPartition(InstallPartition->PartitionType));
|
||||
|
||||
return SELECT_FILE_SYSTEM_PAGE;
|
||||
}
|
||||
|
@ -1489,52 +1500,62 @@ SelectPartitionPage(PINPUT_RECORD Ir)
|
|||
MUIDisplayPage(SELECT_PARTITION_PAGE);
|
||||
|
||||
InitPartitionListUi(&ListUi, PartitionList,
|
||||
2,
|
||||
23,
|
||||
CurrentPartition,
|
||||
2, 23,
|
||||
xScreen - 3,
|
||||
yScreen - 3);
|
||||
DrawPartitionList(&ListUi);
|
||||
|
||||
if (IsUnattendedSetup)
|
||||
{
|
||||
if (!SelectPartition(PartitionList,
|
||||
USetupData.DestinationDiskNumber,
|
||||
USetupData.DestinationPartitionNumber))
|
||||
/* Determine the selected installation disk & partition */
|
||||
InstallPartition = SelectPartition(PartitionList,
|
||||
USetupData.DestinationDiskNumber,
|
||||
USetupData.DestinationPartitionNumber);
|
||||
if (!InstallPartition)
|
||||
{
|
||||
CurrentPartition = ListUi.CurrentPartition;
|
||||
|
||||
if (USetupData.AutoPartition)
|
||||
{
|
||||
if (PartitionList->CurrentPartition->LogicalPartition)
|
||||
ASSERT(CurrentPartition != NULL);
|
||||
ASSERT(!IsContainerPartition(CurrentPartition->PartitionType));
|
||||
|
||||
if (CurrentPartition->LogicalPartition)
|
||||
{
|
||||
CreateLogicalPartition(PartitionList,
|
||||
PartitionList->CurrentPartition,
|
||||
PartitionList->CurrentPartition->SectorCount.QuadPart,
|
||||
CurrentPartition,
|
||||
CurrentPartition->SectorCount.QuadPart,
|
||||
TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
CreatePrimaryPartition(PartitionList,
|
||||
PartitionList->CurrentPartition,
|
||||
PartitionList->CurrentPartition->SectorCount.QuadPart,
|
||||
CurrentPartition,
|
||||
CurrentPartition->SectorCount.QuadPart,
|
||||
TRUE);
|
||||
}
|
||||
|
||||
// FIXME?? Aren't we going to enter an infinite loop, if this test fails??
|
||||
if (!IsDiskSizeValid(PartitionList->CurrentPartition))
|
||||
if (!IsDiskSizeValid(CurrentPartition))
|
||||
{
|
||||
MUIDisplayError(ERROR_INSUFFICIENT_PARTITION_SIZE, Ir, POPUP_WAIT_ANY_KEY,
|
||||
USetupData.RequiredPartitionDiskSpace);
|
||||
return SELECT_PARTITION_PAGE; /* let the user select another partition */
|
||||
}
|
||||
|
||||
InstallPartition = CurrentPartition;
|
||||
return SELECT_FILE_SYSTEM_PAGE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawPartitionList(&ListUi);
|
||||
ASSERT(!IsContainerPartition(InstallPartition->PartitionType));
|
||||
|
||||
DrawPartitionList(&ListUi); // FIXME: Doesn't make much sense...
|
||||
|
||||
// FIXME?? Aren't we going to enter an infinite loop, if this test fails??
|
||||
if (!IsDiskSizeValid(PartitionList->CurrentPartition))
|
||||
if (!IsDiskSizeValid(InstallPartition))
|
||||
{
|
||||
MUIDisplayError(ERROR_INSUFFICIENT_PARTITION_SIZE, Ir, POPUP_WAIT_ANY_KEY,
|
||||
USetupData.RequiredPartitionDiskSpace);
|
||||
|
@ -1547,14 +1568,16 @@ SelectPartitionPage(PINPUT_RECORD Ir)
|
|||
|
||||
while (TRUE)
|
||||
{
|
||||
CurrentPartition = ListUi.CurrentPartition;
|
||||
|
||||
/* Update status text */
|
||||
if (PartitionList->CurrentPartition == NULL)
|
||||
if (CurrentPartition == NULL)
|
||||
{
|
||||
CONSOLE_SetStatusText(MUIGetString(STRING_INSTALLCREATEPARTITION));
|
||||
}
|
||||
else if (PartitionList->CurrentPartition->LogicalPartition)
|
||||
else if (CurrentPartition->LogicalPartition)
|
||||
{
|
||||
if (PartitionList->CurrentPartition->IsPartitioned)
|
||||
if (CurrentPartition->IsPartitioned)
|
||||
{
|
||||
CONSOLE_SetStatusText(MUIGetString(STRING_DELETEPARTITION));
|
||||
}
|
||||
|
@ -1565,9 +1588,9 @@ SelectPartitionPage(PINPUT_RECORD Ir)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (PartitionList->CurrentPartition->IsPartitioned)
|
||||
if (CurrentPartition->IsPartitioned)
|
||||
{
|
||||
if (IsContainerPartition(PartitionList->CurrentPartition->PartitionType))
|
||||
if (IsContainerPartition(CurrentPartition->PartitionType))
|
||||
{
|
||||
CONSOLE_SetStatusText(MUIGetString(STRING_DELETEPARTITION));
|
||||
}
|
||||
|
@ -1608,15 +1631,16 @@ SelectPartitionPage(PINPUT_RECORD Ir)
|
|||
}
|
||||
else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_RETURN) /* ENTER */
|
||||
{
|
||||
if (IsContainerPartition(PartitionList->CurrentPartition->PartitionType))
|
||||
ASSERT(CurrentPartition != NULL);
|
||||
|
||||
if (IsContainerPartition(CurrentPartition->PartitionType))
|
||||
continue; // return SELECT_PARTITION_PAGE;
|
||||
|
||||
if (PartitionList->CurrentPartition == NULL ||
|
||||
PartitionList->CurrentPartition->IsPartitioned == FALSE)
|
||||
if (CurrentPartition->IsPartitioned == FALSE)
|
||||
{
|
||||
if (PartitionList->CurrentPartition->LogicalPartition)
|
||||
if (CurrentPartition->LogicalPartition)
|
||||
{
|
||||
Error = LogicalPartitionCreationChecks(PartitionList->CurrentPartition);
|
||||
Error = LogicalPartitionCreationChecks(CurrentPartition);
|
||||
if (Error != NOT_AN_ERROR)
|
||||
{
|
||||
MUIDisplayError(Error, Ir, POPUP_WAIT_ANY_KEY);
|
||||
|
@ -1624,13 +1648,13 @@ SelectPartitionPage(PINPUT_RECORD Ir)
|
|||
}
|
||||
|
||||
CreateLogicalPartition(PartitionList,
|
||||
PartitionList->CurrentPartition,
|
||||
CurrentPartition,
|
||||
0ULL,
|
||||
TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
Error = PrimaryPartitionCreationChecks(PartitionList->CurrentPartition);
|
||||
Error = PrimaryPartitionCreationChecks(CurrentPartition);
|
||||
if (Error != NOT_AN_ERROR)
|
||||
{
|
||||
MUIDisplayError(Error, Ir, POPUP_WAIT_ANY_KEY);
|
||||
|
@ -1638,26 +1662,29 @@ SelectPartitionPage(PINPUT_RECORD Ir)
|
|||
}
|
||||
|
||||
CreatePrimaryPartition(PartitionList,
|
||||
PartitionList->CurrentPartition,
|
||||
CurrentPartition,
|
||||
0ULL,
|
||||
TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
if (!IsDiskSizeValid(PartitionList->CurrentPartition))
|
||||
if (!IsDiskSizeValid(CurrentPartition))
|
||||
{
|
||||
MUIDisplayError(ERROR_INSUFFICIENT_PARTITION_SIZE, Ir, POPUP_WAIT_ANY_KEY,
|
||||
USetupData.RequiredPartitionDiskSpace);
|
||||
return SELECT_PARTITION_PAGE; /* let the user select another partition */
|
||||
}
|
||||
|
||||
InstallPartition = CurrentPartition;
|
||||
return SELECT_FILE_SYSTEM_PAGE;
|
||||
}
|
||||
else if (Ir->Event.KeyEvent.wVirtualKeyCode == 'P') /* P */
|
||||
{
|
||||
if (PartitionList->CurrentPartition->LogicalPartition == FALSE)
|
||||
ASSERT(CurrentPartition != NULL);
|
||||
|
||||
if (CurrentPartition->LogicalPartition == FALSE)
|
||||
{
|
||||
Error = PrimaryPartitionCreationChecks(PartitionList->CurrentPartition);
|
||||
Error = PrimaryPartitionCreationChecks(CurrentPartition);
|
||||
if (Error != NOT_AN_ERROR)
|
||||
{
|
||||
MUIDisplayError(Error, Ir, POPUP_WAIT_ANY_KEY);
|
||||
|
@ -1669,9 +1696,11 @@ SelectPartitionPage(PINPUT_RECORD Ir)
|
|||
}
|
||||
else if (Ir->Event.KeyEvent.wVirtualKeyCode == 'E') /* E */
|
||||
{
|
||||
if (PartitionList->CurrentPartition->LogicalPartition == FALSE)
|
||||
ASSERT(CurrentPartition != NULL);
|
||||
|
||||
if (CurrentPartition->LogicalPartition == FALSE)
|
||||
{
|
||||
Error = ExtendedPartitionCreationChecks(PartitionList->CurrentPartition);
|
||||
Error = ExtendedPartitionCreationChecks(CurrentPartition);
|
||||
if (Error != NOT_AN_ERROR)
|
||||
{
|
||||
MUIDisplayError(Error, Ir, POPUP_WAIT_ANY_KEY);
|
||||
|
@ -1683,9 +1712,11 @@ SelectPartitionPage(PINPUT_RECORD Ir)
|
|||
}
|
||||
else if (Ir->Event.KeyEvent.wVirtualKeyCode == 'L') /* L */
|
||||
{
|
||||
if (PartitionList->CurrentPartition->LogicalPartition)
|
||||
ASSERT(CurrentPartition != NULL);
|
||||
|
||||
if (CurrentPartition->LogicalPartition)
|
||||
{
|
||||
Error = LogicalPartitionCreationChecks(PartitionList->CurrentPartition);
|
||||
Error = LogicalPartitionCreationChecks(CurrentPartition);
|
||||
if (Error != NOT_AN_ERROR)
|
||||
{
|
||||
MUIDisplayError(Error, Ir, POPUP_WAIT_ANY_KEY);
|
||||
|
@ -1697,33 +1728,36 @@ SelectPartitionPage(PINPUT_RECORD Ir)
|
|||
}
|
||||
else if (Ir->Event.KeyEvent.wVirtualKeyCode == 'D') /* D */
|
||||
{
|
||||
UNICODE_STRING CurrentPartition;
|
||||
UNICODE_STRING CurrentPartitionU;
|
||||
WCHAR PathBuffer[MAX_PATH];
|
||||
|
||||
if (PartitionList->CurrentPartition->IsPartitioned == FALSE)
|
||||
ASSERT(CurrentPartition != NULL);
|
||||
|
||||
if (CurrentPartition->IsPartitioned == FALSE)
|
||||
{
|
||||
MUIDisplayError(ERROR_DELETE_SPACE, Ir, POPUP_WAIT_ANY_KEY);
|
||||
return SELECT_PARTITION_PAGE;
|
||||
}
|
||||
|
||||
// TODO: Do something similar before trying to format the partition?
|
||||
if (!PartitionList->CurrentPartition->New &&
|
||||
PartitionList->CurrentPartition->FormatState != Unformatted)
|
||||
if (!CurrentPartition->New &&
|
||||
!IsContainerPartition(CurrentPartition->PartitionType) &&
|
||||
CurrentPartition->FormatState != Unformatted)
|
||||
{
|
||||
ASSERT(PartitionList->CurrentPartition->PartitionNumber != 0);
|
||||
ASSERT(CurrentPartition->PartitionNumber != 0);
|
||||
|
||||
RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
|
||||
L"\\Device\\Harddisk%lu\\Partition%lu\\",
|
||||
PartitionList->CurrentDisk->DiskNumber,
|
||||
PartitionList->CurrentPartition->PartitionNumber);
|
||||
RtlInitUnicodeString(&CurrentPartition, PathBuffer);
|
||||
CurrentPartition->DiskEntry->DiskNumber,
|
||||
CurrentPartition->PartitionNumber);
|
||||
RtlInitUnicodeString(&CurrentPartitionU, PathBuffer);
|
||||
|
||||
/*
|
||||
* Check whether the user attempts to delete the partition on which
|
||||
* the installation source is present. If so, fail with an error.
|
||||
*/
|
||||
// &USetupData.SourceRootPath
|
||||
if (RtlPrefixUnicodeString(&CurrentPartition, &USetupData.SourcePath, TRUE))
|
||||
if (RtlPrefixUnicodeString(&CurrentPartitionU, &USetupData.SourcePath, TRUE))
|
||||
{
|
||||
PopupError("You cannot delete the partition containing the installation source!",
|
||||
MUIGetString(STRING_CONTINUE),
|
||||
|
@ -1732,8 +1766,9 @@ SelectPartitionPage(PINPUT_RECORD Ir)
|
|||
}
|
||||
}
|
||||
|
||||
if (PartitionList->CurrentPartition == PartitionList->SystemPartition ||
|
||||
PartitionList->CurrentPartition->BootIndicator)
|
||||
// FIXME TODO: PartitionList->SystemPartition is not yet initialized!!!!
|
||||
if (CurrentPartition == PartitionList->SystemPartition ||
|
||||
CurrentPartition->BootIndicator)
|
||||
{
|
||||
return CONFIRM_DELETE_SYSTEM_PARTITION_PAGE;
|
||||
}
|
||||
|
@ -1947,8 +1982,8 @@ ShowPartitionSizeInputBox(SHORT Left,
|
|||
static PAGE_NUMBER
|
||||
CreatePrimaryPartitionPage(PINPUT_RECORD Ir)
|
||||
{
|
||||
PDISKENTRY DiskEntry;
|
||||
PPARTENTRY PartEntry;
|
||||
PDISKENTRY DiskEntry;
|
||||
BOOLEAN Quit;
|
||||
BOOLEAN Cancel;
|
||||
WCHAR InputBuffer[50];
|
||||
|
@ -1958,16 +1993,14 @@ CreatePrimaryPartitionPage(PINPUT_RECORD Ir)
|
|||
ULONGLONG SectorCount;
|
||||
PCHAR Unit;
|
||||
|
||||
if (PartitionList == NULL ||
|
||||
PartitionList->CurrentDisk == NULL ||
|
||||
PartitionList->CurrentPartition == NULL)
|
||||
if (PartitionList == NULL || CurrentPartition == NULL)
|
||||
{
|
||||
/* FIXME: show an error dialog */
|
||||
return QUIT_PAGE;
|
||||
}
|
||||
|
||||
DiskEntry = PartitionList->CurrentDisk;
|
||||
PartEntry = PartitionList->CurrentPartition;
|
||||
PartEntry = CurrentPartition;
|
||||
DiskEntry = CurrentPartition->DiskEntry;
|
||||
|
||||
CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT));
|
||||
|
||||
|
@ -2024,12 +2057,12 @@ CreatePrimaryPartitionPage(PINPUT_RECORD Ir)
|
|||
|
||||
#if 0
|
||||
CONSOLE_PrintTextXY(8, 10, "Maximum size of the new partition is %I64u MB",
|
||||
PartitionList->CurrentPartition->SectorCount * DiskEntry->BytesPerSector / MB);
|
||||
CurrentPartition->SectorCount * DiskEntry->BytesPerSector / MB);
|
||||
#endif
|
||||
|
||||
CONSOLE_SetStatusText(MUIGetString(STRING_CREATEPARTITION));
|
||||
|
||||
PartEntry = PartitionList->CurrentPartition;
|
||||
PartEntry = CurrentPartition;
|
||||
while (TRUE)
|
||||
{
|
||||
MaxSize = (PartEntry->SectorCount.QuadPart * DiskEntry->BytesPerSector) / MB; /* in MBytes (rounded) */
|
||||
|
@ -2086,7 +2119,7 @@ CreatePrimaryPartitionPage(PINPUT_RECORD Ir)
|
|||
DPRINT ("Partition size: %I64u bytes\n", PartSize);
|
||||
|
||||
CreatePrimaryPartition(PartitionList,
|
||||
PartitionList->CurrentPartition,
|
||||
CurrentPartition,
|
||||
SectorCount,
|
||||
FALSE);
|
||||
|
||||
|
@ -2111,8 +2144,8 @@ CreatePrimaryPartitionPage(PINPUT_RECORD Ir)
|
|||
static PAGE_NUMBER
|
||||
CreateExtendedPartitionPage(PINPUT_RECORD Ir)
|
||||
{
|
||||
PDISKENTRY DiskEntry;
|
||||
PPARTENTRY PartEntry;
|
||||
PDISKENTRY DiskEntry;
|
||||
BOOLEAN Quit;
|
||||
BOOLEAN Cancel;
|
||||
WCHAR InputBuffer[50];
|
||||
|
@ -2122,16 +2155,14 @@ CreateExtendedPartitionPage(PINPUT_RECORD Ir)
|
|||
ULONGLONG SectorCount;
|
||||
PCHAR Unit;
|
||||
|
||||
if (PartitionList == NULL ||
|
||||
PartitionList->CurrentDisk == NULL ||
|
||||
PartitionList->CurrentPartition == NULL)
|
||||
if (PartitionList == NULL || CurrentPartition == NULL)
|
||||
{
|
||||
/* FIXME: show an error dialog */
|
||||
return QUIT_PAGE;
|
||||
}
|
||||
|
||||
DiskEntry = PartitionList->CurrentDisk;
|
||||
PartEntry = PartitionList->CurrentPartition;
|
||||
PartEntry = CurrentPartition;
|
||||
DiskEntry = CurrentPartition->DiskEntry;
|
||||
|
||||
CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT));
|
||||
|
||||
|
@ -2188,12 +2219,12 @@ CreateExtendedPartitionPage(PINPUT_RECORD Ir)
|
|||
|
||||
#if 0
|
||||
CONSOLE_PrintTextXY(8, 10, "Maximum size of the new partition is %I64u MB",
|
||||
PartitionList->CurrentPartition->SectorCount * DiskEntry->BytesPerSector / MB);
|
||||
CurrentPartition->SectorCount * DiskEntry->BytesPerSector / MB);
|
||||
#endif
|
||||
|
||||
CONSOLE_SetStatusText(MUIGetString(STRING_CREATEPARTITION));
|
||||
|
||||
PartEntry = PartitionList->CurrentPartition;
|
||||
PartEntry = CurrentPartition;
|
||||
while (TRUE)
|
||||
{
|
||||
MaxSize = (PartEntry->SectorCount.QuadPart * DiskEntry->BytesPerSector) / MB; /* in MBytes (rounded) */
|
||||
|
@ -2250,7 +2281,7 @@ CreateExtendedPartitionPage(PINPUT_RECORD Ir)
|
|||
DPRINT ("Partition size: %I64u bytes\n", PartSize);
|
||||
|
||||
CreateExtendedPartition(PartitionList,
|
||||
PartitionList->CurrentPartition,
|
||||
CurrentPartition,
|
||||
SectorCount);
|
||||
|
||||
return SELECT_PARTITION_PAGE;
|
||||
|
@ -2274,8 +2305,8 @@ CreateExtendedPartitionPage(PINPUT_RECORD Ir)
|
|||
static PAGE_NUMBER
|
||||
CreateLogicalPartitionPage(PINPUT_RECORD Ir)
|
||||
{
|
||||
PDISKENTRY DiskEntry;
|
||||
PPARTENTRY PartEntry;
|
||||
PDISKENTRY DiskEntry;
|
||||
BOOLEAN Quit;
|
||||
BOOLEAN Cancel;
|
||||
WCHAR InputBuffer[50];
|
||||
|
@ -2285,16 +2316,14 @@ CreateLogicalPartitionPage(PINPUT_RECORD Ir)
|
|||
ULONGLONG SectorCount;
|
||||
PCHAR Unit;
|
||||
|
||||
if (PartitionList == NULL ||
|
||||
PartitionList->CurrentDisk == NULL ||
|
||||
PartitionList->CurrentPartition == NULL)
|
||||
if (PartitionList == NULL || CurrentPartition == NULL)
|
||||
{
|
||||
/* FIXME: show an error dialog */
|
||||
return QUIT_PAGE;
|
||||
}
|
||||
|
||||
DiskEntry = PartitionList->CurrentDisk;
|
||||
PartEntry = PartitionList->CurrentPartition;
|
||||
PartEntry = CurrentPartition;
|
||||
DiskEntry = CurrentPartition->DiskEntry;
|
||||
|
||||
CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT));
|
||||
|
||||
|
@ -2351,12 +2380,12 @@ CreateLogicalPartitionPage(PINPUT_RECORD Ir)
|
|||
|
||||
#if 0
|
||||
CONSOLE_PrintTextXY(8, 10, "Maximum size of the new partition is %I64u MB",
|
||||
PartitionList->CurrentPartition->SectorCount * DiskEntry->BytesPerSector / MB);
|
||||
CurrentPartition->SectorCount * DiskEntry->BytesPerSector / MB);
|
||||
#endif
|
||||
|
||||
CONSOLE_SetStatusText(MUIGetString(STRING_CREATEPARTITION));
|
||||
|
||||
PartEntry = PartitionList->CurrentPartition;
|
||||
PartEntry = CurrentPartition;
|
||||
while (TRUE)
|
||||
{
|
||||
MaxSize = (PartEntry->SectorCount.QuadPart * DiskEntry->BytesPerSector) / MB; /* in MBytes (rounded) */
|
||||
|
@ -2413,7 +2442,7 @@ CreateLogicalPartitionPage(PINPUT_RECORD Ir)
|
|||
DPRINT("Partition size: %I64u bytes\n", PartSize);
|
||||
|
||||
CreateLogicalPartition(PartitionList,
|
||||
PartitionList->CurrentPartition,
|
||||
CurrentPartition,
|
||||
SectorCount,
|
||||
FALSE);
|
||||
|
||||
|
@ -2479,23 +2508,21 @@ ConfirmDeleteSystemPartitionPage(PINPUT_RECORD Ir)
|
|||
static PAGE_NUMBER
|
||||
DeletePartitionPage(PINPUT_RECORD Ir)
|
||||
{
|
||||
PDISKENTRY DiskEntry;
|
||||
PPARTENTRY PartEntry;
|
||||
PDISKENTRY DiskEntry;
|
||||
ULONGLONG DiskSize;
|
||||
ULONGLONG PartSize;
|
||||
PCHAR Unit;
|
||||
CHAR PartTypeString[32];
|
||||
|
||||
if (PartitionList == NULL ||
|
||||
PartitionList->CurrentDisk == NULL ||
|
||||
PartitionList->CurrentPartition == NULL)
|
||||
if (PartitionList == NULL || CurrentPartition == NULL)
|
||||
{
|
||||
/* FIXME: show an error dialog */
|
||||
return QUIT_PAGE;
|
||||
}
|
||||
|
||||
DiskEntry = PartitionList->CurrentDisk;
|
||||
PartEntry = PartitionList->CurrentPartition;
|
||||
PartEntry = CurrentPartition;
|
||||
DiskEntry = CurrentPartition->DiskEntry;
|
||||
|
||||
MUIDisplayPage(DELETE_PARTITION_PAGE);
|
||||
|
||||
|
@ -2610,7 +2637,9 @@ DeletePartitionPage(PINPUT_RECORD Ir)
|
|||
}
|
||||
else if (Ir->Event.KeyEvent.wVirtualKeyCode == 'D') /* D */
|
||||
{
|
||||
DeleteCurrentPartition(PartitionList);
|
||||
DeletePartition(PartitionList,
|
||||
CurrentPartition,
|
||||
&CurrentPartition);
|
||||
return SELECT_PARTITION_PAGE;
|
||||
}
|
||||
}
|
||||
|
@ -2650,8 +2679,8 @@ ResetFileSystemList(VOID)
|
|||
static PAGE_NUMBER
|
||||
SelectFileSystemPage(PINPUT_RECORD Ir)
|
||||
{
|
||||
PDISKENTRY DiskEntry;
|
||||
PPARTENTRY PartEntry;
|
||||
PDISKENTRY DiskEntry;
|
||||
ULONGLONG DiskSize;
|
||||
ULONGLONG PartSize;
|
||||
PCHAR DiskUnit;
|
||||
|
@ -2662,9 +2691,7 @@ SelectFileSystemPage(PINPUT_RECORD Ir)
|
|||
|
||||
DPRINT("SelectFileSystemPage()\n");
|
||||
|
||||
if (PartitionList == NULL ||
|
||||
PartitionList->CurrentDisk == NULL ||
|
||||
PartitionList->CurrentPartition == NULL)
|
||||
if (PartitionList == NULL || InstallPartition == NULL)
|
||||
{
|
||||
/* FIXME: show an error dialog */
|
||||
return QUIT_PAGE;
|
||||
|
@ -2674,7 +2701,10 @@ SelectFileSystemPage(PINPUT_RECORD Ir)
|
|||
if (FormatState == Start)
|
||||
{
|
||||
/* Find or set the active system partition */
|
||||
CheckActiveSystemPartition(PartitionList);
|
||||
CheckActiveSystemPartition(PartitionList,
|
||||
FALSE,
|
||||
InstallPartition->DiskEntry,
|
||||
InstallPartition);
|
||||
if (PartitionList->SystemPartition == NULL)
|
||||
{
|
||||
/* FIXME: show an error dialog */
|
||||
|
@ -2720,8 +2750,8 @@ SelectFileSystemPage(PINPUT_RECORD Ir)
|
|||
* we must perform a filesystem check of both the system and the
|
||||
* installation partitions.
|
||||
*/
|
||||
PartitionList->CurrentPartition->NeedsCheck = TRUE;
|
||||
if (PartitionList->SystemPartition != PartitionList->CurrentPartition)
|
||||
InstallPartition->NeedsCheck = TRUE;
|
||||
if (PartitionList->SystemPartition != InstallPartition)
|
||||
PartitionList->SystemPartition->NeedsCheck = TRUE;
|
||||
|
||||
/*
|
||||
|
@ -2755,7 +2785,7 @@ SelectFileSystemPage(PINPUT_RECORD Ir)
|
|||
|
||||
ASSERT(PartitionList->SystemPartition->IsPartitioned);
|
||||
|
||||
if ((PartitionList->SystemPartition != PartitionList->CurrentPartition) &&
|
||||
if ((PartitionList->SystemPartition != InstallPartition) &&
|
||||
(PartitionList->SystemPartition->FormatState == Unformatted))
|
||||
{
|
||||
TempPartition = PartitionList->SystemPartition;
|
||||
|
@ -2770,10 +2800,10 @@ SelectFileSystemPage(PINPUT_RECORD Ir)
|
|||
}
|
||||
else
|
||||
{
|
||||
TempPartition = PartitionList->CurrentPartition;
|
||||
TempPartition = InstallPartition;
|
||||
TempPartition->NeedsCheck = TRUE;
|
||||
|
||||
if (PartitionList->SystemPartition != PartitionList->CurrentPartition)
|
||||
if (PartitionList->SystemPartition != InstallPartition)
|
||||
{
|
||||
/* The system partition is separate, so it had better be formatted! */
|
||||
ASSERT((PartitionList->SystemPartition->FormatState == Preformatted) ||
|
||||
|
@ -2791,7 +2821,7 @@ SelectFileSystemPage(PINPUT_RECORD Ir)
|
|||
|
||||
case FormatSystemPartition:
|
||||
{
|
||||
TempPartition = PartitionList->CurrentPartition;
|
||||
TempPartition = InstallPartition;
|
||||
TempPartition->NeedsCheck = TRUE;
|
||||
|
||||
FormatState = FormatInstallPartition;
|
||||
|
@ -2843,7 +2873,7 @@ SelectFileSystemPage(PINPUT_RECORD Ir)
|
|||
}
|
||||
|
||||
PartEntry = TempPartition;
|
||||
DiskEntry = PartEntry->DiskEntry;
|
||||
DiskEntry = TempPartition->DiskEntry;
|
||||
|
||||
ASSERT(PartEntry->IsPartitioned && PartEntry->PartitionNumber != 0);
|
||||
|
||||
|
@ -3063,7 +3093,7 @@ SelectFileSystemPage(PINPUT_RECORD Ir)
|
|||
* or the installation partition.
|
||||
*/
|
||||
if (TempPartition != PartitionList->SystemPartition &&
|
||||
TempPartition != PartitionList->CurrentPartition)
|
||||
TempPartition != InstallPartition)
|
||||
{
|
||||
PartEntry->NeedsCheck = FALSE;
|
||||
}
|
||||
|
@ -3093,7 +3123,7 @@ SelectFileSystemPage(PINPUT_RECORD Ir)
|
|||
* QuitPage
|
||||
*
|
||||
* SIDEEFFECTS
|
||||
* Sets PartitionList->CurrentPartition->FormatState
|
||||
* Sets InstallPartition->FormatState
|
||||
* Sets USetupData.DestinationRootPath
|
||||
*
|
||||
* RETURNS
|
||||
|
@ -3103,8 +3133,8 @@ static PAGE_NUMBER
|
|||
FormatPartitionPage(PINPUT_RECORD Ir)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
PDISKENTRY DiskEntry;
|
||||
PPARTENTRY PartEntry;
|
||||
PDISKENTRY DiskEntry;
|
||||
PFILE_SYSTEM_ITEM SelectedFileSystem;
|
||||
UNICODE_STRING PartitionRootPath;
|
||||
WCHAR PathBuffer[MAX_PATH];
|
||||
|
@ -3127,7 +3157,7 @@ FormatPartitionPage(PINPUT_RECORD Ir)
|
|||
}
|
||||
|
||||
PartEntry = TempPartition;
|
||||
DiskEntry = PartEntry->DiskEntry;
|
||||
DiskEntry = TempPartition->DiskEntry;
|
||||
|
||||
ASSERT(PartEntry->IsPartitioned && PartEntry->PartitionNumber != 0);
|
||||
|
||||
|
@ -3405,13 +3435,13 @@ CheckFileSystemPage(PINPUT_RECORD Ir)
|
|||
|
||||
|
||||
static NTSTATUS
|
||||
BuildInstallPaths(PWSTR InstallDir,
|
||||
PDISKENTRY DiskEntry,
|
||||
PPARTENTRY PartEntry)
|
||||
BuildInstallPaths(
|
||||
IN PCWSTR InstallDir,
|
||||
IN PPARTENTRY PartEntry)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
|
||||
Status = InitDestinationPaths(&USetupData, InstallDir, DiskEntry, PartEntry);
|
||||
Status = InitDestinationPaths(&USetupData, InstallDir, PartEntry);
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
|
@ -3485,27 +3515,20 @@ IsValidPath(
|
|||
static PAGE_NUMBER
|
||||
InstallDirectoryPage(PINPUT_RECORD Ir)
|
||||
{
|
||||
PDISKENTRY DiskEntry;
|
||||
PPARTENTRY PartEntry;
|
||||
WCHAR InstallDir[MAX_PATH];
|
||||
WCHAR c;
|
||||
ULONG Length, Pos;
|
||||
NTSTATUS Status;
|
||||
ULONG Length, Pos;
|
||||
WCHAR c;
|
||||
WCHAR InstallDir[MAX_PATH];
|
||||
|
||||
/* We do not need the filesystem list anymore */
|
||||
ResetFileSystemList();
|
||||
|
||||
if (PartitionList == NULL ||
|
||||
PartitionList->CurrentDisk == NULL ||
|
||||
PartitionList->CurrentPartition == NULL)
|
||||
if (PartitionList == NULL || InstallPartition == NULL)
|
||||
{
|
||||
/* FIXME: show an error dialog */
|
||||
return QUIT_PAGE;
|
||||
}
|
||||
|
||||
DiskEntry = PartitionList->CurrentDisk;
|
||||
PartEntry = PartitionList->CurrentPartition;
|
||||
|
||||
// if (IsUnattendedSetup)
|
||||
if (RepairUpdateFlag)
|
||||
wcscpy(InstallDir, CurrentInstallation->PathComponent); // SystemNtPath
|
||||
|
@ -3523,9 +3546,7 @@ InstallDirectoryPage(PINPUT_RECORD Ir)
|
|||
*/
|
||||
if ((RepairUpdateFlag || IsUnattendedSetup) && IsValidPath(InstallDir))
|
||||
{
|
||||
Status = BuildInstallPaths(InstallDir,
|
||||
DiskEntry,
|
||||
PartEntry);
|
||||
Status = BuildInstallPaths(InstallDir, InstallPartition);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT1("BuildInstallPaths() failed. Status code: 0x%lx", Status);
|
||||
|
@ -3633,9 +3654,7 @@ InstallDirectoryPage(PINPUT_RECORD Ir)
|
|||
return INSTALL_DIRECTORY_PAGE;
|
||||
}
|
||||
|
||||
Status = BuildInstallPaths(InstallDir,
|
||||
DiskEntry,
|
||||
PartEntry);
|
||||
Status = BuildInstallPaths(InstallDir, InstallPartition);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT1("BuildInstallPaths() failed. Status code: 0x%lx", Status);
|
||||
|
|
Loading…
Reference in a new issue