8e12103e2875a1e85e4d2fbef87db8be1f91ea08
[reactos.git] / base / setup / usetup / inicache.h
1 /*
2 * ReactOS kernel
3 * Copyright (C) 2002 ReactOS Team
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19 /*
20 * COPYRIGHT: See COPYING in the top level directory
21 * PROJECT: ReactOS text-mode setup
22 * FILE: base/setup/usetup/inicache.h
23 * PURPOSE: INI file parser that caches contents of INI file in memory
24 * PROGRAMMER: Royce Mitchell III
25 * Eric Kohl
26 */
27
28 #pragma once
29
30 typedef struct _INICACHEKEY
31 {
32 PWCHAR Name;
33 PWCHAR Data;
34
35 struct _INICACHEKEY *Next;
36 struct _INICACHEKEY *Prev;
37 } INICACHEKEY, *PINICACHEKEY;
38
39
40 typedef struct _INICACHESECTION
41 {
42 PWCHAR Name;
43
44 PINICACHEKEY FirstKey;
45 PINICACHEKEY LastKey;
46
47 struct _INICACHESECTION *Next;
48 struct _INICACHESECTION *Prev;
49 } INICACHESECTION, *PINICACHESECTION;
50
51
52 typedef struct _INICACHE
53 {
54 PINICACHESECTION FirstSection;
55 PINICACHESECTION LastSection;
56 } INICACHE, *PINICACHE;
57
58
59 typedef struct _PINICACHEITERATOR
60 {
61 PINICACHESECTION Section;
62 PINICACHEKEY Key;
63 } INICACHEITERATOR, *PINICACHEITERATOR;
64
65
66 typedef enum
67 {
68 INSERT_FIRST,
69 INSERT_BEFORE,
70 INSERT_AFTER,
71 INSERT_LAST
72 } INSERTION_TYPE;
73
74 /* FUNCTIONS ****************************************************************/
75
76 NTSTATUS
77 IniCacheLoadFromMemory(
78 PINICACHE *Cache,
79 PCHAR FileBuffer,
80 ULONG FileLength,
81 BOOLEAN String);
82
83 NTSTATUS
84 IniCacheLoad(
85 PINICACHE *Cache,
86 PWCHAR FileName,
87 BOOLEAN String);
88
89 VOID
90 IniCacheDestroy(
91 PINICACHE Cache);
92
93 PINICACHESECTION
94 IniCacheGetSection(
95 PINICACHE Cache,
96 PWCHAR Name);
97
98 NTSTATUS
99 IniCacheGetKey(
100 PINICACHESECTION Section,
101 PWCHAR KeyName,
102 PWCHAR *KeyData);
103
104 PINICACHEITERATOR
105 IniCacheFindFirstValue(
106 PINICACHESECTION Section,
107 PWCHAR *KeyName,
108 PWCHAR *KeyData);
109
110 BOOLEAN
111 IniCacheFindNextValue(
112 PINICACHEITERATOR Iterator,
113 PWCHAR *KeyName,
114 PWCHAR *KeyData);
115
116 VOID
117 IniCacheFindClose(
118 PINICACHEITERATOR Iterator);
119
120
121 PINICACHEKEY
122 IniCacheInsertKey(
123 PINICACHESECTION Section,
124 PINICACHEKEY AnchorKey,
125 INSERTION_TYPE InsertionType,
126 PWCHAR Name,
127 PWCHAR Data);
128
129 PINICACHE
130 IniCacheCreate(VOID);
131
132 NTSTATUS
133 IniCacheSave(
134 PINICACHE Cache,
135 PWCHAR FileName);
136
137 PINICACHESECTION
138 IniCacheAppendSection(
139 PINICACHE Cache,
140 PWCHAR Name);
141
142 /* EOF */