[SETUPLIB] Some INI support refactoring: function/struct names, duplicated code (#6815)

And convert ANSI strings to UNICODE in a better way instead of
zero-extending them.
This commit is contained in:
Hermès Bélusca-Maïto 2024-04-23 21:09:36 +02:00
parent cb6fc76b8b
commit 817c27a54e
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
4 changed files with 291 additions and 444 deletions

View file

@ -7,42 +7,38 @@
#pragma once
typedef struct _INICACHEKEY
typedef struct _INI_KEYWORD
{
PWCHAR Name;
PWCHAR Data;
struct _INICACHEKEY *Next;
struct _INICACHEKEY *Prev;
} INICACHEKEY, *PINICACHEKEY;
struct _INI_KEYWORD *Next;
struct _INI_KEYWORD *Prev;
} INI_KEYWORD, *PINI_KEYWORD;
typedef struct _INICACHESECTION
typedef struct _INI_SECTION
{
PWCHAR Name;
PINICACHEKEY FirstKey;
PINICACHEKEY LastKey;
struct _INICACHESECTION *Next;
struct _INICACHESECTION *Prev;
} INICACHESECTION, *PINICACHESECTION;
PINI_KEYWORD FirstKey;
PINI_KEYWORD LastKey;
struct _INI_SECTION *Next;
struct _INI_SECTION *Prev;
} INI_SECTION, *PINI_SECTION;
typedef struct _INICACHE
{
PINICACHESECTION FirstSection;
PINICACHESECTION LastSection;
PINI_SECTION FirstSection;
PINI_SECTION LastSection;
} INICACHE, *PINICACHE;
typedef struct _PINICACHEITERATOR
{
PINICACHESECTION Section;
PINICACHEKEY Key;
PINI_SECTION Section;
PINI_KEYWORD Key;
} INICACHEITERATOR, *PINICACHEITERATOR;
typedef enum
{
INSERT_FIRST,
@ -76,41 +72,51 @@ VOID
IniCacheDestroy(
PINICACHE Cache);
PINICACHESECTION
IniCacheGetSection(
PINI_SECTION
IniGetSection(
PINICACHE Cache,
PWCHAR Name);
NTSTATUS
IniCacheGetKey(
PINICACHESECTION Section,
IniGetKey(
PINI_SECTION Section,
PWCHAR KeyName,
PWCHAR *KeyData);
PINICACHEITERATOR
IniCacheFindFirstValue(
PINICACHESECTION Section,
IniFindFirstValue(
PINI_SECTION Section,
PWCHAR *KeyName,
PWCHAR *KeyData);
BOOLEAN
IniCacheFindNextValue(
IniFindNextValue(
PINICACHEITERATOR Iterator,
PWCHAR *KeyName,
PWCHAR *KeyData);
VOID
IniCacheFindClose(
IniFindClose(
PINICACHEITERATOR Iterator);
PINI_SECTION
IniAddSection(
_In_ PINICACHE Cache,
_In_ PCWSTR Name);
PINICACHEKEY
IniCacheInsertKey(
PINICACHESECTION Section,
PINICACHEKEY AnchorKey,
INSERTION_TYPE InsertionType,
PWCHAR Name,
PWCHAR Data);
PINI_KEYWORD
IniInsertKey(
_In_ PINI_SECTION Section,
_In_ PINI_KEYWORD AnchorKey,
_In_ INSERTION_TYPE InsertionType,
_In_ PCWSTR Name,
_In_ PCWSTR Data);
PINI_KEYWORD
IniAddKey(
_In_ PINI_SECTION Section,
_In_ PCWSTR Name,
_In_ PCWSTR Data);
PINICACHE
IniCacheCreate(VOID);
@ -125,9 +131,4 @@ IniCacheSave(
PINICACHE Cache,
PWCHAR FileName);
PINICACHESECTION
IniCacheAppendSection(
PINICACHE Cache,
PWCHAR Name);
/* EOF */