35#define HCI_TO_HKEY(CellIndex) ((HKEY)(ULONG_PTR)(CellIndex))
37#define HKEY_TO_HCI(hKey) ((HCELL_INDEX)(ULONG_PTR)(hKey))
40#define GET_HHIVE(CmHive) (&((CmHive)->Hive))
41#define GET_HHIVE_FROM_HKEY(hKey) GET_HHIVE(CmSystemHive)
42#define GET_CM_KEY_NODE(hHive, hKey) ((PCM_KEY_NODE)HvGetCell(hHive, HKEY_TO_HCI(hKey)))
92 ERR(
"Corrupted hive %p!\n", ChunkBase);
120 TRACE(
"RegInitCurrentControlSet\n");
124 LastKnownGood ?
L"LastKnownGood"
133 ERR(
"CmpFindControlSet('%wZ') failed\n", &ControlSetName);
155 if (RemainingPath->Length <
sizeof(
WCHAR))
162 NextElement->Buffer = RemainingPath->Buffer;
165 while ((RemainingPath->Length >=
sizeof(
WCHAR)) &&
166 (RemainingPath->Buffer[0] !=
'\\'))
169 RemainingPath->Buffer++;
170 RemainingPath->Length -=
sizeof(
WCHAR);
173 NextElement->Length = (
USHORT)(RemainingPath->Buffer - NextElement->Buffer) *
sizeof(
WCHAR);
174 NextElement->MaximumLength = NextElement->Length;
177 if (RemainingPath->Length >=
sizeof(
WCHAR))
180 ASSERT(RemainingPath->Buffer[0] ==
'\\');
181 RemainingPath->Buffer++;
182 RemainingPath->Length -=
sizeof(
WCHAR);
203 TRACE(
"RegEnumKey(%p, %lu, %p, %p->%u)\n",
214 TRACE(
"RegEnumKey index out of bounds (%d) in key (%.*s)\n",
245 if (*NameSize >= NameLength +
sizeof(
WCHAR))
250 *NameSize = NameLength +
sizeof(
WCHAR);
257 TRACE(
"RegEnumKey done -> %u, '%.*S'\n", *NameSize, *NameSize,
Name);
287 TRACE(
"RegOpenKey: absolute path\n");
290 RemainingPath.
Buffer[0] !=
'\\')
293 ERR(
"RegOpenKey: invalid path '%S' (%wZ)\n",
KeyName, &RemainingPath);
305 TRACE(
"RegOpenKey: %wZ / %wZ / %wZ\n", &SubKeyName1, &SubKeyName2, &SubKeyName3);
313 ERR(
"RegOpenKey: invalid path '%S' (%wZ)\n",
KeyName, &RemainingPath);
339 RemainingPath = TempPath;
348 TRACE(
"RegOpenKey: RemainingPath '%wZ'\n", &RemainingPath);
360 CellIndex = NextCellIndex;
393 *
Type = ValueCell->Type;
431 TRACE(
"RegQueryValue(%p, '%S', %p, %p, %p)\n",
444 TRACE(
"RegQueryValue value not found in key (%.*s)\n",
484 TRACE(
"RegEnumValue(%p, %lu, %S, %p, %p, %p, %p (%lu))\n",
497 ERR(
"RegEnumValue: index invalid\n");
529 if (*NameSize >= NameLength +
sizeof(
WCHAR))
534 *NameSize = NameLength +
sizeof(
WCHAR);
542 TRACE(
"RegEnumValue done -> %u, '%.*S'\n", *NameSize, *NameSize,
ValueName);
#define DBG_DEFAULT_CHANNEL(ch)
FORCEINLINE VOID FrLdrHeapFree(PVOID MemoryPointer, ULONG Tag)
FORCEINLINE PVOID FrLdrTempAlloc(_In_ SIZE_T Size, _In_ ULONG Tag)
FORCEINLINE VOID FrLdrTempFree(PVOID Allocation, ULONG Tag)
FORCEINLINE PVOID FrLdrHeapAlloc(SIZE_T MemorySize, ULONG Tag)
#define GET_CM_KEY_NODE(hHive, hKey)
static BOOLEAN GetNextPathElement(_Out_ PUNICODE_STRING NextElement, _Inout_ PUNICODE_STRING RemainingPath)
BOOLEAN RegInitCurrentControlSet(_In_ BOOLEAN LastKnownGood)
static VOID RepGetValueData(_In_ PHHIVE Hive, _In_ PCM_KEY_VALUE ValueCell, _Out_opt_ PULONG Type, _Out_opt_ PUCHAR Data, _Inout_opt_ PULONG DataSize)
VOID NTAPI CmpFree(IN PVOID Ptr, IN ULONG Quota)
#define GET_HHIVE(CmHive)
static PCMHIVE CmSystemHive
static HCELL_INDEX SystemRootCell
HKEY CurrentControlSetKey
BOOLEAN RegImportBinaryHive(_In_ PVOID ChunkBase, _In_ ULONG ChunkSize)
#define HCI_TO_HKEY(CellIndex)
PVOID NTAPI CmpAllocate(IN SIZE_T Size, IN BOOLEAN Paged, IN ULONG Tag)
#define GET_HHIVE_FROM_HKEY(hKey)
#define HKEY_TO_HCI(hKey)
_In_ ULONG _In_opt_ WDFREQUEST _In_opt_ PVOID _In_ size_t _In_ PVOID _In_ size_t _Out_ size_t * DataLength
HCELL_INDEX NTAPI CmpFindControlSet(_In_ PHHIVE SystemHive, _In_ HCELL_INDEX RootCell, _In_ PCUNICODE_STRING SelectKeyName, _Out_ PBOOLEAN AutoSelect)
Finds the corresponding "HKLM\SYSTEM\ControlSetXXX" system control set registry key,...
struct _CELL_DATA * PCELL_DATA
struct _CM_KEY_NODE * PCM_KEY_NODE
struct _CM_KEY_VALUE * PCM_KEY_VALUE
#define CM_KEY_VALUE_SIGNATURE
#define CM_KEY_NODE_SIGNATURE
HCELL_INDEX NTAPI CmpFindSubKeyByNumber(IN PHHIVE Hive, IN PCM_KEY_NODE Node, IN ULONG Number)
HCELL_INDEX NTAPI CmpFindSubKeyByName(IN PHHIVE Hive, IN PCM_KEY_NODE Parent, IN PCUNICODE_STRING SearchName)
#define HvReleaseCell(Hive, Cell)
VOID NTAPI CmpCopyCompressedName(OUT PWCHAR Destination, IN ULONG DestinationLength, IN PWCHAR Source, IN ULONG SourceLength)
NTSTATUS CMAPI HvInitialize(PHHIVE RegistryHive, ULONG OperationType, ULONG HiveFlags, ULONG FileType, PVOID HiveData OPTIONAL, PALLOCATE_ROUTINE Allocate, PFREE_ROUTINE Free, PFILE_SET_SIZE_ROUTINE FileSetSize, PFILE_WRITE_ROUTINE FileWrite, PFILE_READ_ROUTINE FileRead, PFILE_FLUSH_ROUTINE FileFlush, ULONG Cluster OPTIONAL, PCUNICODE_STRING FileName OPTIONAL)
HCELL_INDEX NTAPI CmpFindValueByName(IN PHHIVE Hive, IN PCM_KEY_NODE KeyNode, IN PCUNICODE_STRING Name)
PCELL_DATA NTAPI CmpValueToData(IN PHHIVE Hive, IN PCM_KEY_VALUE Value, OUT PULONG Length)
USHORT NTAPI CmpCompressedNameSize(IN PWCHAR Name, IN ULONG Length)
#define HvGetCell(Hive, Cell)
#define NT_SUCCESS(StatCode)
#define ERROR_NO_MORE_ITEMS
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
#define ERROR_FILE_NOT_FOUND
_In_ NDIS_STATUS _In_ ULONG _In_ USHORT _In_opt_ PVOID _In_ ULONG DataSize
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ PNDIS_STRING SubKeyName
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSYSAPI BOOLEAN NTAPI RtlEqualUnicodeString(PUNICODE_STRING String1, PUNICODE_STRING String2, BOOLEAN CaseInSensitive)
#define UNREFERENCED_PARAMETER(P)
HCELL_INDEX KeyList[ANYSIZE_ARRAY]
WCHAR Name[ANYSIZE_ARRAY]
WCHAR Name[ANYSIZE_ARRAY]
#define RTL_CONSTANT_STRING(s)
#define RtlCopyMemory(Destination, Source, Length)
_In_ WDFCOLLECTION _In_ ULONG Index
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN _In_opt_ PVOID Tag
_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_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
_Must_inspect_result_ _In_opt_ WDFKEY ParentKey
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING ValueName
#define ERROR_PATH_NOT_FOUND
_Inout_ PUCHAR _In_ PUCHAR _Out_ PUCHAR _Out_ PULONG ChunkSize