ReactOS  0.4.14-dev-52-g6116262
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 }
Definition: genlist.h:10
#define TRUE
Definition: types.h:120
struct _Entry Entry
Definition: kefuncs.h:640
#define InsertTailList(ListHead, Entry)
Entry(ENTRY_TYPE etype)
Definition: entries.cpp:35
smooth NULL
Definition: ftsmooth.c:416
_In_ LPGUID _In_ PVOID Data
Definition: classpnp.h:778
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:588
LIST_ENTRY List
Definition: psmgr.c:57
HANDLE ProcessHeap
Definition: servman.c:15
base of all file and directory entries
Definition: entries.h:82

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 }
smooth NULL
Definition: ftsmooth.c:416
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:588
LIST_ENTRY List
Definition: psmgr.c:57
HANDLE ProcessHeap
Definition: servman.c:15
#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 }
Definition: genlist.h:10
struct _Entry Entry
Definition: kefuncs.h:640
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
PVOID Data
Definition: genlist.h:14
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
smooth NULL
Definition: ftsmooth.c:416
FORCEINLINE PLIST_ENTRY RemoveHeadList(_Inout_ PLIST_ENTRY ListHead)
Definition: rtlfuncs.h:128
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
LIST_ENTRY List
Definition: psmgr.c:57
Definition: typedefs.h:117
HANDLE ProcessHeap
Definition: servman.c:15
base of all file and directory entries
Definition: entries.h:82

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

◆ GetCurrentListEntry()

◆ 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 
111 }
Definition: genlist.h:10
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
smooth NULL
Definition: ftsmooth.c:416
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
LIST_ENTRY List
Definition: psmgr.c:57
base of all file and directory entries
Definition: entries.h:82

Referenced by CreateLanguageList(), FindExistingNTOSInstall(), 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 }
base of all file and directory entries
Definition: entries.h:82

◆ 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 }
Definition: genlist.h:10
Entry(ENTRY_TYPE etype)
Definition: entries.cpp:35
smooth NULL
Definition: ftsmooth.c:416
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
Definition: typedefs.h:117
base of all file and directory entries
Definition: entries.h:82

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

◆ GetNumberOfListEntries()

ULONG GetNumberOfListEntries ( IN PGENERIC_LIST  List)

Definition at line 140 of file genlist.c.

142 {
143  return List->NumOfEntries;
144 }
LIST_ENTRY List
Definition: psmgr.c:57

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 }
struct _Entry Entry
Definition: kefuncs.h:640
LIST_ENTRY List
Definition: psmgr.c:57
base of all file and directory entries
Definition: entries.h:82

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