[SETUPLIB][USETUP] Remove the deprecated GenericListHasSingleEntry() function and...
[reactos.git] / base / setup / usetup / genlist.c
index 1ff2275..c43f89c 100644 (file)
  *  with this program; if not, write to the Free Software Foundation, Inc.,
  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
  *  with this program; if not, write to the Free Software Foundation, Inc.,
  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
-/* COPYRIGHT:       See COPYING in the top level directory
+/*
+ * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS text-mode setup
  * FILE:            base/setup/usetup/genlist.c
  * PURPOSE:         Generic list functions
  * PROJECT:         ReactOS text-mode setup
  * FILE:            base/setup/usetup/genlist.c
  * PURPOSE:         Generic list functions
- * PROGRAMMER:      Eric Kohl
- *                  Christoph von Wittich <christoph at reactos.org>
+ * PROGRAMMER:      Christoph von Wittich <christoph at reactos.org>
  */
 
 /* INCLUDES *****************************************************************/
  */
 
 /* INCLUDES *****************************************************************/
 
 /* FUNCTIONS ****************************************************************/
 
 
 /* FUNCTIONS ****************************************************************/
 
-typedef struct _GENERIC_LIST_ENTRY
-{
-    LIST_ENTRY Entry;
-    PGENERIC_LIST List;
-    PVOID UserData;
-    CHAR Text[1];       // FIXME: UI stuff
-} GENERIC_LIST_ENTRY;
-
-
-typedef struct _GENERIC_LIST
-{
-    LIST_ENTRY ListHead;
-    ULONG NumOfEntries;
-
-    PGENERIC_LIST_ENTRY CurrentEntry;
-    PGENERIC_LIST_ENTRY BackupEntry;
-} GENERIC_LIST;
-
-
-PGENERIC_LIST
-CreateGenericList(VOID)
-{
-    PGENERIC_LIST List;
-
-    List = (PGENERIC_LIST)RtlAllocateHeap(ProcessHeap,
-                                          0,
-                                          sizeof(GENERIC_LIST));
-    if (List == NULL)
-        return NULL;
-
-    InitializeListHead(&List->ListHead);
-    List->NumOfEntries = 0;
-
-    List->CurrentEntry = NULL;
-    List->BackupEntry = NULL;
-
-    return List;
-}
-
-VOID
-DestroyGenericList(
-    IN OUT PGENERIC_LIST List,
-    IN BOOLEAN FreeUserData)
-{
-    PGENERIC_LIST_ENTRY ListEntry;
-    PLIST_ENTRY Entry;
-
-    /* Release list entries */
-    while (!IsListEmpty (&List->ListHead))
-    {
-        Entry = RemoveHeadList (&List->ListHead);
-        ListEntry = CONTAINING_RECORD (Entry, GENERIC_LIST_ENTRY, Entry);
-
-        /* Release user data */
-        if (FreeUserData && ListEntry->UserData != NULL)
-            RtlFreeHeap (ProcessHeap, 0, ListEntry->UserData);
-
-        /* Release list entry */
-        RtlFreeHeap (ProcessHeap, 0, ListEntry);
-    }
-
-    /* Release list head */
-    RtlFreeHeap (ProcessHeap, 0, List);
-}
-
-BOOLEAN
-AppendGenericListEntry(
-    IN OUT PGENERIC_LIST List,
-    IN PCHAR Text,
-    IN PVOID UserData,
-    IN BOOLEAN Current)
-{
-    PGENERIC_LIST_ENTRY Entry;
-
-    Entry = (PGENERIC_LIST_ENTRY)RtlAllocateHeap(ProcessHeap,
-                                                 0,
-                                                 sizeof(GENERIC_LIST_ENTRY) + strlen(Text));
-    if (Entry == NULL)
-        return FALSE;
-
-    strcpy (Entry->Text, Text);
-    Entry->List = List;
-    Entry->UserData = UserData;
-
-    InsertTailList(&List->ListHead,
-                   &Entry->Entry);
-    List->NumOfEntries++;
-
-    if (Current || List->CurrentEntry == NULL)
-    {
-        List->CurrentEntry = Entry;
-    }
-
-    return TRUE;
-}
-
-
 VOID
 InitGenericListUi(
     IN OUT PGENERIC_LIST_UI ListUi,
 VOID
 InitGenericListUi(
     IN OUT PGENERIC_LIST_UI ListUi,
-    IN PGENERIC_LIST List)
+    IN PGENERIC_LIST List,
+    IN PGET_ENTRY_DESCRIPTION GetEntryDescriptionProc)
 {
     ListUi->List = List;
     ListUi->FirstShown = NULL;
     ListUi->LastShown = NULL;
 {
     ListUi->List = List;
     ListUi->FirstShown = NULL;
     ListUi->LastShown = NULL;
+    ListUi->BackupEntry = NULL;
+
+    ListUi->GetEntryDescriptionProc = GetEntryDescriptionProc;
 
     ListUi->Left = 0;
     ListUi->Top = 0;
     ListUi->Right = 0;
     ListUi->Bottom = 0;
     ListUi->Redraw = TRUE;
 
     ListUi->Left = 0;
     ListUi->Top = 0;
     ListUi->Right = 0;
     ListUi->Bottom = 0;
     ListUi->Redraw = TRUE;
+
+    ListUi->CurrentItemText[0] = ANSI_NULL;
+
+    /* SaveGenericListUiState(ListUi); */
+    ListUi->BackupEntry = ListUi->List->CurrentEntry;
+}
+
+VOID
+RestoreGenericListUiState(
+    IN PGENERIC_LIST_UI ListUi)
+{
+    ListUi->List->CurrentEntry = ListUi->BackupEntry;
 }
 
 static
 }
 
 static
@@ -158,78 +77,77 @@ DrawListFrame(
     /* Draw upper left corner */
     coPos.X = ListUi->Left;
     coPos.Y = ListUi->Top;
     /* Draw upper left corner */
     coPos.X = ListUi->Left;
     coPos.Y = ListUi->Top;
-    FillConsoleOutputCharacterA (StdOutput,
-                                 0xDA, // '+',
-                                 1,
-                                 coPos,
-                                 &Written);
+    FillConsoleOutputCharacterA(StdOutput,
+                                0xDA, // '+',
+                                1,
+                                coPos,
+                                &Written);
 
     /* Draw upper edge */
     coPos.X = ListUi->Left + 1;
     coPos.Y = ListUi->Top;
 
     /* Draw upper edge */
     coPos.X = ListUi->Left + 1;
     coPos.Y = ListUi->Top;
-    FillConsoleOutputCharacterA (StdOutput,
-                                 0xC4, // '-',
-                                 ListUi->Right - ListUi->Left - 1,
-                                 coPos,
-                                 &Written);
+    FillConsoleOutputCharacterA(StdOutput,
+                                0xC4, // '-',
+                                ListUi->Right - ListUi->Left - 1,
+                                coPos,
+                                &Written);
 
     /* Draw upper right corner */
     coPos.X = ListUi->Right;
     coPos.Y = ListUi->Top;
 
     /* Draw upper right corner */
     coPos.X = ListUi->Right;
     coPos.Y = ListUi->Top;
-    FillConsoleOutputCharacterA (StdOutput,
-                                 0xBF, // '+',
-                                 1,
-                                 coPos,
-                                 &Written);
+    FillConsoleOutputCharacterA(StdOutput,
+                                0xBF, // '+',
+                                1,
+                                coPos,
+                                &Written);
 
     /* Draw left and right edge */
     for (i = ListUi->Top + 1; i < ListUi->Bottom; i++)
     {
         coPos.X = ListUi->Left;
         coPos.Y = i;
 
     /* Draw left and right edge */
     for (i = ListUi->Top + 1; i < ListUi->Bottom; i++)
     {
         coPos.X = ListUi->Left;
         coPos.Y = i;
-        FillConsoleOutputCharacterA (StdOutput,
-                                     0xB3, // '|',
-                                     1,
-                                     coPos,
-                                     &Written);
+        FillConsoleOutputCharacterA(StdOutput,
+                                    0xB3, // '|',
+                                    1,
+                                    coPos,
+                                    &Written);
 
         coPos.X = ListUi->Right;
 
         coPos.X = ListUi->Right;
-        FillConsoleOutputCharacterA (StdOutput,
-                                     0xB3, //'|',
-                                     1,
-                                     coPos,
-                                     &Written);
+        FillConsoleOutputCharacterA(StdOutput,
+                                    0xB3, //'|',
+                                    1,
+                                    coPos,
+                                    &Written);
     }
 
     /* Draw lower left corner */
     coPos.X = ListUi->Left;
     coPos.Y = ListUi->Bottom;
     }
 
     /* Draw lower left corner */
     coPos.X = ListUi->Left;
     coPos.Y = ListUi->Bottom;
-    FillConsoleOutputCharacterA (StdOutput,
-                                 0xC0, // '+',
-                                 1,
-                                 coPos,
-                                 &Written);
+    FillConsoleOutputCharacterA(StdOutput,
+                                0xC0, // '+',
+                                1,
+                                coPos,
+                                &Written);
 
     /* Draw lower edge */
     coPos.X = ListUi->Left + 1;
     coPos.Y = ListUi->Bottom;
 
     /* Draw lower edge */
     coPos.X = ListUi->Left + 1;
     coPos.Y = ListUi->Bottom;
-    FillConsoleOutputCharacterA (StdOutput,
-                                 0xC4, // '-',
-                                 ListUi->Right - ListUi->Left - 1,
-                                 coPos,
-                                 &Written);
+    FillConsoleOutputCharacterA(StdOutput,
+                                0xC4, // '-',
+                                ListUi->Right - ListUi->Left - 1,
+                                coPos,
+                                &Written);
 
     /* Draw lower right corner */
     coPos.X = ListUi->Right;
     coPos.Y = ListUi->Bottom;
 
     /* Draw lower right corner */
     coPos.X = ListUi->Right;
     coPos.Y = ListUi->Bottom;
-    FillConsoleOutputCharacterA (StdOutput,
-                                 0xD9, // '+',
-                                 1,
-                                 coPos,
-                                 &Written);
+    FillConsoleOutputCharacterA(StdOutput,
+                                0xD9, // '+',
+                                1,
+                                coPos,
+                                &Written);
 }
 
 }
 
-
 static
 VOID
 DrawListEntries(
 static
 VOID
 DrawListEntries(
@@ -249,32 +167,40 @@ DrawListEntries(
     Entry = ListUi->FirstShown;
     while (Entry != &List->ListHead)
     {
     Entry = ListUi->FirstShown;
     while (Entry != &List->ListHead)
     {
-        ListEntry = CONTAINING_RECORD (Entry, GENERIC_LIST_ENTRY, Entry);
+        ListEntry = CONTAINING_RECORD(Entry, GENERIC_LIST_ENTRY, Entry);
 
         if (coPos.Y == ListUi->Bottom)
             break;
         ListUi->LastShown = Entry;
 
 
         if (coPos.Y == ListUi->Bottom)
             break;
         ListUi->LastShown = Entry;
 
-        FillConsoleOutputAttribute (StdOutput,
-                                    (List->CurrentEntry == ListEntry) ?
-                                    FOREGROUND_BLUE | BACKGROUND_WHITE :
-                                    FOREGROUND_WHITE | BACKGROUND_BLUE,
+        ListUi->CurrentItemText[0] = ANSI_NULL;
+        if (ListUi->GetEntryDescriptionProc)
+        {
+            ListUi->GetEntryDescriptionProc(ListEntry,
+                                            ListUi->CurrentItemText,
+                                            ARRAYSIZE(ListUi->CurrentItemText));
+        }
+
+        FillConsoleOutputAttribute(StdOutput,
+                                   (List->CurrentEntry == ListEntry) ?
+                                   FOREGROUND_BLUE | BACKGROUND_WHITE :
+                                   FOREGROUND_WHITE | BACKGROUND_BLUE,
+                                   Width,
+                                   coPos,
+                                   &Written);
+
+        FillConsoleOutputCharacterA(StdOutput,
+                                    ' ',
                                     Width,
                                     coPos,
                                     &Written);
 
                                     Width,
                                     coPos,
                                     &Written);
 
-        FillConsoleOutputCharacterA (StdOutput,
-                                     ' ',
-                                     Width,
+        coPos.X++;
+        WriteConsoleOutputCharacterA(StdOutput,
+                                     ListUi->CurrentItemText,
+                                     min(strlen(ListUi->CurrentItemText), (SIZE_T)Width - 2),
                                      coPos,
                                      &Written);
                                      coPos,
                                      &Written);
-
-        coPos.X++;
-        WriteConsoleOutputCharacterA (StdOutput,
-                                      ListEntry->Text,
-                                      min (strlen(ListEntry->Text), (SIZE_T)Width - 2),
-                                      coPos,
-                                      &Written);
         coPos.X--;
 
         coPos.Y++;
         coPos.X--;
 
         coPos.Y++;
@@ -283,22 +209,21 @@ DrawListEntries(
 
     while (coPos.Y < ListUi->Bottom)
     {
 
     while (coPos.Y < ListUi->Bottom)
     {
-        FillConsoleOutputAttribute (StdOutput,
-                                    FOREGROUND_WHITE | BACKGROUND_BLUE,
+        FillConsoleOutputAttribute(StdOutput,
+                                   FOREGROUND_WHITE | BACKGROUND_BLUE,
+                                   Width,
+                                   coPos,
+                                   &Written);
+
+        FillConsoleOutputCharacterA(StdOutput,
+                                    ' ',
                                     Width,
                                     coPos,
                                     &Written);
                                     Width,
                                     coPos,
                                     &Written);
-
-        FillConsoleOutputCharacterA (StdOutput,
-                                     ' ',
-                                     Width,
-                                     coPos,
-                                     &Written);
         coPos.Y++;
     }
 }
 
         coPos.Y++;
     }
 }
 
-
 static
 VOID
 DrawScrollBarGenericList(
 static
 VOID
 DrawScrollBarGenericList(
@@ -313,41 +238,40 @@ DrawScrollBarGenericList(
 
     if (ListUi->FirstShown != List->ListHead.Flink)
     {
 
     if (ListUi->FirstShown != List->ListHead.Flink)
     {
-        FillConsoleOutputCharacterA (StdOutput,
-                                     '\x18',
-                                     1,
-                                     coPos,
-                                     &Written);
+        FillConsoleOutputCharacterA(StdOutput,
+                                    '\x18',
+                                    1,
+                                    coPos,
+                                    &Written);
     }
     else
     {
     }
     else
     {
-        FillConsoleOutputCharacterA (StdOutput,
-                                     ' ',
-                                     1,
-                                     coPos,
-                                     &Written);
+        FillConsoleOutputCharacterA(StdOutput,
+                                    ' ',
+                                    1,
+                                    coPos,
+                                    &Written);
     }
 
     coPos.Y = ListUi->Bottom;
     if (ListUi->LastShown != List->ListHead.Blink)
     {
     }
 
     coPos.Y = ListUi->Bottom;
     if (ListUi->LastShown != List->ListHead.Blink)
     {
-        FillConsoleOutputCharacterA (StdOutput,
-                                     '\x19',
-                                     1,
-                                     coPos,
-                                     &Written);
+        FillConsoleOutputCharacterA(StdOutput,
+                                    '\x19',
+                                    1,
+                                    coPos,
+                                    &Written);
     }
     else
     {
     }
     else
     {
-        FillConsoleOutputCharacterA (StdOutput,
-                                     ' ',
-                                     1,
-                                     coPos,
-                                     &Written);
+        FillConsoleOutputCharacterA(StdOutput,
+                                    ' ',
+                                    1,
+                                    coPos,
+                                    &Written);
     }
 }
 
     }
 }
 
-
 static
 VOID
 CenterCurrentListItem(
 static
 VOID
 CenterCurrentListItem(
@@ -398,7 +322,6 @@ CenterCurrentListItem(
     }
 }
 
     }
 }
 
-
 VOID
 DrawGenericList(
     IN PGENERIC_LIST_UI ListUi,
 VOID
 DrawGenericList(
     IN PGENERIC_LIST_UI ListUi,
@@ -426,6 +349,84 @@ DrawGenericList(
     DrawScrollBarGenericList(ListUi);
 }
 
     DrawScrollBarGenericList(ListUi);
 }
 
+VOID
+DrawGenericListCurrentItem(
+    IN PGENERIC_LIST List,
+    IN PGET_ENTRY_DESCRIPTION GetEntryDescriptionProc,
+    IN SHORT Left,
+    IN SHORT Top)
+{
+    CHAR CurrentItemText[256];
+
+    if (GetEntryDescriptionProc &&
+        GetNumberOfListEntries(List) > 0)
+    {
+        GetEntryDescriptionProc(GetCurrentListEntry(List),
+                                CurrentItemText,
+                                ARRAYSIZE(CurrentItemText));
+        CONSOLE_SetTextXY(Left, Top, CurrentItemText);
+    }
+    else
+    {
+        CONSOLE_SetTextXY(Left, Top, "");
+    }
+}
+
+VOID
+ScrollDownGenericList(
+    IN PGENERIC_LIST_UI ListUi)
+{
+    PGENERIC_LIST List = ListUi->List;
+    PLIST_ENTRY Entry;
+
+    if (List->CurrentEntry == NULL)
+        return;
+
+    if (List->CurrentEntry->Entry.Flink != &List->ListHead)
+    {
+        Entry = List->CurrentEntry->Entry.Flink;
+        if (ListUi->LastShown == &List->CurrentEntry->Entry)
+        {
+            ListUi->FirstShown = ListUi->FirstShown->Flink;
+            ListUi->LastShown = ListUi->LastShown->Flink;
+        }
+        List->CurrentEntry = CONTAINING_RECORD(Entry, GENERIC_LIST_ENTRY, Entry);
+
+        if (ListUi->Redraw)
+        {
+            DrawListEntries(ListUi);
+            DrawScrollBarGenericList(ListUi);
+        }
+    }
+}
+
+VOID
+ScrollUpGenericList(
+    IN PGENERIC_LIST_UI ListUi)
+{
+    PGENERIC_LIST List = ListUi->List;
+    PLIST_ENTRY Entry;
+
+    if (List->CurrentEntry == NULL)
+        return;
+
+    if (List->CurrentEntry->Entry.Blink != &List->ListHead)
+    {
+        Entry = List->CurrentEntry->Entry.Blink;
+        if (ListUi->FirstShown == &List->CurrentEntry->Entry)
+        {
+            ListUi->FirstShown = ListUi->FirstShown->Blink;
+            ListUi->LastShown = ListUi->LastShown->Blink;
+        }
+        List->CurrentEntry = CONTAINING_RECORD(Entry, GENERIC_LIST_ENTRY, Entry);
+
+        if (ListUi->Redraw)
+        {
+            DrawListEntries(ListUi);
+            DrawScrollBarGenericList(ListUi);
+        }
+    }
+}
 
 VOID
 ScrollPageDownGenericList(
 
 VOID
 ScrollPageDownGenericList(
@@ -449,7 +450,6 @@ ScrollPageDownGenericList(
     ListUi->Redraw = TRUE;
 }
 
     ListUi->Redraw = TRUE;
 }
 
-
 VOID
 ScrollPageUpGenericList(
     IN PGENERIC_LIST_UI ListUi)
 VOID
 ScrollPageUpGenericList(
     IN PGENERIC_LIST_UI ListUi)
@@ -461,7 +461,7 @@ ScrollPageUpGenericList(
 
     for (i = ListUi->Bottom - 1; i > ListUi->Top + 1; i--)
     {
 
     for (i = ListUi->Bottom - 1; i > ListUi->Top + 1; i--)
     {
-         ScrollUpGenericList(ListUi);
+        ScrollUpGenericList(ListUi);
     }
 
     /* Update user interface */
     }
 
     /* Update user interface */
@@ -472,36 +472,6 @@ ScrollPageUpGenericList(
     ListUi->Redraw = TRUE;
 }
 
     ListUi->Redraw = TRUE;
 }
 
-
-VOID
-ScrollDownGenericList(
-    IN PGENERIC_LIST_UI ListUi)
-{
-    PGENERIC_LIST List = ListUi->List;
-    PLIST_ENTRY Entry;
-
-    if (List->CurrentEntry == NULL)
-        return;
-
-    if (List->CurrentEntry->Entry.Flink != &List->ListHead)
-    {
-        Entry = List->CurrentEntry->Entry.Flink;
-        if (ListUi->LastShown == &List->CurrentEntry->Entry)
-        {
-            ListUi->FirstShown = ListUi->FirstShown->Flink;
-            ListUi->LastShown = ListUi->LastShown->Flink;
-        }
-        List->CurrentEntry = CONTAINING_RECORD(Entry, GENERIC_LIST_ENTRY, Entry);
-
-        if (ListUi->Redraw)
-        {
-            DrawListEntries(ListUi);
-            DrawScrollBarGenericList(ListUi);
-        }
-    }
-}
-
-
 VOID
 ScrollToPositionGenericList(
     IN PGENERIC_LIST_UI ListUi,
 VOID
 ScrollToPositionGenericList(
     IN PGENERIC_LIST_UI ListUi,
@@ -537,36 +507,6 @@ ScrollToPositionGenericList(
     }
 }
 
     }
 }
 
-
-VOID
-ScrollUpGenericList(
-    IN PGENERIC_LIST_UI ListUi)
-{
-    PGENERIC_LIST List = ListUi->List;
-    PLIST_ENTRY Entry;
-
-    if (List->CurrentEntry == NULL)
-        return;
-
-    if (List->CurrentEntry->Entry.Blink != &List->ListHead)
-    {
-        Entry = List->CurrentEntry->Entry.Blink;
-        if (ListUi->FirstShown == &List->CurrentEntry->Entry)
-        {
-            ListUi->FirstShown = ListUi->FirstShown->Blink;
-            ListUi->LastShown = ListUi->LastShown->Blink;
-        }
-        List->CurrentEntry = CONTAINING_RECORD(Entry, GENERIC_LIST_ENTRY, Entry);
-
-        if (ListUi->Redraw)
-        {
-            DrawListEntries(ListUi);
-            DrawScrollBarGenericList(ListUi);
-        }
-    }
-}
-
-
 VOID
 RedrawGenericList(
     IN PGENERIC_LIST_UI ListUi)
 VOID
 RedrawGenericList(
     IN PGENERIC_LIST_UI ListUi)
@@ -581,76 +521,6 @@ RedrawGenericList(
     }
 }
 
     }
 }
 
-
-
-VOID
-SetCurrentListEntry(
-    IN PGENERIC_LIST List,
-    IN PGENERIC_LIST_ENTRY Entry)
-{
-    if (Entry->List != List)
-        return;
-    List->CurrentEntry = Entry;
-}
-
-
-PGENERIC_LIST_ENTRY
-GetCurrentListEntry(
-    IN PGENERIC_LIST List)
-{
-    return List->CurrentEntry;
-}
-
-
-PGENERIC_LIST_ENTRY
-GetFirstListEntry(
-    IN PGENERIC_LIST List)
-{
-    PLIST_ENTRY Entry = List->ListHead.Flink;
-
-    if (Entry == &List->ListHead)
-        return NULL;
-    return CONTAINING_RECORD(Entry, GENERIC_LIST_ENTRY, Entry);
-}
-
-
-PGENERIC_LIST_ENTRY
-GetNextListEntry(
-    IN PGENERIC_LIST_ENTRY Entry)
-{
-    PLIST_ENTRY Next = Entry->Entry.Flink;
-
-    if (Next == &Entry->List->ListHead)
-        return NULL;
-    return CONTAINING_RECORD(Next, GENERIC_LIST_ENTRY, Entry);
-}
-
-
-PVOID
-GetListEntryUserData(
-    IN PGENERIC_LIST_ENTRY Entry)
-{
-    return Entry->UserData;
-}
-
-
-LPCSTR
-GetListEntryText(
-    IN PGENERIC_LIST_ENTRY Entry)
-{
-    return Entry->Text;
-}
-
-
-ULONG
-GetNumberOfListEntries(
-    IN PGENERIC_LIST List)
-{
-    return List->NumOfEntries;
-}
-
-
-
 VOID
 GenericListKeyPress(
     IN PGENERIC_LIST_UI ListUi,
 VOID
 GenericListKeyPress(
     IN PGENERIC_LIST_UI ListUi,
@@ -666,13 +536,29 @@ GenericListKeyPress(
 
     ListUi->Redraw = FALSE;
 
 
     ListUi->Redraw = FALSE;
 
-    if ((strlen(ListEntry->Text) > 0) && (tolower(ListEntry->Text[0]) == AsciiChar) &&
+    ListUi->CurrentItemText[0] = ANSI_NULL;
+    if (ListUi->GetEntryDescriptionProc)
+    {
+        ListUi->GetEntryDescriptionProc(ListEntry,
+                                        ListUi->CurrentItemText,
+                                        ARRAYSIZE(ListUi->CurrentItemText));
+    }
+
+    if ((strlen(ListUi->CurrentItemText) > 0) && (tolower(ListUi->CurrentItemText[0]) == AsciiChar) &&
          (List->CurrentEntry->Entry.Flink != &List->ListHead))
     {
         ScrollDownGenericList(ListUi);
         ListEntry = List->CurrentEntry;
 
          (List->CurrentEntry->Entry.Flink != &List->ListHead))
     {
         ScrollDownGenericList(ListUi);
         ListEntry = List->CurrentEntry;
 
-        if ((strlen(ListEntry->Text) > 0) && (tolower(ListEntry->Text[0]) == AsciiChar))
+        ListUi->CurrentItemText[0] = ANSI_NULL;
+        if (ListUi->GetEntryDescriptionProc)
+        {
+            ListUi->GetEntryDescriptionProc(ListEntry,
+                                            ListUi->CurrentItemText,
+                                            ARRAYSIZE(ListUi->CurrentItemText));
+        }
+
+        if ((strlen(ListUi->CurrentItemText) > 0) && (tolower(ListUi->CurrentItemText[0]) == AsciiChar))
             goto End;
     }
 
             goto End;
     }
 
@@ -683,7 +569,15 @@ GenericListKeyPress(
 
     for (;;)
     {
 
     for (;;)
     {
-        if ((strlen(ListEntry->Text) > 0) && (tolower(ListEntry->Text[0]) == AsciiChar))
+        ListUi->CurrentItemText[0] = ANSI_NULL;
+        if (ListUi->GetEntryDescriptionProc)
+        {
+            ListUi->GetEntryDescriptionProc(ListEntry,
+                                            ListUi->CurrentItemText,
+                                            ARRAYSIZE(ListUi->CurrentItemText));
+        }
+
+        if ((strlen(ListUi->CurrentItemText) > 0) && (tolower(ListUi->CurrentItemText[0]) == AsciiChar))
         {
             Flag = TRUE;
             break;
         {
             Flag = TRUE;
             break;
@@ -714,33 +608,4 @@ End:
     ListUi->Redraw = TRUE;
 }
 
     ListUi->Redraw = TRUE;
 }
 
-
-VOID
-SaveGenericListState(
-    IN PGENERIC_LIST List)
-{
-    List->BackupEntry = List->CurrentEntry;
-}
-
-
-VOID
-RestoreGenericListState(
-    IN PGENERIC_LIST List)
-{
-    List->CurrentEntry = List->BackupEntry;
-}
-
-
-BOOLEAN
-GenericListHasSingleEntry(
-    IN PGENERIC_LIST List)
-{
-    if (!IsListEmpty(&List->ListHead) && List->ListHead.Flink == List->ListHead.Blink)
-        return TRUE;
-
-    /* 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's just a single thing in there, otherwise... false! */
-    return FALSE;
-}
-
 /* EOF */
 /* EOF */