** wip ** Investigate the Repair/Upgrade page transitions

This commit is contained in:
Hermès Bélusca-Maïto 2024-11-08 21:46:00 +01:00
parent 9649bda0fe
commit a5c05d0e8b
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
2 changed files with 41 additions and 25 deletions

View file

@ -508,36 +508,21 @@ TypeDlgProc(
/////////////////////////
/*
* Go update only if we have available NT installations
* and we choose to do so.
* Repair or upgrade only if we have available
* NT installations and we choose to do so.
*/
if (pSetupData->NtOsInstallsList &&
GetNumberOfListEntries(pSetupData->NtOsInstallsList) != 0 &&
IsDlgButtonChecked(hwndDlg, IDC_UPDATE) == BST_CHECKED)
{
pSetupData->RepairUpdateFlag = TRUE;
/*
* Display the existing NT installations page only
* if we have more than one available NT installations.
*/
if (GetNumberOfListEntries(pSetupData->NtOsInstallsList) > 1)
{
/* pSetupData->CurrentInstallation will be set from within IDD_UPDATEREPAIRPAGE */
/* Display the existing NT installations page */
/* Actually the best would be to dynamically insert the page only when needed */
SetWindowLongPtrW(hwndDlg, DWLP_MSGRESULT, IDD_UPDATEREPAIRPAGE);
}
else
{
/* Retrieve the current installation */
pSetupData->CurrentInstallation =
(PNTOS_INSTALLATION)GetListEntryData(GetCurrentListEntry(pSetupData->NtOsInstallsList));
SetWindowLongPtrW(hwndDlg, DWLP_MSGRESULT, IDD_DEVICEPAGE);
}
}
else
{
pSetupData->CurrentInstallation = NULL;
pSetupData->RepairUpdateFlag = FALSE;
@ -942,8 +927,8 @@ UpgradeRepairDlgProc(
case PSN_WIZNEXT: /* Set the selected data */
{
/*
* Go update only if we have available NT installations
* and we choose to do so.
* Repair or upgrade only if we have available
* NT installations and we choose to do so.
*/
if (!pSetupData->NtOsInstallsList ||
GetNumberOfListEntries(pSetupData->NtOsInstallsList) == 0)
@ -963,6 +948,23 @@ UpgradeRepairDlgProc(
/* We perform an upgrade */
pSetupData->RepairUpdateFlag = TRUE;
/* Determine the selected installation disk & partition */
InstallPartition = SelectPartition(pSetupData->PartitionList,
pSetupData->CurrentInstallation->DiskNumber,
pSetupData->CurrentInstallation->PartitionNumber);
if (!InstallPartition)
{
DPRINT1("RepairUpdateFlag == TRUE, SelectPartition() returned FALSE, assert!\n");
ASSERT(FALSE);
}
// TODO: IsValidInstallDirectory() ??
StringCchCopyW(pSetupData->USetupData.InstallationDirectory,
_countof(pSetupData->USetupData.InstallationDirectory),
pSetupData->CurrentInstallation->PathComponent);
SetWindowLongPtrW(hwndDlg, DWLP_MSGRESULT, IDD_SUMMARYPAGE);
return TRUE;
}
@ -1633,6 +1635,18 @@ PCWSTR ProcArchs[] =
return TRUE;
}
case PSN_WIZBACK:
{
/* Go back to the correct page */
if (pSetupData->RepairUpdateFlag)
{
SetWindowLongPtrW(hwndDlg, DWLP_MSGRESULT, IDD_UPDATEREPAIRPAGE);
return TRUE;
}
/* Otherwise, do the default action */
__fallthrough;
}
default:
break;
}
@ -2252,6 +2266,8 @@ PrepareAndDoCopyThread(
COPYCONTEXT CopyContext;
WCHAR PathBuffer[RTL_NUMBER_OF_FIELD(PARTENTRY, DeviceName) + 1];
__debugbreak();
/* Retrieve pointer to the global setup data */
pSetupData = (PSETUPDATA)GetWindowLongPtrW(hwndDlg, GWLP_USERDATA);

View file

@ -970,8 +970,8 @@ UpgradeRepairPage(PINPUT_RECORD Ir)
DPRINT1("Failed to get a list of NTOS installations; continue installation...\n");
/*
* If there is no available installation (or just a single one??) that can
* be updated in the list, just continue with the regular installation.
* If there is no available installation that can be updated
* in the list, just continue with the regular installation.
*/
if (!NtOsInstallsList || GetNumberOfListEntries(NtOsInstallsList) == 0)
{