ReactOS 0.4.16-dev-319-g6cf4263
inicache.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _INI_KEYWORD
 
struct  _INI_SECTION
 
struct  _INICACHE
 
struct  _PINICACHEITERATOR
 

Typedefs

typedef struct _INI_KEYWORD INI_KEYWORD
 
typedef struct _INI_KEYWORDPINI_KEYWORD
 
typedef struct _INI_SECTION INI_SECTION
 
typedef struct _INI_SECTIONPINI_SECTION
 
typedef struct _INICACHE INICACHE
 
typedef struct _INICACHEPINICACHE
 
typedef struct _PINICACHEITERATOR INICACHEITERATOR
 
typedef struct _PINICACHEITERATORPINICACHEITERATOR
 

Enumerations

enum  INSERTION_TYPE { INSERT_FIRST , INSERT_BEFORE , INSERT_AFTER , INSERT_LAST }
 

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 (_In_ PINICACHE Cache)
 
PINI_SECTION IniGetSection (_In_ PINICACHE Cache, _In_ PCWSTR Name)
 
PINI_KEYWORD IniGetKey (_In_ PINI_SECTION Section, _In_ PCWSTR KeyName, _Out_ PCWSTR *KeyData)
 
PINICACHEITERATOR IniFindFirstValue (_In_ PINI_SECTION Section, _Out_ PCWSTR *KeyName, _Out_ PCWSTR *KeyData)
 
BOOLEAN IniFindNextValue (_In_ PINICACHEITERATOR Iterator, _Out_ PCWSTR *KeyName, _Out_ PCWSTR *KeyData)
 
VOID IniFindClose (_In_ PINICACHEITERATOR Iterator)
 
PINI_SECTION IniAddSection (_In_ PINICACHE Cache, _In_ PCWSTR Name)
 
VOID IniRemoveSection (_In_ PINI_SECTION Section)
 
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)
 
VOID IniRemoveKeyByName (_In_ PINI_SECTION Section, _In_ PCWSTR KeyName)
 
VOID IniRemoveKey (_In_ PINI_SECTION Section, _In_ PINI_KEYWORD Key)
 
PINICACHE IniCacheCreate (VOID)
 
NTSTATUS IniCacheSaveByHandle (PINICACHE Cache, HANDLE FileHandle)
 
NTSTATUS IniCacheSave (PINICACHE Cache, PWCHAR FileName)
 

Typedef Documentation

◆ INI_KEYWORD

◆ INI_SECTION

◆ INICACHE

◆ INICACHEITERATOR

◆ PINI_KEYWORD

◆ PINI_SECTION

◆ PINICACHE

◆ PINICACHEITERATOR

Enumeration Type Documentation

◆ INSERTION_TYPE

Enumerator
INSERT_FIRST 
INSERT_BEFORE 
INSERT_AFTER 
INSERT_LAST 

Definition at line 35 of file inicache.h.

36{
INSERTION_TYPE
Definition: inicache.h:36
@ INSERT_BEFORE
Definition: inicache.h:38
@ INSERT_AFTER
Definition: inicache.h:39
@ INSERT_LAST
Definition: inicache.h:40
@ INSERT_FIRST
Definition: inicache.h:37

Function Documentation

◆ IniAddKey()

PINI_KEYWORD IniAddKey ( _In_ PINI_SECTION  Section,
_In_ PCWSTR  Name,
_In_ PCWSTR  Data 
)

Definition at line 883 of file inicache.c.

887{
888 return IniInsertKey(Section, NULL, INSERT_LAST, Name, Data);
889}
#define NULL
Definition: types.h:112
PINI_KEYWORD IniInsertKey(_In_ PINI_SECTION Section, _In_ PINI_KEYWORD AnchorKey, _In_ INSERTION_TYPE InsertionType, _In_ PCWSTR Name, _In_ PCWSTR Data)
Definition: inicache.c:863

Referenced by AddBootStoreEntry(), CreateCommonFreeLdrSections(), CreateNTOSEntry(), FreeLdrMigrateBootDrivePart(), InstallSetupInfFile(), and SetBootStoreOptions().

◆ IniAddSection()

PINI_SECTION IniAddSection ( _In_ PINICACHE  Cache,
_In_ PCWSTR  Name 
)

Definition at line 838 of file inicache.c.

841{
842 if (!Cache || !Name || !*Name)
843 {
844 DPRINT("Invalid parameter\n");
845 return NULL;
846 }
848}
#define TRUE
Definition: types.h:120
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
static PINI_SECTION IniCacheAddSectionAorW(_In_ PINICACHE Cache, _In_ const VOID *Name, _In_ ULONG NameLength, _In_ BOOLEAN IsUnicode)
Definition: inicache.c:229
#define DPRINT
Definition: sndvol32.h:73
Definition: fatfs.h:173

Referenced by CreateCommonFreeLdrSections(), CreateNTOSEntry(), EditCustomBootReactOS(), InitOperatingSystemList(), InstallSetupInfFile(), and OpenIniBootLoaderStore().

◆ IniCacheCreate()

PINICACHE IniCacheCreate ( VOID  )

Definition at line 919 of file inicache.c.

920{
922
923 /* Allocate inicache header */
926 sizeof(INICACHE));
927 if (!Cache)
928 {
929 DPRINT("RtlAllocateHeap() failed\n");
930 return NULL;
931 }
932 InitializeListHead(&Cache->SectionList);
933
934 return Cache;
935}
HANDLE ProcessHeap
Definition: servman.c:15
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:590
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
struct _INICACHE * PINICACHE

Referenced by IniCacheLoadFromMemory(), InstallSetupInfFile(), and OpenIniBootLoaderStore().

◆ IniCacheDestroy()

VOID IniCacheDestroy ( _In_ PINICACHE  Cache)

Definition at line 699 of file inicache.c.

701{
702 if (!Cache)
703 return;
704
705 while (!IsListEmpty(&Cache->SectionList))
706 {
707 PLIST_ENTRY Entry = RemoveHeadList(&Cache->SectionList);
708 PINI_SECTION Section = CONTAINING_RECORD(Entry, INI_SECTION, ListEntry);
709 IniCacheFreeSection(Section);
710 }
711
713}
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:608
#define IsListEmpty(ListHead)
Definition: env_spec_w32.h:954
#define RemoveHeadList(ListHead)
Definition: env_spec_w32.h:964
static VOID IniCacheFreeSection(_In_ PINI_SECTION Section)
Definition: inicache.c:35
base of all file and directory entries
Definition: entries.h:83
Definition: typedefs.h:120
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by CloseIniBootLoaderStore(), and InstallSetupInfFile().

◆ IniCacheLoad()

NTSTATUS IniCacheLoad ( PINICACHE Cache,
PWCHAR  FileName,
BOOLEAN  String 
)

Definition at line 655 of file inicache.c.

659{
665
666 *Cache = NULL;
667
668 /* Open the INI file */
670
672 &Name,
674 NULL,
675 NULL);
676
683 if (!NT_SUCCESS(Status))
684 {
685 DPRINT("NtOpenFile() failed (Status %lx)\n", Status);
686 return Status;
687 }
688
689 DPRINT("NtOpenFile() successful\n");
690
692
693 /* Close the INI file */
695 return Status;
696}
struct NameRec_ * Name
Definition: cdprocs.h:460
LONG NTSTATUS
Definition: precomp.h:26
#define FILE_NON_DIRECTORY_FILE
Definition: constants.h:492
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:36
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define FILE_SHARE_READ
Definition: compat.h:136
_Must_inspect_result_ _In_opt_ PFLT_INSTANCE _Out_ PHANDLE FileHandle
Definition: fltkernel.h:1231
#define FILE_SYNCHRONOUS_IO_NONALERT
Definition: from_kernel.h:31
Status
Definition: gdiplustypes.h:25
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
NTSTATUS IniCacheLoadByHandle(PINICACHE *Cache, HANDLE FileHandle, BOOLEAN String)
Definition: inicache.c:581
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
NTSYSAPI NTSTATUS NTAPI NtOpenFile(OUT PHANDLE phFile, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN ULONG ShareMode, IN ULONG OpenMode)
Definition: file.c:3952
#define SYNCHRONIZE
Definition: nt_native.h:61
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3402
#define FILE_GENERIC_READ
Definition: nt_native.h:653
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2433

Referenced by InstallSetupInfFile().

◆ IniCacheLoadByHandle()

NTSTATUS IniCacheLoadByHandle ( PINICACHE Cache,
HANDLE  FileHandle,
BOOLEAN  String 
)

Definition at line 581 of file inicache.c.

585{
589 PCHAR FileBuffer;
592
593 *Cache = NULL;
594
595 /* Query file size */
598 &FileInfo,
601 if (!NT_SUCCESS(Status))
602 {
603 DPRINT("NtQueryInformationFile() failed (Status %lx)\n", Status);
604 return Status;
605 }
606
607 FileLength = FileInfo.EndOfFile.u.LowPart;
608
609 DPRINT("File size: %lu\n", FileLength);
610
611 /* Allocate file buffer with NULL-terminator */
612 FileBuffer = (PCHAR)RtlAllocateHeap(ProcessHeap,
613 0,
614 FileLength + 1);
615 if (FileBuffer == NULL)
616 {
617 DPRINT1("RtlAllocateHeap() failed\n");
619 }
620
621 /* Read file */
622 FileOffset.QuadPart = 0ULL;
624 NULL,
625 NULL,
626 NULL,
628 FileBuffer,
630 &FileOffset,
631 NULL);
632
633 /* Append NULL-terminator */
634 FileBuffer[FileLength] = 0;
635
636 if (!NT_SUCCESS(Status))
637 {
638 DPRINT("NtReadFile() failed (Status %lx)\n", Status);
639 goto Quit;
640 }
641
643 if (!NT_SUCCESS(Status))
644 {
645 DPRINT1("IniCacheLoadFromMemory() failed (Status %lx)\n", Status);
646 }
647
648Quit:
649 /* Free the file buffer, and return */
650 RtlFreeHeap(ProcessHeap, 0, FileBuffer);
651 return Status;
652}
#define DPRINT1
Definition: precomp.h:8
_In_ PFCB _In_ LONGLONG FileOffset
Definition: cdprocs.h:160
NTSTATUS IniCacheLoadFromMemory(PINICACHE *Cache, PCHAR FileBuffer, ULONG FileLength, BOOLEAN String)
Definition: inicache.c:487
#define PCHAR
Definition: match.c:90
#define ULL(a, b)
Definition: format_msg.c:27
_Out_ PNDIS_HANDLE _Out_ PUINT FileLength
Definition: ndis.h:3228
NTSYSAPI NTSTATUS NTAPI NtQueryInformationFile(IN HANDLE hFile, OUT PIO_STATUS_BLOCK pIoStatusBlock, OUT PVOID FileInformationBuffer, IN ULONG FileInformationBufferLength, IN FILE_INFORMATION_CLASS FileInfoClass)
#define FileStandardInformation
Definition: propsheet.cpp:61
NTSTATUS NTAPI NtReadFile(HANDLE FileHandle, HANDLE Event, PIO_APC_ROUTINE ApcRoutine, PVOID ApcContext, PIO_STATUS_BLOCK IoStatusBlock, PVOID Buffer, ULONG Length, PLARGE_INTEGER ByteOffset, PULONG Key)
uint32_t ULONG
Definition: typedefs.h:59
char * PCHAR
Definition: typedefs.h:51
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158

Referenced by IniCacheLoad(), and OpenIniBootLoaderStore().

◆ IniCacheLoadFromMemory()

NTSTATUS IniCacheLoadFromMemory ( PINICACHE Cache,
PCHAR  FileBuffer,
ULONG  FileLength,
BOOLEAN  String 
)

Definition at line 487 of file inicache.c.

492{
493 PCHAR Ptr;
494
495 PINI_SECTION Section;
497
498 PCHAR SectionName;
499 ULONG SectionNameSize;
500
502 ULONG KeyNameSize;
503
504 PCHAR KeyValue;
505 ULONG KeyValueSize;
506
507 /* Allocate inicache header */
509 if (!*Cache)
511
512 /* Parse ini file */
513 Section = NULL;
514 Ptr = FileBuffer;
515 while (Ptr != NULL && *Ptr != 0)
516 {
518 if (Ptr == NULL)
519 continue;
520
521 if (*Ptr == '[')
522 {
523 Section = NULL;
524 Ptr++;
525
527 &SectionName,
528 &SectionNameSize);
529
530 DPRINT("[%.*s]\n", SectionNameSize, SectionName);
531
532 Section = IniCacheAddSectionAorW(*Cache,
533 SectionName,
534 SectionNameSize,
535 FALSE);
536 if (Section == NULL)
537 {
538 DPRINT("IniCacheAddSectionAorW() failed\n");
540 continue;
541 }
542 }
543 else
544 {
545 if (Section == NULL)
546 {
548 continue;
549 }
550
552 &KeyName,
553 &KeyNameSize);
554
556 &KeyValue,
557 &KeyValueSize,
558 String);
559
560 DPRINT("'%.*s' = '%.*s'\n", KeyNameSize, KeyName, KeyValueSize, KeyValue);
561
562 Key = IniCacheAddKeyAorW(Section,
563 NULL,
565 KeyName,
566 KeyNameSize,
567 KeyValue,
568 KeyValueSize,
569 FALSE);
570 if (Key == NULL)
571 {
572 DPRINT("IniCacheAddKeyAorW() failed\n");
573 }
574 }
575 }
576
577 return STATUS_SUCCESS;
578}
#define FALSE
Definition: types.h:117
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
static PCHAR IniCacheGetKeyName(PCHAR Ptr, PCHAR *NamePtr, PULONG NameSize)
Definition: inicache.c:361
static PCHAR IniCacheGetKeyValue(PCHAR Ptr, PCHAR *DataPtr, PULONG DataSize, BOOLEAN String)
Definition: inicache.c:413
static PCHAR IniCacheSkipToNextSection(PCHAR Ptr)
Definition: inicache.c:303
static PCHAR IniCacheGetSectionName(PCHAR Ptr, PCHAR *NamePtr, PULONG NameSize)
Definition: inicache.c:321
PINICACHE IniCacheCreate(VOID)
Definition: inicache.c:919
static PINI_KEYWORD IniCacheAddKeyAorW(_In_ PINI_SECTION Section, _In_ PINI_KEYWORD AnchorKey, _In_ INSERTION_TYPE InsertionType, _In_ const VOID *Name, _In_ ULONG NameLength, _In_ const VOID *Data, _In_ ULONG DataLength, _In_ BOOLEAN IsUnicode)
Definition: inicache.c:93
static PCHAR IniCacheSkipWhitespace(PCHAR Ptr)
Definition: inicache.c:292
#define STATUS_SUCCESS
Definition: shellext.h:65
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
Definition: wdfdevice.h:2699

Referenced by IniCacheLoadByHandle(), and OpenIniBootLoaderStore().

◆ IniCacheSave()

NTSTATUS IniCacheSave ( PINICACHE  Cache,
PWCHAR  FileName 
)

Definition at line 1038 of file inicache.c.

1041{
1047
1048 /* Create the INI file */
1050
1052 &Name,
1054 NULL,
1055 NULL);
1056
1061 NULL,
1063 0,
1066 NULL,
1067 0);
1068 if (!NT_SUCCESS(Status))
1069 {
1070 DPRINT("NtCreateFile() failed (Status %lx)\n", Status);
1071 return Status;
1072 }
1073
1075
1076 /* Close the INI file */
1078 return Status;
1079}
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
#define FILE_SEQUENTIAL_ONLY
Definition: from_kernel.h:27
#define FILE_SUPERSEDE
Definition: from_kernel.h:53
NTSTATUS IniCacheSaveByHandle(PINICACHE Cache, HANDLE FileHandle)
Definition: inicache.c:938
NTSTATUS NTAPI NtCreateFile(OUT PHANDLE FileHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PIO_STATUS_BLOCK IoStatusBlock, IN PLARGE_INTEGER AllocationSize OPTIONAL, IN ULONG FileAttributes, IN ULONG ShareAccess, IN ULONG CreateDisposition, IN ULONG CreateOptions, IN PVOID EaBuffer OPTIONAL, IN ULONG EaLength)
#define FILE_GENERIC_WRITE
Definition: nt_native.h:660

Referenced by InstallSetupInfFile().

◆ IniCacheSaveByHandle()

NTSTATUS IniCacheSaveByHandle ( PINICACHE  Cache,
HANDLE  FileHandle 
)

Definition at line 938 of file inicache.c.

941{
943 PLIST_ENTRY Entry1, Entry2;
944 PINI_SECTION Section;
948 PCHAR Ptr;
949 ULONG Len;
952
953 /* Calculate required buffer size */
954 BufferSize = 0;
955 Entry1 = Cache->SectionList.Flink;
956 while (Entry1 != &Cache->SectionList)
957 {
958 Section = CONTAINING_RECORD(Entry1, INI_SECTION, ListEntry);
959 BufferSize += (Section->Name ? wcslen(Section->Name) : 0)
960 + 4; /* "[]\r\n" */
961
962 Entry2 = Section->KeyList.Flink;
963 while (Entry2 != &Section->KeyList)
964 {
965 Key = CONTAINING_RECORD(Entry2, INI_KEYWORD, ListEntry);
966 BufferSize += wcslen(Key->Name)
967 + (Key->Data ? wcslen(Key->Data) : 0)
968 + 3; /* "=\r\n" */
969 Entry2 = Entry2->Flink;
970 }
971
972 Entry1 = Entry1->Flink;
973 if (Entry1 != &Cache->SectionList)
974 BufferSize += 2; /* Extra "\r\n" at end of each section */
975 }
976
977 DPRINT("BufferSize: %lu\n", BufferSize);
978
979 /* Allocate file buffer with NULL-terminator */
982 BufferSize + 1);
983 if (Buffer == NULL)
984 {
985 DPRINT1("RtlAllocateHeap() failed\n");
987 }
988
989 /* Fill file buffer */
990 Ptr = Buffer;
991 Entry1 = Cache->SectionList.Flink;
992 while (Entry1 != &Cache->SectionList)
993 {
994 Section = CONTAINING_RECORD(Entry1, INI_SECTION, ListEntry);
995 Len = sprintf(Ptr, "[%S]\r\n", Section->Name);
996 Ptr += Len;
997
998 Entry2 = Section->KeyList.Flink;
999 while (Entry2 != &Section->KeyList)
1000 {
1001 Key = CONTAINING_RECORD(Entry2, INI_KEYWORD, ListEntry);
1002 Len = sprintf(Ptr, "%S=%S\r\n", Key->Name, Key->Data);
1003 Ptr += Len;
1004 Entry2 = Entry2->Flink;
1005 }
1006
1007 Entry1 = Entry1->Flink;
1008 if (Entry1 != &Cache->SectionList)
1009 {
1010 Len = sprintf(Ptr, "\r\n");
1011 Ptr += Len;
1012 }
1013 }
1014
1015 /* Write to the INI file */
1016 Offset.QuadPart = 0LL;
1018 NULL,
1019 NULL,
1020 NULL,
1022 Buffer,
1023 BufferSize,
1024 &Offset,
1025 NULL);
1026 if (!NT_SUCCESS(Status))
1027 {
1028 DPRINT("NtWriteFile() failed (Status %lx)\n", Status);
1030 return Status;
1031 }
1032
1034 return STATUS_SUCCESS;
1035}
Definition: bufpool.h:45
#define Len
Definition: deflate.h:82
#define BufferSize
Definition: mmc.h:75
#define sprintf(buf, format,...)
Definition: sprintf.c:55
NTSYSAPI NTSTATUS NTAPI NtWriteFile(IN HANDLE hFile, IN HANDLE hEvent OPTIONAL, IN PIO_APC_ROUTINE IoApcRoutine OPTIONAL, IN PVOID IoApcContext OPTIONAL, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN PVOID WriteBuffer, IN ULONG WriteBufferLength, IN PLARGE_INTEGER FileOffset OPTIONAL, IN PULONG LockOperationKey OPTIONAL)
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
PWSTR Name
Definition: inicache.h:19
LIST_ENTRY KeyList
Definition: inicache.h:20
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
#define LL
Definition: tui.h:167
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:254

Referenced by CloseIniBootLoaderStore(), and IniCacheSave().

◆ IniFindClose()

VOID IniFindClose ( _In_ PINICACHEITERATOR  Iterator)

Definition at line 828 of file inicache.c.

830{
831 if (!Iterator)
832 return;
834}
_In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR Iterator
Definition: wdfchildlist.h:656

Referenced by FreeLdrEnumerateBootEntries(), FreeLdrMigrateBootDrivePart(), and NtLdrEnumerateBootEntries().

◆ IniFindFirstValue()

PINICACHEITERATOR IniFindFirstValue ( _In_ PINI_SECTION  Section,
_Out_ PCWSTR KeyName,
_Out_ PCWSTR KeyData 
)

Definition at line 756 of file inicache.c.

760{
764
765 if (!Section || !KeyName || !KeyData)
766 {
767 DPRINT("Invalid parameter\n");
768 return NULL;
769 }
770
771 Entry = Section->KeyList.Flink;
772 if (Entry == &Section->KeyList)
773 {
774 DPRINT("Invalid parameter\n");
775 return NULL;
776 }
777 Key = CONTAINING_RECORD(Entry, INI_KEYWORD, ListEntry);
778
780 0,
781 sizeof(INICACHEITERATOR));
782 if (!Iterator)
783 {
784 DPRINT("RtlAllocateHeap() failed\n");
785 return NULL;
786 }
787 Iterator->Section = Section;
788 Iterator->Key = Key;
789
790 *KeyName = Key->Name;
791 *KeyData = Key->Data;
792
793 return Iterator;
794}
struct _PINICACHEITERATOR * PINICACHEITERATOR

Referenced by FreeLdrEnumerateBootEntries(), FreeLdrMigrateBootDrivePart(), and NtLdrEnumerateBootEntries().

◆ IniFindNextValue()

BOOLEAN IniFindNextValue ( _In_ PINICACHEITERATOR  Iterator,
_Out_ PCWSTR KeyName,
_Out_ PCWSTR KeyData 
)

Definition at line 797 of file inicache.c.

801{
804
805 if (!Iterator || !KeyName || !KeyData)
806 {
807 DPRINT("Invalid parameter\n");
808 return FALSE;
809 }
810
811 Entry = Iterator->Key->ListEntry.Flink;
812 if (Entry == &Iterator->Section->KeyList)
813 {
814 DPRINT("No more entries\n");
815 return FALSE;
816 }
817 Key = CONTAINING_RECORD(Entry, INI_KEYWORD, ListEntry);
818
819 Iterator->Key = Key;
820
821 *KeyName = Key->Name;
822 *KeyData = Key->Data;
823
824 return TRUE;
825}

Referenced by FreeLdrEnumerateBootEntries(), FreeLdrMigrateBootDrivePart(), and NtLdrEnumerateBootEntries().

◆ IniGetKey()

PINI_KEYWORD IniGetKey ( _In_ PINI_SECTION  Section,
_In_ PCWSTR  KeyName,
_Out_ PCWSTR KeyData 
)

Definition at line 730 of file inicache.c.

734{
736
737 if (!Section || !KeyName || !KeyData)
738 {
739 DPRINT("Invalid parameter\n");
740 return NULL;
741 }
742
743 *KeyData = NULL;
744
745 Key = IniCacheFindKey(Section, KeyName);
746 if (!Key)
747 return NULL;
748
749 *KeyData = Key->Data;
750
751 return Key;
752}
static PINI_KEYWORD IniCacheFindKey(_In_ PINI_SECTION Section, _In_ PCWSTR Name)
Definition: inicache.c:74

Referenced by FreeLdrEnumerateBootEntries(), FreeLdrMigrateBootDrivePart(), FreeLdrMigrateBootDrivePartWorker(), and QueryBootStoreOptions().

◆ IniGetSection()

PINI_SECTION IniGetSection ( _In_ PINICACHE  Cache,
_In_ PCWSTR  Name 
)

Definition at line 717 of file inicache.c.

720{
721 if (!Cache || !Name)
722 {
723 DPRINT("Invalid parameter\n");
724 return NULL;
725 }
727}
static PINI_SECTION IniCacheFindSection(_In_ PINICACHE Cache, _In_ PCWSTR Name)
Definition: inicache.c:55

Referenced by FreeLdrEnumerateBootEntries(), FreeLdrMigrateBootDrivePart(), and OpenIniBootLoaderStore().

◆ IniInsertKey()

PINI_KEYWORD IniInsertKey ( _In_ PINI_SECTION  Section,
_In_ PINI_KEYWORD  AnchorKey,
_In_ INSERTION_TYPE  InsertionType,
_In_ PCWSTR  Name,
_In_ PCWSTR  Data 
)

Definition at line 863 of file inicache.c.

869{
870 if (!Section || !Name || !*Name || !Data || !*Data)
871 {
872 DPRINT("Invalid parameter\n");
873 return NULL;
874 }
875 return IniCacheAddKeyAorW(Section,
876 AnchorKey, InsertionType,
877 Name, wcslen(Name),
878 Data, wcslen(Data),
879 TRUE);
880}

Referenced by FreeLdrMigrateBootDrivePartWorker(), and IniAddKey().

◆ IniRemoveKey()

VOID IniRemoveKey ( _In_ PINI_SECTION  Section,
_In_ PINI_KEYWORD  Key 
)

Definition at line 905 of file inicache.c.

908{
909 UNREFERENCED_PARAMETER(Section);
910 if (!Key)
911 {
912 DPRINT("Invalid parameter\n");
913 return;
914 }
916}
static VOID IniCacheFreeKey(_In_ PINI_KEYWORD Key)
Definition: inicache.c:20
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:325

◆ IniRemoveKeyByName()

VOID IniRemoveKeyByName ( _In_ PINI_SECTION  Section,
_In_ PCWSTR  KeyName 
)

Definition at line 892 of file inicache.c.

895{
897 UNREFERENCED_PARAMETER(Section);
898
899 Key = IniCacheFindKey(Section, KeyName);
900 if (Key)
902}

Referenced by FreeLdrMigrateBootDrivePartWorker().

◆ IniRemoveSection()

VOID IniRemoveSection ( _In_ PINI_SECTION  Section)

Definition at line 851 of file inicache.c.

853{
854 if (!Section)
855 {
856 DPRINT("Invalid parameter\n");
857 return;
858 }
859 IniCacheFreeSection(Section);
860}