xref: /reactos/base/setup/lib/utils/genlist.h (revision cdf90707)
1 /*
2  * PROJECT:     ReactOS Setup Library
3  * LICENSE:     GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4  * PURPOSE:     Generic list functions
5  * COPYRIGHT:   Copyright 2008-2018 Christoph von Wittich <christoph at reactos.org>
6  */
7 
8 #pragma once
9 
10 typedef struct _GENERIC_LIST_ENTRY
11 {
12     LIST_ENTRY Entry;
13     struct _GENERIC_LIST* List;
14     PVOID Data;
15     ULONG_PTR UiData;   // Cache variable for any UI list that displays these items
16 } GENERIC_LIST_ENTRY, *PGENERIC_LIST_ENTRY;
17 
18 typedef struct _GENERIC_LIST
19 {
20     LIST_ENTRY ListHead;
21     ULONG NumOfEntries;
22     PGENERIC_LIST_ENTRY CurrentEntry;
23 } GENERIC_LIST, *PGENERIC_LIST;
24 
25 
26 PGENERIC_LIST
27 CreateGenericList(VOID);
28 
29 VOID
30 DestroyGenericList(
31     IN OUT PGENERIC_LIST List,
32     IN BOOLEAN FreeData);
33 
34 BOOLEAN
35 AppendGenericListEntry(
36     IN OUT PGENERIC_LIST List,
37     IN PVOID Data,
38     IN BOOLEAN Current);
39 
40 VOID
41 SetCurrentListEntry(
42     IN PGENERIC_LIST List,
43     IN PGENERIC_LIST_ENTRY Entry);
44 
45 PGENERIC_LIST_ENTRY
46 GetCurrentListEntry(
47     IN PGENERIC_LIST List);
48 
49 PGENERIC_LIST_ENTRY
50 GetFirstListEntry(
51     IN PGENERIC_LIST List);
52 
53 PGENERIC_LIST_ENTRY
54 GetNextListEntry(
55     IN PGENERIC_LIST_ENTRY Entry);
56 
57 PVOID
58 GetListEntryData(
59     IN PGENERIC_LIST_ENTRY Entry);
60 
61 ULONG_PTR
62 GetListEntryUiData(
63     IN PGENERIC_LIST_ENTRY Entry);
64 
65 ULONG
66 GetNumberOfListEntries(
67     IN PGENERIC_LIST List);
68 
69 /* EOF */
70