[USETUP] Implement most of the "upgrade" page, where existing NTOS installations are listed.

- Modify a bit the page flow so that the upgrade page is inserted before
  the Device-settings page, and after the Install-Intro page.

- Insert some extra 'RepairUpdateFlag' checks in SelectPartitionPage() and
  InstallDirectoryPage() to take specific actions in case the flag is TRUE.

svn path=/branches/setup_improvements/; revision=74576
svn path=/branches/setup_improvements/; revision=75525
This commit is contained in:
Hermès Bélusca-Maïto 2018-05-31 16:38:06 +02:00
parent 29ace9c0dc
commit 49d3daf1af
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0

View file

@ -102,6 +102,9 @@ static HINF SetupInf;
static HSPFILEQ SetupFileQueue = NULL;
static PNTOS_INSTALLATION CurrentInstallation = NULL;
static PGENERIC_LIST NtOsInstallsList = NULL;
static PGENERIC_LIST ComputerList = NULL;
static PGENERIC_LIST DisplayList = NULL;
static PGENERIC_LIST KeyboardList = NULL;
@ -937,6 +940,7 @@ SetupStartPage(PINPUT_RECORD Ir)
* Next pages:
* InstallIntroPage (default)
* RepairIntroPage
* RecoveryPage
* LicensePage
* QuitPage
*
@ -966,7 +970,7 @@ WelcomePage(PINPUT_RECORD Ir)
}
else if (toupper(Ir->Event.KeyEvent.uChar.AsciiChar) == 'R') /* R */
{
return REPAIR_INTRO_PAGE;
return RECOVERY_PAGE; // REPAIR_INTRO_PAGE;
}
else if (toupper(Ir->Event.KeyEvent.uChar.AsciiChar) == 'L') /* L */
{
@ -1050,6 +1054,134 @@ RepairIntroPage(PINPUT_RECORD Ir)
return REPAIR_INTRO_PAGE;
}
/*
* Displays the UpgradeRepairPage.
*
* Next pages:
* RebootPage (default)
* InstallIntroPage
* RecoveryPage
* WelcomePage
*
* RETURNS
* Number of the next page.
*/
static PAGE_NUMBER
UpgradeRepairPage(PINPUT_RECORD Ir)
{
GENERIC_LIST_UI ListUi;
/*** HACK!! ***/
if (PartitionList == NULL)
{
PartitionList = CreatePartitionList();
if (PartitionList == NULL)
{
/* FIXME: show an error dialog */
MUIDisplayError(ERROR_DRIVE_INFORMATION, Ir, POPUP_WAIT_ENTER);
return QUIT_PAGE;
}
else if (IsListEmpty(&PartitionList->DiskListHead))
{
MUIDisplayError(ERROR_NO_HDD, Ir, POPUP_WAIT_ENTER);
return QUIT_PAGE;
}
TempPartition = NULL;
FormatState = Start;
}
/**************/
NtOsInstallsList = CreateNTOSInstallationsList(PartitionList);
if (!NtOsInstallsList)
DPRINT1("Failed to get a list of NTOS installations; continue installation...\n");
if (!NtOsInstallsList || GetNumberOfListEntries(NtOsInstallsList) == 0)
{
RepairUpdateFlag = FALSE;
// return INSTALL_INTRO_PAGE;
return DEVICE_SETTINGS_PAGE;
// return SCSI_CONTROLLER_PAGE;
}
MUIDisplayPage(UPGRADE_REPAIR_PAGE);
InitGenericListUi(&ListUi, NtOsInstallsList);
DrawGenericList(&ListUi,
2, 23,
xScreen - 3,
yScreen - 3);
SaveGenericListState(NtOsInstallsList);
// return HandleGenericList(&ListUi, DEVICE_SETTINGS_PAGE, Ir);
while (TRUE)
{
CONSOLE_ConInKey(Ir);
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x00)
{
switch (Ir->Event.KeyEvent.wVirtualKeyCode)
{
case VK_DOWN: /* DOWN */
ScrollDownGenericList(&ListUi);
break;
case VK_UP: /* UP */
ScrollUpGenericList(&ListUi);
break;
case VK_NEXT: /* PAGE DOWN */
ScrollPageDownGenericList(&ListUi);
break;
case VK_PRIOR: /* PAGE UP */
ScrollPageUpGenericList(&ListUi);
break;
case VK_F3: /* F3 */
{
if (ConfirmQuit(Ir) == TRUE)
return QUIT_PAGE;
else
RedrawGenericList(&ListUi);
break;
}
case VK_ESCAPE: /* ESC */
{
RestoreGenericListState(NtOsInstallsList);
// return nextPage; // prevPage;
// return INSTALL_INTRO_PAGE;
return DEVICE_SETTINGS_PAGE;
// return SCSI_CONTROLLER_PAGE;
}
}
}
else
{
// switch (toupper(Ir->Event.KeyEvent.uChar.AsciiChar))
// if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
if (toupper(Ir->Event.KeyEvent.uChar.AsciiChar) == 'U') /* U */
{
/* Retrieve the current installation */
CurrentInstallation = (PNTOS_INSTALLATION)GetListEntryUserData(GetCurrentListEntry(NtOsInstallsList));
DPRINT1("Selected installation for repair: \"%S\" ; DiskNumber = %d , PartitionNumber = %d\n",
CurrentInstallation->InstallationName, CurrentInstallation->DiskNumber, CurrentInstallation->PartitionNumber);
RepairUpdateFlag = TRUE;
// return nextPage;
/***/return INSTALL_INTRO_PAGE;/***/
}
else if ((Ir->Event.KeyEvent.uChar.AsciiChar > 0x60) &&
(Ir->Event.KeyEvent.uChar.AsciiChar < 0x7b)) /* a-z */
{
GenericListKeyPress(&ListUi, Ir->Event.KeyEvent.uChar.AsciiChar);
}
}
}
return UPGRADE_REPAIR_PAGE;
}
/*
* Displays the InstallIntroPage.
*
@ -1067,8 +1199,17 @@ InstallIntroPage(PINPUT_RECORD Ir)
{
if (RepairUpdateFlag)
{
//return SELECT_PARTITION_PAGE;
#if 1 /* Old code that looks good */
// return SELECT_PARTITION_PAGE;
return DEVICE_SETTINGS_PAGE;
#else /* Possible new code? */
return DEVICE_SETTINGS_PAGE;
// return SCSI_CONTROLLER_PAGE;
#endif
}
if (IsUnattendedSetup)
@ -1090,8 +1231,7 @@ InstallIntroPage(PINPUT_RECORD Ir)
}
else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
{
return DEVICE_SETTINGS_PAGE;
// return SCSI_CONTROLLER_PAGE;
return UPGRADE_REPAIR_PAGE;
}
}
@ -1559,6 +1699,20 @@ SelectPartitionPage(PINPUT_RECORD Ir)
FormatState = Start;
}
if (RepairUpdateFlag)
{
/* Determine the selected installation disk & partition */
if (!SelectPartition(PartitionList,
CurrentInstallation->DiskNumber,
CurrentInstallation->PartitionNumber))
{
DPRINT1("RepairUpdateFlag == TRUE, SelectPartition() returned FALSE, assert!\n");
ASSERT(FALSE);
}
return SELECT_FILE_SYSTEM_PAGE;
}
MUIDisplayPage(SELECT_PARTITION_PAGE);
InitPartitionListUi(&ListUi, PartitionList,
@ -3259,7 +3413,7 @@ BuildInstallPaths(PWSTR InstallDir,
* Displays the InstallDirectoryPage.
*
* Next pages:
* PrepareCopyPage (As the direct result of InstallDirectoryPage1)
* PrepareCopyPage
* QuitPage
*
* RETURNS
@ -3292,7 +3446,6 @@ InstallDirectoryPage(PINPUT_RECORD Ir)
DiskEntry = PartitionList->CurrentDisk;
PartEntry = PartitionList->CurrentPartition;
#if 0
if (RepairUpdateFlag)
{
if (!IsValidPath(CurrentInstallation->PathComponent)) // SystemNtPath
@ -3307,7 +3460,6 @@ InstallDirectoryPage(PINPUT_RECORD Ir)
return PREPARE_COPY_PAGE;
}
#endif
if (IsUnattendedSetup)
{
if (!IsValidPath(UnattendInstallationDirectory))
@ -4831,6 +4983,13 @@ QuitPage(PINPUT_RECORD Ir)
{
MUIDisplayPage(QUIT_PAGE);
/* Destroy the NTOS installations list */
if (NtOsInstallsList != NULL)
{
DestroyGenericList(NtOsInstallsList, TRUE);
NtOsInstallsList = NULL;
}
/* Destroy the partition list */
if (PartitionList != NULL)
{
@ -5130,6 +5289,10 @@ RunUSetup(VOID)
Page = RepairIntroPage(&Ir);
break;
case UPGRADE_REPAIR_PAGE:
Page = UpgradeRepairPage(&Ir);
break;
case SUCCESS_PAGE:
Page = SuccessPage(&Ir);
break;