ReactOS 0.4.15-dev-7918-g2a2556c
genlist.c File Reference
#include "precomp.h"
#include "genlist.h"
#include <debug.h>
Include dependency graph for genlist.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

PGENERIC_LIST CreateGenericList (VOID)
 
VOID DestroyGenericList (IN OUT PGENERIC_LIST List, IN BOOLEAN FreeData)
 
BOOLEAN AppendGenericListEntry (IN OUT PGENERIC_LIST List, IN PVOID Data, IN BOOLEAN Current)
 
VOID SetCurrentListEntry (IN PGENERIC_LIST List, IN PGENERIC_LIST_ENTRY Entry)
 
PGENERIC_LIST_ENTRY GetCurrentListEntry (IN PGENERIC_LIST List)
 
PGENERIC_LIST_ENTRY GetFirstListEntry (IN PGENERIC_LIST List)
 
PGENERIC_LIST_ENTRY GetNextListEntry (IN PGENERIC_LIST_ENTRY Entry)
 
PVOID GetListEntryData (IN PGENERIC_LIST_ENTRY Entry)
 
ULONG_PTR GetListEntryUiData (IN PGENERIC_LIST_ENTRY Entry)
 
ULONG GetNumberOfListEntries (IN PGENERIC_LIST List)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 14 of file genlist.c.

Function Documentation

◆ AppendGenericListEntry()

BOOLEAN AppendGenericListEntry ( IN OUT PGENERIC_LIST  List,
IN PVOID  Data,
IN BOOLEAN  Current 
)

Definition at line 62 of file genlist.c.

66{
68
70 if (Entry == NULL)
71 return FALSE;
72
73 Entry->List = List;
74 Entry->Data = Data;
75 Entry->UiData = 0;
76
77 InsertTailList(&List->ListHead, &Entry->Entry);
78 ++List->NumOfEntries;
79
80 if (Current || List->CurrentEntry == NULL)
81 List->CurrentEntry = Entry;
82
83 return TRUE;
84}
HANDLE ProcessHeap
Definition: servman.c:15
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:590
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define InsertTailList(ListHead, Entry)
base of all file and directory entries
Definition: entries.h:83
Entry(ENTRY_TYPE etype)
Definition: entries.cpp:35
Definition: genlist.h:11
_Must_inspect_result_ _In_ WDFCMRESLIST List
Definition: wdfresource.h:550

Referenced by AddEntriesFromInfSection(), AddNTOSInstallation(), and CreateDisplayDriverList().

◆ CreateGenericList()

PGENERIC_LIST CreateGenericList ( VOID  )

Definition at line 20 of file genlist.c.

21{
23
25 if (List == NULL)
26 return NULL;
27
28 InitializeListHead(&List->ListHead);
29 List->NumOfEntries = 0;
30 List->CurrentEntry = NULL;
31
32 return List;
33}
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944

Referenced by CreateComputerTypeList(), CreateDisplayDriverList(), CreateKeyboardDriverList(), CreateKeyboardLayoutList(), CreateLanguageList(), and CreateNTOSInstallationsList().

◆ DestroyGenericList()

VOID DestroyGenericList ( IN OUT PGENERIC_LIST  List,
IN BOOLEAN  FreeData 
)

Definition at line 36 of file genlist.c.

39{
40 PGENERIC_LIST_ENTRY ListEntry;
42
43 /* Release list entries */
44 while (!IsListEmpty(&List->ListHead))
45 {
46 Entry = RemoveHeadList(&List->ListHead);
48
49 /* Release user data */
50 if (FreeData && ListEntry->Data != NULL)
51 RtlFreeHeap(ProcessHeap, 0, ListEntry->Data);
52
53 /* Release list entry */
54 RtlFreeHeap(ProcessHeap, 0, ListEntry);
55 }
56
57 /* Release list head */
59}
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:608
#define IsListEmpty(ListHead)
Definition: env_spec_w32.h:954
#define RemoveHeadList(ListHead)
Definition: env_spec_w32.h:964
PVOID Data
Definition: genlist.h:14
Definition: typedefs.h:120
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by CreateComputerTypeList(), CreateDisplayDriverList(), CreateKeyboardDriverList(), CreateKeyboardLayoutList(), CreateLanguageList(), FinishSetup(), and QuitPage().

◆ GetCurrentListEntry()

PGENERIC_LIST_ENTRY GetCurrentListEntry ( IN PGENERIC_LIST  List)

◆ GetFirstListEntry()

PGENERIC_LIST_ENTRY GetFirstListEntry ( IN PGENERIC_LIST  List)

Definition at line 104 of file genlist.c.

106{
107 if (IsListEmpty(&List->ListHead))
108 return NULL;
109
110 return CONTAINING_RECORD(List->ListHead.Flink, GENERIC_LIST_ENTRY, Entry);
111}

Referenced by CreateLanguageList(), FindExistingNTOSInstall(), LoadSetupData(), SetupStartPage(), and UpdateKBLayout().

◆ GetListEntryData()

◆ GetListEntryUiData()

ULONG_PTR GetListEntryUiData ( IN PGENERIC_LIST_ENTRY  Entry)

Definition at line 133 of file genlist.c.

135{
136 return Entry->UiData;
137}

◆ GetNextListEntry()

PGENERIC_LIST_ENTRY GetNextListEntry ( IN PGENERIC_LIST_ENTRY  Entry)

Definition at line 114 of file genlist.c.

116{
117 PLIST_ENTRY Next = Entry->Entry.Flink;
118
119 if (Next == &Entry->List->ListHead)
120 return NULL;
121
123}

Referenced by FindExistingNTOSInstall(), LoadSetupData(), SetupStartPage(), and UpdateKBLayout().

◆ GetNumberOfListEntries()

ULONG GetNumberOfListEntries ( IN PGENERIC_LIST  List)

Definition at line 140 of file genlist.c.

142{
143 return List->NumOfEntries;
144}

Referenced by CreateKeyboardLayoutList(), DrawGenericListCurrentItem(), LanguagePage(), TypeDlgProc(), UpgradeRepairDlgProc(), and UpgradeRepairPage().

◆ SetCurrentListEntry()

VOID SetCurrentListEntry ( IN PGENERIC_LIST  List,
IN PGENERIC_LIST_ENTRY  Entry 
)

Definition at line 87 of file genlist.c.

90{
91 if (!Entry || (Entry->List != List))
92 return;
93 List->CurrentEntry = Entry;
94}

Referenced by DeviceDlgProc(), LoadSetupData(), SetupStartPage(), UpdateKBLayout(), and UpgradeRepairDlgProc().