[SETUPLIB] Don't create new INI sections or key-values if they already exist (#6815)

- If a section already exists, return the existing one. This allows
  avoiding different section entries with the same name in the cache.
  If an INI file has separate sections with the same name, their
  contents (key-values) get merged into a unique section.

- If a key-value already exists, update its data value and return the
  existing one. (Note that this may be subject to behaviour change in
  the future.)
This commit is contained in:
Hermès Bélusca-Maïto 2024-04-23 22:40:31 +02:00
parent 817c27a54e
commit b9ca9b0061
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
3 changed files with 141 additions and 111 deletions

View file

@ -9,8 +9,8 @@
typedef struct _INI_KEYWORD
{
PWCHAR Name;
PWCHAR Data;
PWSTR Name;
PWSTR Data;
struct _INI_KEYWORD *Next;
struct _INI_KEYWORD *Prev;
@ -18,7 +18,7 @@ typedef struct _INI_KEYWORD
typedef struct _INI_SECTION
{
PWCHAR Name;
PWSTR Name;
PINI_KEYWORD FirstKey;
PINI_KEYWORD LastKey;
@ -74,8 +74,8 @@ IniCacheDestroy(
PINI_SECTION
IniGetSection(
PINICACHE Cache,
PWCHAR Name);
_In_ PINICACHE Cache,
_In_ PCWSTR Name);
NTSTATUS
IniGetKey(