update for HEAD-2003091401
[reactos.git] / subsys / system / 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
16  *  along with this program; if not, write to the Free Software
17  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */
19 /*
20  * COPYRIGHT:       See COPYING in the top level directory
21  * PROJECT:         ReactOS text-mode setup
22  * FILE:            subsys/system/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 #ifndef __INICACHE_H__
29 #define __INICACHE_H__
30
31
32 typedef struct _INICACHEKEY
33 {
34   PWCHAR Name;
35   PWCHAR Data;
36
37   struct _INICACHEKEY *Next;
38   struct _INICACHEKEY *Prev;
39 } INICACHEKEY, *PINICACHEKEY;
40
41
42 typedef struct _INICACHESECTION
43 {
44   PWCHAR Name;
45
46   PINICACHEKEY FirstKey;
47   PINICACHEKEY LastKey;
48
49   struct _INICACHESECTION *Next;
50   struct _INICACHESECTION *Prev;
51 } INICACHESECTION, *PINICACHESECTION;
52
53
54 typedef struct _INICACHE
55 {
56   PINICACHESECTION FirstSection;
57   PINICACHESECTION LastSection;
58 } INICACHE, *PINICACHE;
59
60
61 typedef struct _PINICACHEITERATOR
62 {
63   PINICACHESECTION Section;
64   PINICACHEKEY Key;
65 } INICACHEITERATOR, *PINICACHEITERATOR;
66
67
68 typedef enum
69 {
70   INSERT_FIRST,
71   INSERT_BEFORE,
72   INSERT_AFTER,
73   INSERT_LAST
74 } INSERTATION_TYPE;
75
76 /* FUNCTIONS ****************************************************************/
77
78 NTSTATUS
79 IniCacheLoad(PINICACHE *Cache,
80              PUNICODE_STRING FileName,
81              BOOLEAN String);
82
83 VOID
84 IniCacheDestroy(PINICACHE Cache);
85
86 PINICACHESECTION
87 IniCacheGetSection(PINICACHE Cache,
88                    PWCHAR Name);
89
90 NTSTATUS
91 IniCacheGetKey(PINICACHESECTION Section,
92                PWCHAR KeyName,
93                PWCHAR *KeyData);
94
95
96
97 PINICACHEITERATOR
98 IniCacheFindFirstValue(PINICACHESECTION Section,
99                        PWCHAR *KeyName,
100                        PWCHAR *KeyData);
101
102 BOOLEAN
103 IniCacheFindNextValue(PINICACHEITERATOR Iterator,
104                       PWCHAR *KeyName,
105                       PWCHAR *KeyData);
106
107 VOID
108 IniCacheFindClose(PINICACHEITERATOR Iterator);
109
110
111 PINICACHEKEY
112 IniCacheInsertKey(PINICACHESECTION Section,
113                   PINICACHEKEY AnchorKey,
114                   INSERTATION_TYPE InsertationType,
115                   PWCHAR Name,
116                   PWCHAR Data);
117
118 PINICACHE
119 IniCacheCreate(VOID);
120
121 NTSTATUS
122 IniCacheSave(PINICACHE Cache,
123              PWCHAR FileName);
124
125 PINICACHESECTION
126 IniCacheAppendSection(PINICACHE Cache,
127                       PWCHAR Name);
128
129
130 #endif /* __INICACHE_H__ */
131
132 /* EOF */