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;
while(CdLookupNextInitialFileDirent(IrpContext, Fcb, FileContext))
const CHAR *(* parser_state_func)(struct parser *parser, const CHAR *pos)
BOOLEAN InfFindNextMatchLine(PINFCONTEXT ContextIn, PCSTR Key, PINFCONTEXT ContextOut)
struct _INFCACHEFIELD * Prev
struct _INFCACHESECTION * PINFCACHESECTION
ACPI_SIZE strlen(const char *String)
struct _INFCACHELINE * PINFCACHELINE
#define STATUS_BAD_SECTION_NAME_LINE
struct _INFCACHEFIELD * Next
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
static PINFCACHELINE InfpCacheFreeLine(PINFCACHELINE Line)
static PINFCACHELINE InfpCacheAddLine(PINFCACHESECTION Section)
IN PVOID IN PVOID IN USHORT IN USHORT Size
_In_ DWORD _In_ DWORD ReturnBufferSize
static __inline enum parser_state set_state(struct parser *parser, enum parser_state state)
static const CHAR * trailing_spaces_state(struct parser *parser, const CHAR *pos)
static PINFCACHESECTION InfpCacheFindSection(PINFCACHE Cache, PCSTR Name)
_In_ WDFREQUEST _In_ NTSTATUS _In_ ULONG_PTR Information
struct _INFCACHEFIELD * PINFCACHEFIELD
PINFCACHESECTION LastSection
static const CHAR * key_name_state(struct parser *parser, const CHAR *pos)
VOID InfCloseFile(HINF InfHandle)
struct _INFCACHESECTION * Next
BOOLEAN InfGetIntField(PINFCONTEXT Context, ULONG FieldIndex, PLONG IntegerValue)
static const CHAR * leading_spaces_state(struct parser *parser, const CHAR *pos)
LONG InfGetLineCount(HINF InfHandle, PCSTR Section)
PINFCACHEFIELD FirstField
#define STATUS_WRONG_INF_STYLE
struct _INFCACHELINE * Prev
BOOLEAN InfGetMultiSzField(PINFCONTEXT Context, ULONG FieldIndex, PCHAR ReturnBuffer, ULONG ReturnBufferSize, PULONG RequiredSize)
static VOID close_current_line(struct parser *parser)
FORCEINLINE PVOID FrLdrTempAlloc(_In_ SIZE_T Size, _In_ ULONG Tag)
static const CHAR * value_name_state(struct parser *parser, const CHAR *pos)
struct _INFCACHEFIELD INFCACHEFIELD
static const CHAR * comment_state(struct parser *parser, const CHAR *pos)
BOOLEAN InfGetStringField(PINFCONTEXT Context, ULONG FieldIndex, PCHAR ReturnBuffer, ULONG ReturnBufferSize, PULONG RequiredSize)
static const CHAR * section_name_state(struct parser *parser, const CHAR *pos)
struct _INFCACHESECTION * Prev
struct _INFCACHESECTION INFCACHESECTION
BOOLEAN InfFindNextLine(PINFCONTEXT ContextIn, PINFCONTEXT ContextOut)
_In_ WDFCOLLECTION _In_ ULONG Index
struct _INFCACHE * PINFCACHE
static struct field * add_field_from_token(struct parser *parser, int is_key)
#define MAX_SECTION_NAME_LEN
struct _INFCACHELINE INFCACHELINE
static __inline void push_state(struct parser *parser, enum parser_state state)
enum parser_state stack[4]
ARC_STATUS ArcRead(ULONG FileId, VOID *Buffer, ULONG N, ULONG *Count)
static __inline int is_eol(struct parser *parser, const CHAR *ptr)
_Must_inspect_result_ _Out_ PLARGE_INTEGER FileSize
PINFCACHESECTION cur_section
BOOLEAN InfGetData(PINFCONTEXT Context, PCSTR *Key, PCSTR *Data)
static int push_token(struct parser *parser, const CHAR *pos)
struct _INFCACHE INFCACHE
CHAR token[MAX_FIELD_LEN+1]
static __inline int is_eof(struct parser *parser, const CHAR *ptr)
static __inline void pop_state(struct parser *parser)
static PVOID InfpAddKeyToLine(PINFCACHELINE Line, PCSTR Key)
PINFCACHESECTION FirstSection
ARC_STATUS ArcClose(ULONG FileId)
PINFCACHESECTION StringsSection
struct _INFCACHELINE * Next
_Check_return_ int __cdecl atoi(_In_z_ const char *_Str)
ARC_STATUS ArcGetFileInformation(ULONG FileId, FILEINFORMATION *Information)
static PINFCACHESECTION InfpCacheAddSection(PINFCACHE Cache, PCSTR Name)
char * strcpy(char *DstString, const char *SrcString)
ARC_STATUS ArcOpen(CHAR *Path, OPENMODE OpenMode, ULONG *FileId)
BOOLEAN InfFindFirstLine(HINF InfHandle, PCSTR Section, PCSTR Key, PINFCONTEXT Context)
static const parser_state_func parser_funcs[NB_PARSER_STATES]
#define RtlZeroMemory(Destination, Length)
static const CHAR * quotes_state(struct parser *parser, const CHAR *pos)
static PVOID InfpAddFieldToLine(PINFCACHELINE Line, PCSTR Data)
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ ULONG _Out_ PVOID _Out_ PULONG RequiredSize
BOOLEAN InfFindFirstMatchLine(PINFCONTEXT ContextIn, PCSTR Key, PINFCONTEXT ContextOut)
static const CHAR * line_start_state(struct parser *parser, const CHAR *pos)
static PINFCACHELINE InfpCacheFindKeyLine(PINFCACHESECTION Section, PCSTR Key)
BOOLEAN InfGetBinaryField(PINFCONTEXT Context, ULONG FieldIndex, PUCHAR ReturnBuffer, ULONG ReturnBufferSize, PULONG RequiredSize)
static const CHAR * eol_backslash_state(struct parser *parser, const CHAR *pos)
LONG InfGetFieldCount(PINFCONTEXT Context)
BOOLEAN InfGetDataField(PINFCONTEXT Context, ULONG FieldIndex, PCSTR *Data)
static BOOLEAN InfpParseBuffer(PINFCACHE file, PCCHAR buffer, PCCHAR end, PULONG error_line)
BOOLEAN InfOpenFile(PHINF InfHandle, PCSTR FileName, PULONG ErrorLine)
static PINFCACHESECTION InfpCacheFreeSection(PINFCACHESECTION Section)
static PVOID add_section_from_token(struct parser *parser)
FORCEINLINE VOID FrLdrTempFree(PVOID Allocation, ULONG Tag)