35 #define HCI_TO_HKEY(CellIndex) ((HKEY)(ULONG_PTR)(CellIndex)) 36 #ifndef HKEY_TO_HCI // See also registry.h 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 CM_KEY_VALUE_SIGNATURE
WCHAR Name[ANYSIZE_ARRAY]
FORCEINLINE VOID FrLdrHeapFree(PVOID MemoryPointer, ULONG Tag)
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ PNDIS_STRING SubKeyName
#define ERROR_NO_MORE_ITEMS
#define UNREFERENCED_PARAMETER(P)
BOOLEAN RegImportBinaryHive(_In_ PVOID ChunkBase, _In_ ULONG ChunkSize)
#define CM_KEY_NODE_SIGNATURE
VOID NTAPI CmpFree(IN PVOID Ptr, IN ULONG Quota)
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)
BOOLEAN RegInitCurrentControlSet(_In_ BOOLEAN LastKnownGood)
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
LONG RegQueryValue(_In_ HKEY Key, _In_z_ PCWSTR ValueName, _Out_opt_ PULONG Type, _Out_opt_ PUCHAR Data, _Inout_opt_ PULONG DataSize)
HCELL_INDEX NTAPI CmpFindSubKeyByNumber(IN PHHIVE Hive, IN PCM_KEY_NODE Node, IN ULONG Number)
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
PVOID NTAPI CmpAllocate(IN SIZE_T Size, IN BOOLEAN Paged, IN ULONG Tag)
IN PVOID IN PVOID IN USHORT IN USHORT Size
static PCMHIVE CmSystemHive
#define HvGetCell(Hive, Cell)
static HCELL_INDEX SystemRootCell
struct _CELL_DATA * PCELL_DATA
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
HKEY CurrentControlSetKey
_Inout_ PUCHAR _In_ PUCHAR _Out_ PUCHAR _Out_ PULONG ChunkSize
VOID NTAPI CmpCopyCompressedName(OUT PWCHAR Destination, IN ULONG DestinationLength, IN PWCHAR Source, IN ULONG SourceLength)
WCHAR Name[ANYSIZE_ARRAY]
FORCEINLINE PVOID FrLdrTempAlloc(_In_ SIZE_T Size, _In_ ULONG Tag)
#define HCI_TO_HKEY(CellIndex)
struct _CM_KEY_NODE * PCM_KEY_NODE
_In_ ULONG _In_opt_ WDFREQUEST _In_opt_ PVOID _In_ size_t _In_ PVOID _In_ size_t _Out_ size_t * DataLength
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
#define ERROR_FILE_NOT_FOUND
DBG_DEFAULT_CHANNEL(REGISTRY)
PCELL_DATA NTAPI CmpValueToData(IN PHHIVE Hive, IN PCM_KEY_VALUE Value, OUT PULONG Length)
FORCEINLINE PVOID FrLdrHeapAlloc(SIZE_T MemorySize, ULONG Tag)
#define NT_SUCCESS(StatCode)
_In_ WDFCOLLECTION _In_ ULONG Index
HCELL_INDEX KeyList[ANYSIZE_ARRAY]
#define GET_CM_KEY_NODE(hHive, hKey)
#define GET_HHIVE(CmHive)
static VOID RepGetValueData(_In_ PHHIVE Hive, _In_ PCM_KEY_VALUE ValueCell, _Out_opt_ PULONG Type, _Out_opt_ PUCHAR Data, _Inout_opt_ PULONG DataSize)
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING ValueName
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN _In_opt_ PVOID Tag
#define GET_HHIVE_FROM_HKEY(hKey)
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,...
#define HvReleaseCell(Hive, Cell)
_Must_inspect_result_ _In_opt_ WDFKEY ParentKey
HCELL_INDEX NTAPI CmpFindValueByName(IN PHHIVE Hive, IN PCM_KEY_NODE KeyNode, IN PCUNICODE_STRING Name)
struct _CM_KEY_VALUE * PCM_KEY_VALUE
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define RtlCopyMemory(Destination, Source, Length)
#define ERROR_PATH_NOT_FOUND
HCELL_INDEX NTAPI CmpFindSubKeyByName(IN PHHIVE Hive, IN PCM_KEY_NODE Parent, IN PCUNICODE_STRING SearchName)
NTSYSAPI BOOLEAN NTAPI RtlEqualUnicodeString(PUNICODE_STRING String1, PUNICODE_STRING String2, BOOLEAN CaseInSensitive)
USHORT NTAPI CmpCompressedNameSize(IN PWCHAR Name, IN ULONG Length)
_In_ NDIS_STATUS _In_ ULONG _In_ USHORT _In_opt_ PVOID _In_ ULONG DataSize
#define HKEY_TO_HCI(hKey)
LONG RegOpenKey(_In_ HKEY ParentKey, _In_z_ PCWSTR KeyName, _Out_ PHKEY Key)
static BOOLEAN GetNextPathElement(_Out_ PUNICODE_STRING NextElement, _Inout_ PUNICODE_STRING RemainingPath)
#define RTL_CONSTANT_STRING(s)
FORCEINLINE VOID FrLdrTempFree(PVOID Allocation, ULONG Tag)