update for HEAD-2003050101
[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 InfOpenFile (PHINF InfHandle,
54              PUNICODE_STRING FileName,
55              PULONG ErrorLine);
56
57 VOID
58 InfCloseFile (HINF InfHandle);
59
60
61 BOOLEAN
62 InfFindFirstLine (HINF InfHandle,
63                   PCWSTR Section,
64                   PCWSTR Key,
65                   PINFCONTEXT Context);
66
67 BOOLEAN
68 InfFindNextLine (PINFCONTEXT ContextIn,
69                  PINFCONTEXT ContextOut);
70
71 BOOLEAN
72 InfFindFirstMatchLine (PINFCONTEXT ContextIn,
73                        PCWSTR Key,
74                        PINFCONTEXT ContextOut);
75
76 BOOLEAN
77 InfFindNextMatchLine (PINFCONTEXT ContextIn,
78                       PCWSTR Key,
79                       PINFCONTEXT ContextOut);
80
81
82 LONG
83 InfGetLineCount (HINF InfHandle,
84                  PCWSTR Section);
85
86 LONG
87 InfGetFieldCount (PINFCONTEXT Context);
88
89
90 BOOLEAN
91 InfGetBinaryField (PINFCONTEXT Context,
92                    ULONG FieldIndex,
93                    PUCHAR ReturnBuffer,
94                    ULONG ReturnBufferSize,
95                    PULONG RequiredSize);
96
97 BOOLEAN
98 InfGetIntField (PINFCONTEXT Context,
99                 ULONG FieldIndex,
100                 PLONG IntegerValue);
101
102 BOOLEAN
103 InfGetMultiSzField (PINFCONTEXT Context,
104                     ULONG FieldIndex,
105                     PWSTR ReturnBuffer,
106                     ULONG ReturnBufferSize,
107                     PULONG RequiredSize);
108
109 BOOLEAN
110 InfGetStringField (PINFCONTEXT Context,
111                    ULONG FieldIndex,
112                    PWSTR ReturnBuffer,
113                    ULONG ReturnBufferSize,
114                    PULONG RequiredSize);
115
116
117
118 BOOLEAN
119 InfGetData (PINFCONTEXT Context,
120             PWCHAR *Key,
121             PWCHAR *Data);
122
123 BOOLEAN
124 InfGetDataField (PINFCONTEXT Context,
125                  ULONG FieldIndex,
126                  PWCHAR *Data);
127
128 #endif /* __INFCACHE_H__ */
129
130 /* EOF */