/*
- * COPYRIGHT: See COPYING in the top level directory
- * PROJECT: .inf file parser
- * FILE: lib/inflib/infcache.h
- * PURPOSE: INF file parser that caches contents of INF file in memory
- * PROGRAMMER: Royce Mitchell III
- * Eric Kohl
- * Ge van Geldorp <gvg@reactos.org>
+ * PROJECT: .inf file parser
+ * LICENSE: GPL - See COPYING in the top level directory
+ * PROGRAMMER: Royce Mitchell III
+ * Eric Kohl
+ * Ge van Geldorp <gvg@reactos.org>
*/
#ifndef INFPRIV_H_INCLUDED
#define INFPRIV_H_INCLUDED
+#ifndef FIELD_OFFSET
+#define FIELD_OFFSET(t,f) ((ptrdiff_t)&(((t*)0)->f))
+#endif
-#define INF_STATUS_INSUFFICIENT_RESOURCES (0xC000009A)
-#define INF_STATUS_BAD_SECTION_NAME_LINE (0xC0700001)
-#define INF_STATUS_SECTION_NAME_TOO_LONG (0xC0700002)
-#define INF_STATUS_WRONG_INF_STYLE (0xC0700003)
-#define INF_STATUS_NOT_ENOUGH_MEMORY (0xC0700004)
-
-typedef struct _INFCONTEXT
-{
- PVOID Inf;
- PVOID Section;
- PVOID Line;
-} INFCONTEXT;
+#define INF_STATUS_INSUFFICIENT_RESOURCES ((INFSTATUS)0xC000009A)
+#define INF_STATUS_BAD_SECTION_NAME_LINE ((INFSTATUS)0xC0700001)
+#define INF_STATUS_SECTION_NAME_TOO_LONG ((INFSTATUS)0xC0700002)
+#define INF_STATUS_WRONG_INF_STYLE ((INFSTATUS)0xC0700003)
+#define INF_STATUS_NOT_ENOUGH_MEMORY ((INFSTATUS)0xC0700004)
typedef struct _INFCACHEFIELD
{
LONG FieldCount;
- PTCHAR Key;
+ PTSTR Key;
PINFCACHEFIELD FirstField;
PINFCACHEFIELD LastField;
PINFCACHESECTION StringsSection;
} INFCACHE, *PINFCACHE;
-typedef long INFSTATUS;
+typedef struct _INFCONTEXT
+{
+ PINFCACHE Inf;
+ PINFCACHESECTION Section;
+ PINFCACHELINE Line;
+} INFCONTEXT;
+
+typedef int INFSTATUS;
/* FUNCTIONS ****************************************************************/
const CHAR *buffer,
const CHAR *end,
PULONG error_line);
-extern PINFCACHESECTION InfpCacheFreeSection(PINFCACHESECTION Section);
-extern PINFCACHELINE InfpCacheFindKeyLine(PINFCACHESECTION Section,
- PTCHAR Key);
-
-extern INFSTATUS InfpFindFirstLine(HINF InfHandle,
+extern PINFCACHESECTION InfpFreeSection(PINFCACHESECTION Section);
+extern PINFCACHESECTION InfpAddSection(PINFCACHE Cache,
+ PCTSTR Name);
+extern PINFCACHELINE InfpAddLine(PINFCACHESECTION Section);
+extern PVOID InfpAddKeyToLine(PINFCACHELINE Line,
+ PCTSTR Key);
+extern PVOID InfpAddFieldToLine(PINFCACHELINE Line,
+ PCTSTR Data);
+extern PINFCACHELINE InfpFindKeyLine(PINFCACHESECTION Section,
+ PCTSTR Key);
+extern PINFCACHESECTION InfpFindSection(PINFCACHE Cache,
+ PCTSTR Section);
+
+extern INFSTATUS InfpBuildFileBuffer(PINFCACHE InfHandle,
+ PCHAR *Buffer,
+ PULONG BufferSize);
+
+extern INFSTATUS InfpFindFirstLine(PINFCACHE InfHandle,
PCTSTR Section,
PCTSTR Key,
PINFCONTEXT *Context);
extern INFSTATUS InfpGetDataField(PINFCONTEXT Context,
ULONG FieldIndex,
PTCHAR *Data);
+
+extern INFSTATUS InfpFindOrAddSection(PINFCACHE Cache,
+ PCTSTR Section,
+ PINFCONTEXT *Context);
+extern INFSTATUS InfpAddLineWithKey(PINFCONTEXT Context, PCTSTR Key);
+extern INFSTATUS InfpAddField(PINFCONTEXT Context, PCTSTR Data);
+
extern VOID InfpFreeContext(PINFCONTEXT Context);
#endif /* INFPRIV_H_INCLUDED */