40403b30b9eccca3c0f37187b37f2bb21e242c27
[reactos.git] / tools / mkhive / infcache.h
1 /*
2  *  ReactOS kernel
3  *  Copyright (C) 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 hive maker
22  * FILE:            tools/mkhive/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 /* INCLUDES *****************************************************************/
29
30 #ifndef __INFCACHE_H__
31 #define __INFCACHE_H__
32
33
34 #define STATUS_BAD_SECTION_NAME_LINE   (0xC0700001)
35 #define STATUS_SECTION_NAME_TOO_LONG   (0xC0700002)
36 #define STATUS_WRONG_INF_STYLE         (0xC0700003)
37 #define STATUS_NOT_ENOUGH_MEMORY       (0xC0700004)
38
39 #define MAX_INF_STRING_LENGTH  512
40
41 typedef PVOID HINF, *PHINF;
42
43 typedef struct _INFCONTEXT
44 {
45   PVOID Inf;
46 //  PVOID CurrentInf;
47   PVOID Section;
48   PVOID Line;
49 } INFCONTEXT, *PINFCONTEXT;
50
51
52 /* FUNCTIONS ****************************************************************/
53
54 BOOL
55 InfOpenFile (PHINF InfHandle,
56              PCHAR FileName,
57              PULONG ErrorLine);
58
59 VOID
60 InfCloseFile (HINF InfHandle);
61
62
63 BOOL
64 InfFindFirstLine (HINF InfHandle,
65                   PCHAR Section,
66                   PCHAR Key,
67                   PINFCONTEXT Context);
68
69 BOOL
70 InfFindNextLine (PINFCONTEXT ContextIn,
71                  PINFCONTEXT ContextOut);
72
73 BOOL
74 InfFindFirstMatchLine (PINFCONTEXT ContextIn,
75                        PCHAR Key,
76                        PINFCONTEXT ContextOut);
77
78 BOOL
79 InfFindNextMatchLine (PINFCONTEXT ContextIn,
80                       PCHAR Key,
81                       PINFCONTEXT ContextOut);
82
83
84 LONG
85 InfGetLineCount (HINF InfHandle,
86                  PCHAR Section);
87
88 LONG
89 InfGetFieldCount (PINFCONTEXT Context);
90
91
92 BOOL
93 InfGetBinaryField (PINFCONTEXT Context,
94                    ULONG FieldIndex,
95                    PUCHAR ReturnBuffer,
96                    ULONG ReturnBufferSize,
97                    PULONG RequiredSize);
98
99 BOOL
100 InfGetIntField (PINFCONTEXT Context,
101                 ULONG FieldIndex,
102                 PLONG IntegerValue);
103
104 BOOL
105 InfGetMultiSzField (PINFCONTEXT Context,
106                     ULONG FieldIndex,
107                     PCHAR ReturnBuffer,
108                     ULONG ReturnBufferSize,
109                     PULONG RequiredSize);
110
111 BOOL
112 InfGetStringField (PINFCONTEXT Context,
113                    ULONG FieldIndex,
114                    PCHAR ReturnBuffer,
115                    ULONG ReturnBufferSize,
116                    PULONG RequiredSize);
117
118
119
120 BOOL
121 InfGetData (PINFCONTEXT Context,
122             PCHAR *Key,
123             PCHAR *Data);
124
125 BOOL
126 InfGetDataField (PINFCONTEXT Context,
127                  ULONG FieldIndex,
128                  PCHAR *Data);
129
130 #endif /* __INFCACHE_H__ */
131
132 /* EOF */