14#define CONTROL_Z '\x1a'
15#define MAX_SECTION_NAME_LEN 255
16#define MAX_FIELD_LEN 511
18#define MAX_STRING_LEN (MAX_INF_STRING_LENGTH+1)
20#define TAG_INF_KEY 'KfnI'
21#define TAG_INF_FIELD 'ffnI'
22#define TAG_INF_LINE 'LfnI'
23#define TAG_INF_SECTION 'SfnI'
24#define TAG_INF_CACHE 'CfnI'
25#define TAG_INF_FILE 'FfnI'
156 Field =
Line->FirstField->Next;
158 Line->FirstField = Field;
181 Next = Section->
Next;
208 Section =
Cache->FirstSection;
209 while (Section !=
NULL)
217 Section = Section->
Next;
255 Cache->FirstSection = Section;
256 Cache->LastSection = Section;
260 Cache->LastSection->Next = Section;
262 Cache->LastSection = Section;
351 Line->FirstField = Field;
352 Line->LastField = Field;
356 Line->LastField->Next = Field;
358 Line->LastField = Field;
427 ((*
ptr ==
'\r') && (*(
ptr + 1) ==
'\n')));
483 return (
PVOID)Section;
626 if (*
p ==
',')
break;
656 if (!
isspace((
unsigned char)*
p)) token_end =
p + 1;
712 if (!
isspace((
unsigned char)*
p)) token_end =
p + 1;
932 *ErrorLine = (
ULONG) - 1;
1069 CacheSection =
Cache->FirstSection;
1070 while (CacheSection !=
NULL)
1086 if (CacheLine ==
NULL)
1097 CacheSection = CacheSection->
Next;
1113 if ((ContextIn ==
NULL) || (ContextOut ==
NULL))
1123 if (ContextIn != ContextOut)
1125 ContextOut->
Inf = ContextIn->
Inf;
1149 while (CacheLine !=
NULL)
1154 if (ContextIn != ContextOut)
1156 ContextOut->
Inf = ContextIn->
Inf;
1164 CacheLine = CacheLine->
Next;
1191 if (ContextIn != ContextOut)
1193 ContextOut->
Inf = ContextIn->
Inf;
1201 CacheLine = CacheLine->
Next;
1216 if ((InfHandle ==
NULL) || (Section ==
NULL))
1225 CacheSection =
Cache->FirstSection;
1226 while (CacheSection !=
NULL)
1237 CacheSection = CacheSection->
Next;
1289 CacheField = CacheField->
Next;
1296 if (ReturnBuffer !=
NULL)
1303 while (CacheField !=
NULL)
1308 CacheField = CacheField->
Next;
1349 CacheField = CacheField->
Next;
1391 CacheField = CacheField->
Next;
1394 FieldPtr = CacheField;
1399 FieldPtr = FieldPtr->
Next;
1406 if (ReturnBuffer !=
NULL)
1413 FieldPtr = CacheField;
1414 while (FieldPtr !=
NULL)
1421 FieldPtr = FieldPtr->
Next;
1466 CacheField = CacheField->
Next;
1476 if (ReturnBuffer !=
NULL)
1543 CacheField = CacheField->
Next;
ACPI_SIZE strlen(const char *String)
char * strcpy(char *DstString, const char *SrcString)
ARC_STATUS ArcGetFileInformation(ULONG FileId, FILEINFORMATION *Information)
ARC_STATUS ArcOpen(CHAR *Path, OPENMODE OpenMode, ULONG *FileId)
ARC_STATUS ArcClose(_In_ ULONG FileId)
ARC_STATUS ArcRead(ULONG FileId, VOID *Buffer, ULONG N, ULONG *Count)
FORCEINLINE PVOID FrLdrTempAlloc(_In_ SIZE_T Size, _In_ ULONG Tag)
FORCEINLINE VOID FrLdrTempFree(PVOID Allocation, ULONG Tag)
#define STATUS_WRONG_INF_STYLE
#define STATUS_BAD_SECTION_NAME_LINE
while(CdLookupNextInitialFileDirent(IrpContext, Fcb, FileContext))
_Must_inspect_result_ _Out_ PLARGE_INTEGER FileSize
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
_Check_return_ int __cdecl atoi(_In_z_ const char *_Str)
BOOLEAN InfFindFirstLine(HINF InfHandle, PCSTR Section, PCSTR Key, PINFCONTEXT Context)
static PINFCACHELINE InfpCacheFreeLine(PINFCACHELINE Line)
const CHAR *(* parser_state_func)(struct parser *parser, const CHAR *pos)
static struct field * add_field_from_token(struct parser *parser, int is_key)
static __inline int is_eol(struct parser *parser, const CHAR *ptr)
LONG InfGetLineCount(HINF InfHandle, PCSTR Section)
struct _INFCACHEFIELD * PINFCACHEFIELD
static __inline enum parser_state set_state(struct parser *parser, enum parser_state state)
struct _INFCACHESECTION * PINFCACHESECTION
static int push_token(struct parser *parser, const CHAR *pos)
BOOLEAN InfGetData(PINFCONTEXT Context, PCSTR *Key, PCSTR *Data)
struct _INFCACHELINE INFCACHELINE
static BOOLEAN InfpParseBuffer(PINFCACHE file, PCCHAR buffer, PCCHAR end, PULONG error_line)
struct _INFCACHESECTION INFCACHESECTION
BOOLEAN InfGetIntField(PINFCONTEXT Context, ULONG FieldIndex, PLONG IntegerValue)
static const CHAR * value_name_state(struct parser *parser, const CHAR *pos)
static PVOID InfpAddFieldToLine(PINFCACHELINE Line, PCSTR Data)
static const CHAR * comment_state(struct parser *parser, const CHAR *pos)
static PVOID add_section_from_token(struct parser *parser)
BOOLEAN InfFindNextMatchLine(PINFCONTEXT ContextIn, PCSTR Key, PINFCONTEXT ContextOut)
static PINFCACHESECTION InfpCacheFindSection(PINFCACHE Cache, PCSTR Name)
BOOLEAN InfGetStringField(PINFCONTEXT Context, ULONG FieldIndex, PCHAR ReturnBuffer, ULONG ReturnBufferSize, PULONG RequiredSize)
static PINFCACHELINE InfpCacheAddLine(PINFCACHESECTION Section)
static const CHAR * line_start_state(struct parser *parser, const CHAR *pos)
static const CHAR * key_name_state(struct parser *parser, const CHAR *pos)
static const CHAR * quotes_state(struct parser *parser, const CHAR *pos)
static PINFCACHELINE InfpCacheFindKeyLine(PINFCACHESECTION Section, PCSTR Key)
static __inline void push_state(struct parser *parser, enum parser_state state)
VOID InfCloseFile(HINF InfHandle)
BOOLEAN InfGetMultiSzField(PINFCONTEXT Context, ULONG FieldIndex, PCHAR ReturnBuffer, ULONG ReturnBufferSize, PULONG RequiredSize)
BOOLEAN InfGetDataField(PINFCONTEXT Context, ULONG FieldIndex, PCSTR *Data)
static const CHAR * trailing_spaces_state(struct parser *parser, const CHAR *pos)
static __inline void pop_state(struct parser *parser)
BOOLEAN InfFindNextLine(PINFCONTEXT ContextIn, PINFCONTEXT ContextOut)
BOOLEAN InfFindFirstMatchLine(PINFCONTEXT ContextIn, PCSTR Key, PINFCONTEXT ContextOut)
static PVOID InfpAddKeyToLine(PINFCACHELINE Line, PCSTR Key)
static __inline int is_eof(struct parser *parser, const CHAR *ptr)
BOOLEAN InfGetBinaryField(PINFCONTEXT Context, ULONG FieldIndex, PUCHAR ReturnBuffer, ULONG ReturnBufferSize, PULONG RequiredSize)
static const CHAR * section_name_state(struct parser *parser, const CHAR *pos)
static PINFCACHESECTION InfpCacheAddSection(PINFCACHE Cache, PCSTR Name)
LONG InfGetFieldCount(PINFCONTEXT Context)
struct _INFCACHELINE * PINFCACHELINE
BOOLEAN InfOpenFile(PHINF InfHandle, PCSTR FileName, PULONG ErrorLine)
static PINFCACHESECTION InfpCacheFreeSection(PINFCACHESECTION Section)
#define MAX_SECTION_NAME_LEN
struct _INFCACHE * PINFCACHE
struct _INFCACHEFIELD INFCACHEFIELD
struct _INFCACHE INFCACHE
static VOID close_current_line(struct parser *parser)
static const CHAR * leading_spaces_state(struct parser *parser, const CHAR *pos)
static const parser_state_func parser_funcs[NB_PARSER_STATES]
static const CHAR * eol_backslash_state(struct parser *parser, const CHAR *pos)
_In_ DWORD _In_ DWORD ReturnBufferSize
struct _INFCACHEFIELD * Next
struct _INFCACHEFIELD * Prev
PINFCACHEFIELD FirstField
struct _INFCACHELINE * Prev
struct _INFCACHELINE * Next
struct _INFCACHESECTION * Prev
struct _INFCACHESECTION * Next
PINFCACHESECTION FirstSection
PINFCACHESECTION LastSection
PINFCACHESECTION StringsSection
PINFCACHESECTION cur_section
CHAR token[MAX_FIELD_LEN+1]
enum parser_state stack[4]
#define RtlZeroMemory(Destination, Length)
_In_ WDFCOLLECTION _In_ ULONG Index
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ ULONG _Out_ PVOID _Out_ PULONG RequiredSize
_In_ WDFREQUEST _In_ NTSTATUS _In_ ULONG_PTR Information