xref: /reactos/boot/freeldr/freeldr/ntldr/inffile.h (revision 84344399)
1 /*
2  * PROJECT:     FreeLoader
3  * LICENSE:     GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4  * PURPOSE:     INF file parser that caches contents of INF file in memory.
5  * COPYRIGHT:   Copyright 2002-2006 Royce Mitchell III
6  *              Copyright 2003-2019 Eric Kohl
7  */
8 
9 #pragma once
10 
11 #define STATUS_BAD_SECTION_NAME_LINE   (0xC0700001)
12 #define STATUS_SECTION_NAME_TOO_LONG   (0xC0700002)
13 #define STATUS_WRONG_INF_STYLE         (0xC0700003)
14 #define STATUS_NOT_ENOUGH_MEMORY       (0xC0700004)
15 
16 #define MAX_INF_STRING_LENGTH  512
17 
18 typedef PULONG HINF, *PHINF;
19 
20 typedef struct _INFCONTEXT
21 {
22   PVOID Inf;
23   PVOID CurrentInf;
24   PVOID Section;
25   PVOID Line;
26 } INFCONTEXT, *PINFCONTEXT;
27 
28 
29 /* FUNCTIONS ****************************************************************/
30 
31 BOOLEAN
32 InfOpenFile (PHINF InfHandle,
33          PCSTR FileName,
34          PULONG ErrorLine);
35 
36 VOID
37 InfCloseFile (HINF InfHandle);
38 
39 
40 BOOLEAN
41 InfFindFirstLine (HINF InfHandle,
42           PCSTR Section,
43           PCSTR Key,
44           PINFCONTEXT Context);
45 
46 BOOLEAN
47 InfFindNextLine (PINFCONTEXT ContextIn,
48          PINFCONTEXT ContextOut);
49 
50 BOOLEAN
51 InfFindFirstMatchLine (PINFCONTEXT ContextIn,
52                PCSTR Key,
53                PINFCONTEXT ContextOut);
54 
55 BOOLEAN
56 InfFindNextMatchLine (PINFCONTEXT ContextIn,
57               PCSTR Key,
58               PINFCONTEXT ContextOut);
59 
60 
61 LONG
62 InfGetLineCount (HINF InfHandle,
63          PCSTR Section);
64 
65 LONG
66 InfGetFieldCount (PINFCONTEXT Context);
67 
68 
69 BOOLEAN
70 InfGetBinaryField (PINFCONTEXT Context,
71            ULONG FieldIndex,
72            PUCHAR ReturnBuffer,
73            ULONG ReturnBufferSize,
74            PULONG RequiredSize);
75 
76 BOOLEAN
77 InfGetIntField (PINFCONTEXT Context,
78         ULONG FieldIndex,
79         LONG *IntegerValue);
80 
81 BOOLEAN
82 InfGetMultiSzField (PINFCONTEXT Context,
83             ULONG FieldIndex,
84             PCHAR ReturnBuffer,
85             ULONG ReturnBufferSize,
86             PULONG RequiredSize);
87 
88 BOOLEAN
89 InfGetStringField (PINFCONTEXT Context,
90            ULONG FieldIndex,
91            PCHAR ReturnBuffer,
92            ULONG ReturnBufferSize,
93            PULONG RequiredSize);
94 
95 
96 
97 BOOLEAN
98 InfGetData (PINFCONTEXT Context,
99         PCSTR *Key,
100         PCSTR *Data);
101 
102 BOOLEAN
103 InfGetDataField (PINFCONTEXT Context,
104          ULONG FieldIndex,
105          PCSTR *Data);
106 
107 /* EOF */
108