reactos/base/setup/lib/inicache.h
Hermès Bélusca-Maïto 7f5428633b
[SETUPLIB] Additions for filesup.c and inicache.c.
- In DoesFileExist(): Call NtOpenFile with FILE_GENERIC_READ instead of the more generic GENERIC_READ access right.
- OpenAndMapFile(): Add support for opening & mapping files with write access (to be used latter).

svn path=/branches/setup_improvements/; revision=74710

- Split IniCacheLoad() and IniCacheSave() into: themselves & IniCacheLoadByHandle() and IniCacheSaveByHandle(),
  respectively, so that we can load & save INI files if we already have an opened handle to them.

svn path=/branches/setup_improvements/; revision=74711
2018-06-03 22:12:44 +02:00

134 lines
2.2 KiB
C

/*
* PROJECT: ReactOS Setup Library
* LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
* PURPOSE: INI file parser that caches contents of INI file in memory.
* COPYRIGHT: Copyright 2002-2018 Royce Mitchell III
*/
#pragma once
typedef struct _INICACHEKEY
{
PWCHAR Name;
PWCHAR Data;
struct _INICACHEKEY *Next;
struct _INICACHEKEY *Prev;
} INICACHEKEY, *PINICACHEKEY;
typedef struct _INICACHESECTION
{
PWCHAR Name;
PINICACHEKEY FirstKey;
PINICACHEKEY LastKey;
struct _INICACHESECTION *Next;
struct _INICACHESECTION *Prev;
} INICACHESECTION, *PINICACHESECTION;
typedef struct _INICACHE
{
PINICACHESECTION FirstSection;
PINICACHESECTION LastSection;
} INICACHE, *PINICACHE;
typedef struct _PINICACHEITERATOR
{
PINICACHESECTION Section;
PINICACHEKEY Key;
} INICACHEITERATOR, *PINICACHEITERATOR;
typedef enum
{
INSERT_FIRST,
INSERT_BEFORE,
INSERT_AFTER,
INSERT_LAST
} INSERTION_TYPE;
/* FUNCTIONS ****************************************************************/
NTSTATUS
IniCacheLoadFromMemory(
PINICACHE *Cache,
PCHAR FileBuffer,
ULONG FileLength,
BOOLEAN String);
NTSTATUS
IniCacheLoadByHandle(
PINICACHE *Cache,
HANDLE FileHandle,
BOOLEAN String);
NTSTATUS
IniCacheLoad(
PINICACHE *Cache,
PWCHAR FileName,
BOOLEAN String);
VOID
IniCacheDestroy(
PINICACHE Cache);
PINICACHESECTION
IniCacheGetSection(
PINICACHE Cache,
PWCHAR Name);
NTSTATUS
IniCacheGetKey(
PINICACHESECTION Section,
PWCHAR KeyName,
PWCHAR *KeyData);
PINICACHEITERATOR
IniCacheFindFirstValue(
PINICACHESECTION Section,
PWCHAR *KeyName,
PWCHAR *KeyData);
BOOLEAN
IniCacheFindNextValue(
PINICACHEITERATOR Iterator,
PWCHAR *KeyName,
PWCHAR *KeyData);
VOID
IniCacheFindClose(
PINICACHEITERATOR Iterator);
PINICACHEKEY
IniCacheInsertKey(
PINICACHESECTION Section,
PINICACHEKEY AnchorKey,
INSERTION_TYPE InsertionType,
PWCHAR Name,
PWCHAR Data);
PINICACHE
IniCacheCreate(VOID);
NTSTATUS
IniCacheSaveByHandle(
PINICACHE Cache,
HANDLE FileHandle);
NTSTATUS
IniCacheSave(
PINICACHE Cache,
PWCHAR FileName);
PINICACHESECTION
IniCacheAppendSection(
PINICACHE Cache,
PWCHAR Name);
/* EOF */