ReactOS 0.4.16-dev-334-g4d9f67c
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 NTAPI CreateGenericList (VOID)
 
VOID NTAPI DestroyGenericList (IN OUT PGENERIC_LIST List, IN BOOLEAN FreeData)
 
BOOLEAN NTAPI AppendGenericListEntry (IN OUT PGENERIC_LIST List, IN PVOID Data, IN BOOLEAN Current)
 
VOID NTAPI SetCurrentListEntry (IN PGENERIC_LIST List, IN PGENERIC_LIST_ENTRY Entry)
 
PGENERIC_LIST_ENTRY NTAPI GetCurrentListEntry (IN PGENERIC_LIST List)
 
PGENERIC_LIST_ENTRY NTAPI GetFirstListEntry (IN PGENERIC_LIST List)
 
PGENERIC_LIST_ENTRY NTAPI GetNextListEntry (IN PGENERIC_LIST_ENTRY Entry)
 
PVOID NTAPI GetListEntryData (IN PGENERIC_LIST_ENTRY Entry)
 
ULONG_PTR GetListEntryUiData (IN PGENERIC_LIST_ENTRY Entry)
 
ULONG NTAPI GetNumberOfListEntries (IN PGENERIC_LIST List)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 14 of file genlist.c.

Function Documentation

◆ AppendGenericListEntry()

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

Definition at line 65 of file genlist.c.

69{
71
73 if (Entry == NULL)
74 return FALSE;
75
76 Entry->List = List;
77 Entry->Data = Data;
78 Entry->UiData = 0;
79
80 InsertTailList(&List->ListHead, &Entry->Entry);
81 ++List->NumOfEntries;
82
83 if (Current || List->CurrentEntry == NULL)
84 List->CurrentEntry = Entry;
85
86 return TRUE;
87}
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 NTAPI CreateGenericList ( VOID  )

Definition at line 21 of file genlist.c.

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

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

◆ DestroyGenericList()

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

Definition at line 38 of file genlist.c.

41{
42 PGENERIC_LIST_ENTRY ListEntry;
44
45 /* Release list entries */
46 while (!IsListEmpty(&List->ListHead))
47 {
48 Entry = RemoveHeadList(&List->ListHead);
50
51 /* Release user data */
52 if (FreeData && ListEntry->Data != NULL)
53 RtlFreeHeap(ProcessHeap, 0, ListEntry->Data);
54
55 /* Release list entry */
56 RtlFreeHeap(ProcessHeap, 0, ListEntry);
57 }
58
59 /* Release list head */
61}
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 NTAPI GetCurrentListEntry ( IN PGENERIC_LIST  List)

◆ GetFirstListEntry()

PGENERIC_LIST_ENTRY NTAPI GetFirstListEntry ( IN PGENERIC_LIST  List)

Definition at line 110 of file genlist.c.

112{
113 if (IsListEmpty(&List->ListHead))
114 return NULL;
115
116 return CONTAINING_RECORD(List->ListHead.Flink, GENERIC_LIST_ENTRY, Entry);
117}

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

◆ GetListEntryData()

◆ GetListEntryUiData()

ULONG_PTR GetListEntryUiData ( IN PGENERIC_LIST_ENTRY  Entry)

Definition at line 141 of file genlist.c.

143{
144 return Entry->UiData;
145}

◆ GetNextListEntry()

PGENERIC_LIST_ENTRY NTAPI GetNextListEntry ( IN PGENERIC_LIST_ENTRY  Entry)

Definition at line 121 of file genlist.c.

123{
124 PLIST_ENTRY Next = Entry->Entry.Flink;
125
126 if (Next == &Entry->List->ListHead)
127 return NULL;
128
130}

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

◆ GetNumberOfListEntries()

ULONG NTAPI GetNumberOfListEntries ( IN PGENERIC_LIST  List)

Definition at line 149 of file genlist.c.

151{
152 return List->NumOfEntries;
153}

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

◆ SetCurrentListEntry()

VOID NTAPI SetCurrentListEntry ( IN PGENERIC_LIST  List,
IN PGENERIC_LIST_ENTRY  Entry 
)

Definition at line 91 of file genlist.c.

94{
95 if (!Entry || (Entry->List != List))
96 return;
97 List->CurrentEntry = Entry;
98}

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