diff --git a/base/setup/lib/settings.c b/base/setup/lib/settings.c index f0a5200fe91..93de42a31df 100644 --- a/base/setup/lib/settings.c +++ b/base/setup/lib/settings.c @@ -761,10 +761,7 @@ ProcessComputerFiles( Entry = GetCurrentListEntry(List); if (Entry == NULL) - { - DPRINT("GetCurrentListEntry() failed\n"); return FALSE; - } RtlStringCchPrintfW(SectionName, ARRAYSIZE(SectionName), L"Files.%s", ((PGENENTRY)GetListEntryData(Entry))->Id); @@ -794,10 +791,7 @@ ProcessDisplayRegistry( Entry = GetCurrentListEntry(List); if (Entry == NULL) - { - DPRINT1("GetCurrentListEntry() failed\n"); return FALSE; - } if (!SetupFindFirstLineW(InfFile, L"Display", ((PGENENTRY)GetListEntryData(Entry))->Id, diff --git a/base/setup/lib/utils/genlist.c b/base/setup/lib/utils/genlist.c index a322914cd8f..79a4895075c 100644 --- a/base/setup/lib/utils/genlist.c +++ b/base/setup/lib/utils/genlist.c @@ -88,7 +88,7 @@ SetCurrentListEntry( IN PGENERIC_LIST List, IN PGENERIC_LIST_ENTRY Entry) { - if (Entry->List != List) + if (!Entry || (Entry->List != List)) return; List->CurrentEntry = Entry; } @@ -143,16 +143,4 @@ GetNumberOfListEntries( return List->NumOfEntries; } -BOOLEAN -GenericListHasSingleEntry( - IN PGENERIC_LIST List) -{ - /* - * If both list head pointers (which normally point to the first and last - * list member, respectively) point to the same entry then it means that - * there is just a single thing in there, otherwise... false! - */ - return (!IsListEmpty(&List->ListHead) && (List->ListHead.Flink == List->ListHead.Blink)); -} - /* EOF */ diff --git a/base/setup/lib/utils/genlist.h b/base/setup/lib/utils/genlist.h index 5d145a4c464..ea3c7473bf5 100644 --- a/base/setup/lib/utils/genlist.h +++ b/base/setup/lib/utils/genlist.h @@ -66,8 +66,4 @@ ULONG GetNumberOfListEntries( IN PGENERIC_LIST List); -BOOLEAN -GenericListHasSingleEntry( - IN PGENERIC_LIST List); - /* EOF */ diff --git a/base/setup/usetup/genlist.c b/base/setup/usetup/genlist.c index 8e8baffacda..c43f89ccd9b 100644 --- a/base/setup/usetup/genlist.c +++ b/base/setup/usetup/genlist.c @@ -356,17 +356,20 @@ DrawGenericListCurrentItem( IN SHORT Left, IN SHORT Top) { - // - // FIXME: That stuff crashes when the list is empty!! - // CHAR CurrentItemText[256]; - if (GetEntryDescriptionProc) + + if (GetEntryDescriptionProc && + GetNumberOfListEntries(List) > 0) { GetEntryDescriptionProc(GetCurrentListEntry(List), CurrentItemText, ARRAYSIZE(CurrentItemText)); CONSOLE_SetTextXY(Left, Top, CurrentItemText); } + else + { + CONSOLE_SetTextXY(Left, Top, ""); + } } VOID diff --git a/base/setup/usetup/usetup.c b/base/setup/usetup/usetup.c index f78f6525aa7..46cb2445657 100644 --- a/base/setup/usetup/usetup.c +++ b/base/setup/usetup/usetup.c @@ -508,9 +508,11 @@ LanguagePage(PINPUT_RECORD Ir) SetConsoleCodePage(); UpdateKBLayout(); - /* If there's just a single language in the list skip - * the language selection process altogether! */ - if (GenericListHasSingleEntry(LanguageList)) + /* + * If there is no language or just a single one in the list, + * skip the language selection process altogether. + */ + if (GetNumberOfListEntries(LanguageList) <= 1) { USetupData.LanguageId = (LANGID)(wcstol(SelectedLanguageId, NULL, 16) & 0xFFFF); return WELCOME_PAGE; @@ -564,9 +566,8 @@ LanguagePage(PINPUT_RECORD Ir) } else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */ { - // - // FIXME: That stuff crashes when the list is empty!! - // + ASSERT(GetNumberOfListEntries(LanguageList) >= 1); + SelectedLanguageId = ((PGENENTRY)GetListEntryData(GetCurrentListEntry(LanguageList)))->Id; @@ -591,9 +592,8 @@ LanguagePage(PINPUT_RECORD Ir) if (RefreshPage) { - // - // FIXME: That stuff crashes when the list is empty!! - // + ASSERT(GetNumberOfListEntries(LanguageList) >= 1); + NewLanguageId = ((PGENENTRY)GetListEntryData(GetCurrentListEntry(LanguageList)))->Id; @@ -897,6 +897,11 @@ UpgradeRepairPage(PINPUT_RECORD Ir) NtOsInstallsList = CreateNTOSInstallationsList(PartitionList); if (!NtOsInstallsList) 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 (!NtOsInstallsList || GetNumberOfListEntries(NtOsInstallsList) == 0) { RepairUpdateFlag = FALSE; @@ -961,9 +966,8 @@ UpgradeRepairPage(PINPUT_RECORD Ir) if (toupper(Ir->Event.KeyEvent.uChar.AsciiChar) == 'U') /* U */ { /* Retrieve the current installation */ - // - // FIXME: That stuff crashes when the list is empty!! - // + ASSERT(GetNumberOfListEntries(NtOsInstallsList) >= 1); + CurrentInstallation = (PNTOS_INSTALLATION)GetListEntryData(GetCurrentListEntry(NtOsInstallsList));