80 for (
Entry = Section->KeyList.Flink;
81 Entry != &Section->KeyList;
108 DPRINT(
"Invalid parameter\n");
115 (NameLength + 1) *
sizeof(
WCHAR));
118 DPRINT(
"RtlAllocateHeap() failed\n");
145 DPRINT(
"RtlAllocateHeap() failed\n");
169 DPRINT(
"RtlAllocateHeap() failed\n");
181 DPRINT(
"RtlAllocateHeap() failed\n");
201 (!AnchorKey || (&AnchorKey->ListEntry == Section->KeyList.Flink))))
213 (!AnchorKey || (&AnchorKey->ListEntry == Section->KeyList.Blink))))
240 DPRINT(
"Invalid parameter\n");
247 (NameLength + 1) *
sizeof(
WCHAR));
250 DPRINT(
"RtlAllocateHeap() failed\n");
277 DPRINT(
"RtlAllocateHeap() failed\n");
281 Section->
Name = NameU;
306 while (*
Ptr != 0 && *
Ptr !=
'[')
308 while (*
Ptr != 0 && *
Ptr !=
L'\n')
339 while (*
Ptr != 0 && *
Ptr !=
']')
346 while (*
Ptr != 0 && *
Ptr !=
L'\n')
354 DPRINT(
"SectionName: '%.*s'\n",
Size, *NamePtr);
396 while (*
Ptr != 0 && *
Ptr !=
'\r' && *
Ptr !=
'\n')
456 while (*
Ptr && *
Ptr !=
'\r' && *
Ptr !=
'\n')
465 while (*
Ptr != 0 && *
Ptr !=
'\r' && *
Ptr !=
';')
499 ULONG SectionNameSize;
530 DPRINT(
"[%.*s]\n", SectionNameSize, SectionName);
538 DPRINT(
"IniCacheAddSectionAorW() failed\n");
560 DPRINT(
"'%.*s' = '%.*s'\n", KeyNameSize,
KeyName, KeyValueSize, KeyValue);
572 DPRINT(
"IniCacheAddKeyAorW() failed\n");
603 DPRINT(
"NtQueryInformationFile() failed (Status %lx)\n",
Status);
615 if (FileBuffer ==
NULL)
617 DPRINT1(
"RtlAllocateHeap() failed\n");
645 DPRINT1(
"IniCacheLoadFromMemory() failed (Status %lx)\n",
Status);
689 DPRINT(
"NtOpenFile() successful\n");
723 DPRINT(
"Invalid parameter\n");
737 if (!Section || !
KeyName || !KeyData)
739 DPRINT(
"Invalid parameter\n");
749 *KeyData =
Key->Data;
765 if (!Section || !
KeyName || !KeyData)
767 DPRINT(
"Invalid parameter\n");
771 Entry = Section->KeyList.Flink;
772 if (
Entry == &Section->KeyList)
774 DPRINT(
"Invalid parameter\n");
784 DPRINT(
"RtlAllocateHeap() failed\n");
791 *KeyData =
Key->Data;
807 DPRINT(
"Invalid parameter\n");
814 DPRINT(
"No more entries\n");
822 *KeyData =
Key->Data;
844 DPRINT(
"Invalid parameter\n");
856 DPRINT(
"Invalid parameter\n");
872 DPRINT(
"Invalid parameter\n");
876 AnchorKey, InsertionType,
912 DPRINT(
"Invalid parameter\n");
929 DPRINT(
"RtlAllocateHeap() failed\n");
955 Entry1 =
Cache->SectionList.Flink;
956 while (Entry1 != &
Cache->SectionList)
963 while (Entry2 != &Section->
KeyList)
969 Entry2 = Entry2->
Flink;
972 Entry1 = Entry1->
Flink;
973 if (Entry1 != &
Cache->SectionList)
985 DPRINT1(
"RtlAllocateHeap() failed\n");
991 Entry1 =
Cache->SectionList.Flink;
992 while (Entry1 != &
Cache->SectionList)
999 while (Entry2 != &Section->
KeyList)
1004 Entry2 = Entry2->
Flink;
1007 Entry1 = Entry1->
Flink;
1008 if (Entry1 != &
Cache->SectionList)
1070 DPRINT(
"NtCreateFile() failed (Status %lx)\n",
Status);
#define FILE_NON_DIRECTORY_FILE
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
_In_ PFCB _In_ LONGLONG FileOffset
_In_ ULONG _In_opt_ WDFREQUEST _In_opt_ PVOID _In_ size_t _In_ PVOID _In_ size_t _Out_ size_t * DataLength
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
#define NT_SUCCESS(StatCode)
#define FILE_ATTRIBUTE_NORMAL
#define RemoveEntryList(Entry)
#define InsertTailList(ListHead, Entry)
#define InsertHeadList(ListHead, Entry)
#define IsListEmpty(ListHead)
#define RemoveHeadList(ListHead)
#define InitializeListHead(ListHead)
_Must_inspect_result_ _In_opt_ PFLT_INSTANCE _Out_ PHANDLE FileHandle
#define FILE_SYNCHRONOUS_IO_NONALERT
#define FILE_SEQUENTIAL_ONLY
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define OBJ_CASE_INSENSITIVE
VOID IniCacheDestroy(_In_ PINICACHE Cache)
NTSTATUS IniCacheLoad(PINICACHE *Cache, PWCHAR FileName, BOOLEAN String)
NTSTATUS IniCacheLoadFromMemory(PINICACHE *Cache, PCHAR FileBuffer, ULONG FileLength, BOOLEAN String)
VOID IniRemoveSection(_In_ PINI_SECTION Section)
static VOID IniCacheFreeKey(_In_ PINI_KEYWORD Key)
VOID IniRemoveKeyByName(_In_ PINI_SECTION Section, _In_ PCWSTR KeyName)
static PINI_KEYWORD IniCacheFindKey(_In_ PINI_SECTION Section, _In_ PCWSTR Name)
PINI_SECTION IniAddSection(_In_ PINICACHE Cache, _In_ PCWSTR Name)
NTSTATUS IniCacheSaveByHandle(PINICACHE Cache, HANDLE FileHandle)
VOID IniRemoveKey(_In_ PINI_SECTION Section, _In_ PINI_KEYWORD Key)
static PCHAR IniCacheGetKeyName(PCHAR Ptr, PCHAR *NamePtr, PULONG NameSize)
PINICACHEITERATOR IniFindFirstValue(_In_ PINI_SECTION Section, _Out_ PCWSTR *KeyName, _Out_ PCWSTR *KeyData)
PINI_SECTION IniGetSection(_In_ PINICACHE Cache, _In_ PCWSTR Name)
static PINI_SECTION IniCacheAddSectionAorW(_In_ PINICACHE Cache, _In_ const VOID *Name, _In_ ULONG NameLength, _In_ BOOLEAN IsUnicode)
PINI_KEYWORD IniGetKey(_In_ PINI_SECTION Section, _In_ PCWSTR KeyName, _Out_ PCWSTR *KeyData)
static PINI_SECTION IniCacheFindSection(_In_ PINICACHE Cache, _In_ PCWSTR Name)
static VOID IniCacheFreeSection(_In_ PINI_SECTION Section)
static PCHAR IniCacheGetKeyValue(PCHAR Ptr, PCHAR *DataPtr, PULONG DataSize, BOOLEAN String)
static PCHAR IniCacheSkipToNextSection(PCHAR Ptr)
static PCHAR IniCacheGetSectionName(PCHAR Ptr, PCHAR *NamePtr, PULONG NameSize)
NTSTATUS IniCacheSave(PINICACHE Cache, PWCHAR FileName)
PINICACHE IniCacheCreate(VOID)
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)
VOID IniFindClose(_In_ PINICACHEITERATOR Iterator)
NTSTATUS IniCacheLoadByHandle(PINICACHE *Cache, HANDLE FileHandle, BOOLEAN String)
BOOLEAN IniFindNextValue(_In_ PINICACHEITERATOR Iterator, _Out_ PCWSTR *KeyName, _Out_ PCWSTR *KeyData)
static PCHAR IniCacheSkipWhitespace(PCHAR Ptr)
PINI_KEYWORD IniAddKey(_In_ PINI_SECTION Section, _In_ PCWSTR Name, _In_ PCWSTR Data)
PINI_KEYWORD IniInsertKey(_In_ PINI_SECTION Section, _In_ PINI_KEYWORD AnchorKey, _In_ INSERTION_TYPE InsertionType, _In_ PCWSTR Name, _In_ PCWSTR Data)
struct _PINICACHEITERATOR * PINICACHEITERATOR
struct _INI_SECTION * PINI_SECTION
struct _INI_KEYWORD * PINI_KEYWORD
struct _INICACHE * PINICACHE
int _snwprintf(wchar_t *buffer, size_t count, const wchar_t *format,...)
#define sprintf(buf, format,...)
static OUT PIO_STATUS_BLOCK IoStatusBlock
#define InitializeObjectAttributes(p, n, a, r, s)
_In_ NDIS_STATUS _In_ ULONG _In_ USHORT _In_opt_ PVOID _In_ ULONG DataSize
_Out_ PNDIS_HANDLE _Out_ PUINT FileLength
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)
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)
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSYSAPI NTSTATUS NTAPI NtQueryInformationFile(IN HANDLE hFile, OUT PIO_STATUS_BLOCK pIoStatusBlock, OUT PVOID FileInformationBuffer, IN ULONG FileInformationBufferLength, IN FILE_INFORMATION_CLASS FileInfoClass)
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
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_READ
#define FILE_GENERIC_WRITE
#define UNREFERENCED_PARAMETER(P)
_In_ ULONG _In_ ULONG Offset
#define FileStandardInformation
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
_CRTIMP wchar_t *__cdecl wcsncpy(wchar_t *_Dest, const wchar_t *_Source, size_t _Count)
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)
base of all file and directory entries
struct _LIST_ENTRY * Flink
#define CONTAINING_RECORD(address, type, field)
#define STATUS_INSUFFICIENT_RESOURCES
_In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR Iterator
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize