-
Notifications
You must be signed in to change notification settings - Fork 29
/
list.h
130 lines (95 loc) · 3.01 KB
/
list.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
/*
Copyright (C) 2011 Jay Satiro <[email protected]>
All rights reserved.
This file is part of GetHooks.
GetHooks is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
GetHooks is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GetHooks. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef _LIST_H
#define _LIST_H
#include <windows.h>
#ifdef __cplusplus
extern "C" {
#endif
/** This is the info needed for each item in a generic list.
What members are valid depends on the type of list.
GetHooks config currently uses four lists:
test include list:
name is required. id is required.
desktop include list:
name is required. id is unused.
hook include/exclude list:
name is optional. id is required.
program include/exclude list:
name and id are currently handled elsewhere as mutually exclusive.
if( name ) then the name is used, but if( !name ) then the id is used.
the id may represent either a PID or TID
*/
struct list_item
{
__int64 id;
WCHAR *name; // _wcsdup(), free()
/* The next item in the list */
struct list_item *next;
};
/** The generic list store type.
The different types of lists that can be held by the store.
*/
enum list_type
{
LIST_INVALID_TYPE, // 0 is an invalid type
LIST_INCLUDE_TEST, // list of tests to include
LIST_INCLUDE_DESK, // list of desktops to include
LIST_INCLUDE_HOOK, // list of hooks to include
LIST_INCLUDE_PROG, // list of programs to include
LIST_EXCLUDE_HOOK, // list of hooks to exclude
LIST_EXCLUDE_PROG // list of programs to exclude
};
/** The generic list store.
The list store holds a linked list of some type specified below.
*/
struct list
{
/* list item. this is a pointer to the first item in the list. */
struct list_item *head; // items calloc'd. the list is freed when the store is freed.
/* the last item in the list */
struct list_item *tail;
/* the list type */
enum list_type type;
/* the system utc time in FILETIME format immediately after this store has been initialized.
this is nonzero when this store has been initialized.
*/
__int64 init_time;
};
/**
these functions are documented in the comment block above their definitions in list.c
*/
void create_list_store(
struct list **const out // out deref
);
struct list_item *add_list_item(
struct list *const store, // in
__int64 id, // in, optional
const WCHAR *name // in, optional
);
void print_list_item(
const struct list_item *const item // in
);
void print_list_store(
const struct list *const store // in
);
void free_list_store(
struct list **const in // in deref
);
#ifdef __cplusplus
}
#endif
#endif /* _LIST_H */