[SETUPLIB][USETUP] Don't store UI-related display strings in GENERIC_LIST_ENTRY-ies, + other code adaptations.

- Apart from allowing a UI cache variable that may be used when
  displaying GENERIC_LIST_ENTRY-ies, do not store any display strings
  associated to these list entries. They should be instead computed only
  when initializing a list UI (or a combo-box or list control if the
  code is used in Win32 environment).
  For this matter a callback is provided to InitGenericListUi() that
  does the job of computing the displayed string corresponding to a
  given GENERIC_LIST_ENTRY.

- Simplify the calls to InitGenericListUi(), and refactor the
  RestoreGenericListUiState() function.

- Use for-loops for iterating over GENERIC_LIST items.

- Adapt the storage data format for lists of settings items.

- The txtsetup.sif INF format specified in LoadSetupInf() should not be
  INF_STYLE_WIN4 (to be investigated...).
This commit is contained in:
Hermès Bélusca-Maïto 2017-12-29 19:09:56 +01:00
parent 765994c9e3
commit 1f4cb0977a
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
10 changed files with 264 additions and 170 deletions

View file

@ -11,19 +11,15 @@ typedef struct _GENERIC_LIST_ENTRY
{
LIST_ENTRY Entry;
struct _GENERIC_LIST* List;
PVOID UserData;
WCHAR Text[1]; // FIXME: UI stuff
PVOID Data;
ULONG_PTR UiData; // Cache variable for any UI list that displays these items
} GENERIC_LIST_ENTRY, *PGENERIC_LIST_ENTRY;
typedef struct _GENERIC_LIST
{
LIST_ENTRY ListHead;
ULONG NumOfEntries;
PGENERIC_LIST_ENTRY CurrentEntry;
PGENERIC_LIST_ENTRY BackupEntry;
} GENERIC_LIST, *PGENERIC_LIST;
@ -33,13 +29,12 @@ CreateGenericList(VOID);
VOID
DestroyGenericList(
IN OUT PGENERIC_LIST List,
IN BOOLEAN FreeUserData);
IN BOOLEAN FreeData);
BOOLEAN
AppendGenericListEntry(
IN OUT PGENERIC_LIST List,
IN PCWSTR Text,
IN PVOID UserData,
IN PVOID Data,
IN BOOLEAN Current);
VOID
@ -60,25 +55,17 @@ GetNextListEntry(
IN PGENERIC_LIST_ENTRY Entry);
PVOID
GetListEntryUserData(
GetListEntryData(
IN PGENERIC_LIST_ENTRY Entry);
PCWSTR
GetListEntryText(
ULONG_PTR
GetListEntryUiData(
IN PGENERIC_LIST_ENTRY Entry);
ULONG
GetNumberOfListEntries(
IN PGENERIC_LIST List);
VOID
SaveGenericListState(
IN PGENERIC_LIST List);
VOID
RestoreGenericListState(
IN PGENERIC_LIST List);
BOOLEAN
GenericListHasSingleEntry(
IN PGENERIC_LIST List);