update for HEAD-2003091401
[reactos.git] / subsys / system / usetup / infcache.h
1 /*
2  *  ReactOS kernel
3  *  Copyright (C) 2002, 2003 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 /* $Id$
20  * COPYRIGHT:       See COPYING in the top level directory
21  * PROJECT:         ReactOS text-mode setup
22  * FILE:            subsys/system/usetup/infcache.h
23  * PURPOSE:         INF file parser that caches contents of INF file in memory
24  * PROGRAMMER:      Royce Mitchell III
25  *                  Eric Kohl
26  */
27
28 #ifndef __INFCACHE_H__
29 #define __INFCACHE_H__
30
31
32 #define STATUS_BAD_SECTION_NAME_LINE   (0xC0700001)
33 #define STATUS_SECTION_NAME_TOO_LONG   (0xC0700002)
34 #define STATUS_WRONG_INF_STYLE         (0xC0700003)
35 #define STATUS_NOT_ENOUGH_MEMORY       (0xC0700004)
36
37 #define MAX_INF_STRING_LENGTH  512
38
39 typedef PVOID HINF, *PHINF;
40
41 typedef struct _INFCONTEXT
42 {
43   PVOID Inf;
44 //  PVOID CurrentInf;
45   PVOID Section;
46   PVOID Line;
47 } INFCONTEXT, *PINFCONTEXT;
48
49
50 /* FUNCTIONS ****************************************************************/
51
52 NTSTATUS
53 InfOpenBufferedFile(PHINF InfHandle,
54             PVOID Buffer,
55       ULONG BufferSize,
56             PULONG ErrorLine);
57
58 NTSTATUS
59 InfOpenFile (PHINF InfHandle,
60              PUNICODE_STRING FileName,
61              PULONG ErrorLine);
62
63 VOID
64 InfCloseFile (HINF InfHandle);
65
66
67 BOOLEAN
68 InfFindFirstLine (HINF InfHandle,
69                   PCWSTR Section,
70                   PCWSTR Key,
71                   PINFCONTEXT Context);
72
73 BOOLEAN
74 InfFindNextLine (PINFCONTEXT ContextIn,
75                  PINFCONTEXT ContextOut);
76
77 BOOLEAN
78 InfFindFirstMatchLine (PINFCONTEXT ContextIn,
79                        PCWSTR Key,
80                        PINFCONTEXT ContextOut);
81
82 BOOLEAN
83 InfFindNextMatchLine (PINFCONTEXT ContextIn,
84                       PCWSTR Key,
85                       PINFCONTEXT ContextOut);
86
87
88 LONG
89 InfGetLineCount (HINF InfHandle,
90                  PCWSTR Section);
91
92 LONG
93 InfGetFieldCount (PINFCONTEXT Context);
94
95
96 BOOLEAN
97 InfGetBinaryField (PINFCONTEXT Context,
98                    ULONG FieldIndex,
99                    PUCHAR ReturnBuffer,
100                    ULONG ReturnBufferSize,
101                    PULONG RequiredSize);
102
103 BOOLEAN
104 InfGetIntField (PINFCONTEXT Context,
105                 ULONG FieldIndex,
106                 PLONG IntegerValue);
107
108 BOOLEAN
109 InfGetMultiSzField (PINFCONTEXT Context,
110                     ULONG FieldIndex,
111                     PWSTR ReturnBuffer,
112                     ULONG ReturnBufferSize,
113                     PULONG RequiredSize);
114
115 BOOLEAN
116 InfGetStringField (PINFCONTEXT Context,
117                    ULONG FieldIndex,
118                    PWSTR ReturnBuffer,
119                    ULONG ReturnBufferSize,
120                    PULONG RequiredSize);
121
122
123
124 BOOLEAN
125 InfGetData (PINFCONTEXT Context,
126             PWCHAR *Key,
127             PWCHAR *Data);
128
129 BOOLEAN
130 InfGetDataField (PINFCONTEXT Context,
131                  ULONG FieldIndex,
132                  PWCHAR *Data);
133
134 #endif /* __INFCACHE_H__ */
135
136 /* EOF */