ReactOS  0.4.15-dev-5112-g22d8c0f
registry.c
Go to the documentation of this file.
1 /*
2  * FreeLoader
3  *
4  * Copyright (C) 2014 Timo Kreuzer <timo.kreuzer@reactos.org>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19  */
20 
21 #include <freeldr.h>
22 #include <cmlib.h>
23 #include "registry.h"
24 #include <internal/cmboot.h>
25 
26 #include <debug.h>
27 DBG_DEFAULT_CHANNEL(REGISTRY);
28 
31 
34 
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))
38 #endif
39 
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)))
43 
44 PVOID
45 NTAPI
47  IN SIZE_T Size,
48  IN BOOLEAN Paged,
49  IN ULONG Tag)
50 {
52  return FrLdrHeapAlloc(Size, Tag);
53 }
54 
55 VOID
56 NTAPI
58  IN PVOID Ptr,
59  IN ULONG Quota)
60 {
62  FrLdrHeapFree(Ptr, 0);
63 }
64 
65 BOOLEAN
67  _In_ PVOID ChunkBase,
69 {
71  PCM_KEY_NODE KeyNode;
72 
73  TRACE("RegImportBinaryHive(%p, 0x%lx)\n", ChunkBase, ChunkSize);
74 
75  /* Allocate and initialize the hive */
76  CmSystemHive = FrLdrTempAlloc(sizeof(CMHIVE), 'eviH');
78  HINIT_FLAT, // HINIT_MEMORY_INPLACE
79  0,
80  0,
81  ChunkBase,
83  CmpFree,
84  NULL,
85  NULL,
86  NULL,
87  NULL,
88  1,
89  NULL);
90  if (!NT_SUCCESS(Status))
91  {
92  ERR("Corrupted hive %p!\n", ChunkBase);
93  FrLdrTempFree(CmSystemHive, 'eviH');
94  return FALSE;
95  }
96 
97  /* Save the root key node */
101 
102  /* Verify it is accessible */
104  ASSERT(KeyNode);
107 
108  return TRUE;
109 }
110 
111 BOOLEAN
113  _In_ BOOLEAN LastKnownGood)
114 {
115  UNICODE_STRING ControlSetName;
116  HCELL_INDEX ControlCell;
117  PCM_KEY_NODE KeyNode;
118  BOOLEAN AutoSelect;
119 
120  TRACE("RegInitCurrentControlSet\n");
121 
122  /* Choose which control set to open and set it as the new "Current" */
123  RtlInitUnicodeString(&ControlSetName,
124  LastKnownGood ? L"LastKnownGood"
125  : L"Default");
126 
127  ControlCell = CmpFindControlSet(SystemHive,
129  &ControlSetName,
130  &AutoSelect);
131  if (ControlCell == HCELL_NIL)
132  {
133  ERR("CmpFindControlSet('%wZ') failed\n", &ControlSetName);
134  return FALSE;
135  }
136 
137  CurrentControlSetKey = HCI_TO_HKEY(ControlCell);
138 
139  /* Verify it is accessible */
140  KeyNode = (PCM_KEY_NODE)HvGetCell(SystemHive, ControlCell);
141  ASSERT(KeyNode);
143  HvReleaseCell(SystemHive, ControlCell);
144 
145  return TRUE;
146 }
147 
148 static
149 BOOLEAN
151  _Out_ PUNICODE_STRING NextElement,
152  _Inout_ PUNICODE_STRING RemainingPath)
153 {
154  /* Check if there are any characters left */
155  if (RemainingPath->Length < sizeof(WCHAR))
156  {
157  /* Nothing left, bail out early */
158  return FALSE;
159  }
160 
161  /* The next path elements starts with the remaining path */
162  NextElement->Buffer = RemainingPath->Buffer;
163 
164  /* Loop until the path element ends */
165  while ((RemainingPath->Length >= sizeof(WCHAR)) &&
166  (RemainingPath->Buffer[0] != '\\'))
167  {
168  /* Skip this character */
169  RemainingPath->Buffer++;
170  RemainingPath->Length -= sizeof(WCHAR);
171  }
172 
173  NextElement->Length = (USHORT)(RemainingPath->Buffer - NextElement->Buffer) * sizeof(WCHAR);
174  NextElement->MaximumLength = NextElement->Length;
175 
176  /* Check if the path element ended with a path separator */
177  if (RemainingPath->Length >= sizeof(WCHAR))
178  {
179  /* Skip the path separator */
180  ASSERT(RemainingPath->Buffer[0] == '\\');
181  RemainingPath->Buffer++;
182  RemainingPath->Length -= sizeof(WCHAR);
183  }
184 
185  /* Return whether we got any characters */
186  return TRUE;
187 }
188 
189 #if 0
190 LONG
191 RegEnumKey(
192  _In_ HKEY Key,
193  _In_ ULONG Index,
194  _Out_ PWCHAR Name,
195  _Inout_ PULONG NameSize,
196  _Out_opt_ PHKEY SubKey)
197 {
199  PCM_KEY_NODE KeyNode, SubKeyNode;
200  HCELL_INDEX CellIndex;
201  USHORT NameLength;
202 
203  TRACE("RegEnumKey(%p, %lu, %p, %p->%u)\n",
204  Key, Index, Name, NameSize, NameSize ? *NameSize : 0);
205 
206  /* Get the key node */
207  KeyNode = GET_CM_KEY_NODE(Hive, Key);
208  ASSERT(KeyNode);
210 
211  CellIndex = CmpFindSubKeyByNumber(Hive, KeyNode, Index);
212  if (CellIndex == HCELL_NIL)
213  {
214  TRACE("RegEnumKey index out of bounds (%d) in key (%.*s)\n",
215  Index, KeyNode->NameLength, KeyNode->Name);
216  HvReleaseCell(Hive, HKEY_TO_HCI(Key));
217  return ERROR_NO_MORE_ITEMS;
218  }
219  HvReleaseCell(Hive, HKEY_TO_HCI(Key));
220 
221  /* Get the value cell */
222  SubKeyNode = (PCM_KEY_NODE)HvGetCell(Hive, CellIndex);
223  ASSERT(SubKeyNode != NULL);
224  ASSERT(SubKeyNode->Signature == CM_KEY_NODE_SIGNATURE);
225 
226  if (SubKeyNode->Flags & KEY_COMP_NAME)
227  {
228  NameLength = CmpCompressedNameSize(SubKeyNode->Name, SubKeyNode->NameLength);
229 
230  /* Compressed name */
232  *NameSize,
233  SubKeyNode->Name,
234  SubKeyNode->NameLength);
235  }
236  else
237  {
238  NameLength = SubKeyNode->NameLength;
239 
240  /* Normal name */
241  RtlCopyMemory(Name, SubKeyNode->Name,
242  min(*NameSize, SubKeyNode->NameLength));
243  }
244 
245  if (*NameSize >= NameLength + sizeof(WCHAR))
246  {
247  Name[NameLength / sizeof(WCHAR)] = UNICODE_NULL;
248  }
249 
250  *NameSize = NameLength + sizeof(WCHAR);
251 
252  HvReleaseCell(Hive, CellIndex);
253 
254  if (SubKey != NULL)
255  *SubKey = HCI_TO_HKEY(CellIndex);
256 
257  TRACE("RegEnumKey done -> %u, '%.*S'\n", *NameSize, *NameSize, Name);
258  return ERROR_SUCCESS;
259 }
260 #endif
261 
262 LONG
266  _Out_ PHKEY Key)
267 {
268  UNICODE_STRING RemainingPath, SubKeyName;
269  UNICODE_STRING CurrentControlSet = RTL_CONSTANT_STRING(L"CurrentControlSet");
271  PCM_KEY_NODE KeyNode;
272  HCELL_INDEX CellIndex;
273 
274  TRACE("RegOpenKey(%p, '%S', %p)\n", ParentKey, KeyName, Key);
275 
276  /* Initialize the remaining path name */
277  RtlInitUnicodeString(&RemainingPath, KeyName);
278 
279  /* Check if we have a parent key */
280  if (ParentKey == NULL)
281  {
282  UNICODE_STRING SubKeyName1, SubKeyName2, SubKeyName3;
284  UNICODE_STRING MachinePath = RTL_CONSTANT_STRING(L"MACHINE");
285  UNICODE_STRING SystemPath = RTL_CONSTANT_STRING(L"SYSTEM");
286 
287  TRACE("RegOpenKey: absolute path\n");
288 
289  if ((RemainingPath.Length < sizeof(WCHAR)) ||
290  RemainingPath.Buffer[0] != '\\')
291  {
292  /* The key path is not absolute */
293  ERR("RegOpenKey: invalid path '%S' (%wZ)\n", KeyName, &RemainingPath);
294  return ERROR_PATH_NOT_FOUND;
295  }
296 
297  /* Skip initial path separator */
298  RemainingPath.Buffer++;
299  RemainingPath.Length -= sizeof(WCHAR);
300 
301  /* Get the first 3 path elements */
302  GetNextPathElement(&SubKeyName1, &RemainingPath);
303  GetNextPathElement(&SubKeyName2, &RemainingPath);
304  GetNextPathElement(&SubKeyName3, &RemainingPath);
305  TRACE("RegOpenKey: %wZ / %wZ / %wZ\n", &SubKeyName1, &SubKeyName2, &SubKeyName3);
306 
307  /* Check if we have the correct path */
308  if (!RtlEqualUnicodeString(&SubKeyName1, &RegistryPath, TRUE) ||
309  !RtlEqualUnicodeString(&SubKeyName2, &MachinePath, TRUE) ||
310  !RtlEqualUnicodeString(&SubKeyName3, &SystemPath, TRUE))
311  {
312  /* The key path is not inside HKLM\Machine\System */
313  ERR("RegOpenKey: invalid path '%S' (%wZ)\n", KeyName, &RemainingPath);
314  return ERROR_PATH_NOT_FOUND;
315  }
316 
317  /* Use the root key */
318  CellIndex = SystemRootCell;
319  }
320  else
321  {
322  /* Use the parent key */
323  CellIndex = HKEY_TO_HCI(ParentKey);
324  }
325 
326  /* Check if this is the root key */
327  if (CellIndex == SystemRootCell)
328  {
329  UNICODE_STRING TempPath = RemainingPath;
330 
331  /* Get the first path element */
332  GetNextPathElement(&SubKeyName, &TempPath);
333 
334  /* Check if this is CurrentControlSet */
335  if (RtlEqualUnicodeString(&SubKeyName, &CurrentControlSet, TRUE))
336  {
337  /* Use the CurrentControlSetKey and update the remaining path */
338  CellIndex = HKEY_TO_HCI(CurrentControlSetKey);
339  RemainingPath = TempPath;
340  }
341  }
342 
343  /* Get the key node */
344  KeyNode = (PCM_KEY_NODE)HvGetCell(Hive, CellIndex);
345  ASSERT(KeyNode);
347 
348  TRACE("RegOpenKey: RemainingPath '%wZ'\n", &RemainingPath);
349 
350  /* Loop while there are path elements */
351  while (GetNextPathElement(&SubKeyName, &RemainingPath))
352  {
353  HCELL_INDEX NextCellIndex;
354 
355  TRACE("RegOpenKey: next element '%wZ'\n", &SubKeyName);
356 
357  /* Get the next sub key */
358  NextCellIndex = CmpFindSubKeyByName(Hive, KeyNode, &SubKeyName);
359  HvReleaseCell(Hive, CellIndex);
360  CellIndex = NextCellIndex;
361  if (CellIndex == HCELL_NIL)
362  {
363  WARN("Did not find sub key '%wZ' (full: %S)\n", &SubKeyName, KeyName);
364  return ERROR_PATH_NOT_FOUND;
365  }
366 
367  /* Get the found key */
368  KeyNode = (PCM_KEY_NODE)HvGetCell(Hive, CellIndex);
369  ASSERT(KeyNode);
371  }
372 
373  HvReleaseCell(Hive, CellIndex);
374  *Key = HCI_TO_HKEY(CellIndex);
375 
376  return ERROR_SUCCESS;
377 }
378 
379 static
380 VOID
382  _In_ PHHIVE Hive,
383  _In_ PCM_KEY_VALUE ValueCell,
387 {
389  PVOID DataCell;
390 
391  /* Does the caller want the type? */
392  if (Type != NULL)
393  *Type = ValueCell->Type;
394 
395  /* Does the caller provide DataSize? */
396  if (DataSize != NULL)
397  {
398  // NOTE: CmpValueToData doesn't support big data (the function will
399  // bugcheck if so), FreeLdr is not supposed to read such data.
400  // If big data is needed, use instead CmpGetValueData.
401  // CmpGetValueData(Hive, ValueCell, DataSize, &DataCell, ...);
402  DataCell = CmpValueToData(Hive, ValueCell, &DataLength);
403 
404  /* Does the caller want the data? */
405  if ((Data != NULL) && (*DataSize != 0))
406  {
408  DataCell,
409  min(*DataSize, DataLength));
410  }
411 
412  /* Return the actual data length */
413  *DataSize = DataLength;
414  }
415 }
416 
417 LONG
419  _In_ HKEY Key,
424 {
426  PCM_KEY_NODE KeyNode;
427  PCM_KEY_VALUE ValueCell;
428  HCELL_INDEX CellIndex;
429  UNICODE_STRING ValueNameString;
430 
431  TRACE("RegQueryValue(%p, '%S', %p, %p, %p)\n",
433 
434  /* Get the key node */
435  KeyNode = GET_CM_KEY_NODE(Hive, Key);
436  ASSERT(KeyNode);
438 
439  /* Initialize value name string */
440  RtlInitUnicodeString(&ValueNameString, ValueName);
441  CellIndex = CmpFindValueByName(Hive, KeyNode, &ValueNameString);
442  if (CellIndex == HCELL_NIL)
443  {
444  TRACE("RegQueryValue value not found in key (%.*s)\n",
445  KeyNode->NameLength, KeyNode->Name);
446  HvReleaseCell(Hive, HKEY_TO_HCI(Key));
447  return ERROR_FILE_NOT_FOUND;
448  }
449  HvReleaseCell(Hive, HKEY_TO_HCI(Key));
450 
451  /* Get the value cell */
452  ValueCell = (PCM_KEY_VALUE)HvGetCell(Hive, CellIndex);
453  ASSERT(ValueCell != NULL);
454 
455  RepGetValueData(Hive, ValueCell, Type, Data, DataSize);
456 
457  HvReleaseCell(Hive, CellIndex);
458 
459  return ERROR_SUCCESS;
460 }
461 
462 /*
463  * NOTE: This function is currently unused in FreeLdr; however it is kept here
464  * as an implementation reference of RegEnumValue using CMLIB that may be used
465  * elsewhere in ReactOS.
466  */
467 #if 0
468 LONG
470  _In_ HKEY Key,
471  _In_ ULONG Index,
473  _Inout_ PULONG NameSize,
477 {
479  PCM_KEY_NODE KeyNode;
480  PCELL_DATA ValueListCell;
481  PCM_KEY_VALUE ValueCell;
482  USHORT NameLength;
483 
484  TRACE("RegEnumValue(%p, %lu, %S, %p, %p, %p, %p (%lu))\n",
485  Key, Index, ValueName, NameSize, Type, Data, DataSize, *DataSize);
486 
487  /* Get the key node */
488  KeyNode = GET_CM_KEY_NODE(Hive, Key);
489  ASSERT(KeyNode);
491 
492  /* Check if the index is valid */
493  if ((KeyNode->ValueList.Count == 0) ||
494  (KeyNode->ValueList.List == HCELL_NIL) ||
495  (Index >= KeyNode->ValueList.Count))
496  {
497  ERR("RegEnumValue: index invalid\n");
498  HvReleaseCell(Hive, HKEY_TO_HCI(Key));
499  return ERROR_NO_MORE_ITEMS;
500  }
501 
502  ValueListCell = (PCELL_DATA)HvGetCell(Hive, KeyNode->ValueList.List);
503  ASSERT(ValueListCell != NULL);
504 
505  /* Get the value cell */
506  ValueCell = (PCM_KEY_VALUE)HvGetCell(Hive, ValueListCell->KeyList[Index]);
507  ASSERT(ValueCell != NULL);
508  ASSERT(ValueCell->Signature == CM_KEY_VALUE_SIGNATURE);
509 
510  if (ValueCell->Flags & VALUE_COMP_NAME)
511  {
512  NameLength = CmpCompressedNameSize(ValueCell->Name, ValueCell->NameLength);
513 
514  /* Compressed name */
516  *NameSize,
517  ValueCell->Name,
518  ValueCell->NameLength);
519  }
520  else
521  {
522  NameLength = ValueCell->NameLength;
523 
524  /* Normal name */
525  RtlCopyMemory(ValueName, ValueCell->Name,
526  min(*NameSize, ValueCell->NameLength));
527  }
528 
529  if (*NameSize >= NameLength + sizeof(WCHAR))
530  {
531  ValueName[NameLength / sizeof(WCHAR)] = UNICODE_NULL;
532  }
533 
534  *NameSize = NameLength + sizeof(WCHAR);
535 
536  RepGetValueData(Hive, ValueCell, Type, Data, DataSize);
537 
538  HvReleaseCell(Hive, ValueListCell->KeyList[Index]);
539  HvReleaseCell(Hive, KeyNode->ValueList.List);
540  HvReleaseCell(Hive, HKEY_TO_HCI(Key));
541 
542  TRACE("RegEnumValue done -> %u, '%.*S'\n", *NameSize, *NameSize, ValueName);
543  return ERROR_SUCCESS;
544 }
545 #endif
546 
547 /* EOF */
#define CM_KEY_VALUE_SIGNATURE
Definition: cmdata.h:24
#define KEY_COMP_NAME
Definition: cmdata.h:35
const uint16_t * PCWSTR
Definition: typedefs.h:57
#define IN
Definition: typedefs.h:39
WCHAR Name[ANYSIZE_ARRAY]
Definition: cmdata.h:116
FORCEINLINE VOID FrLdrHeapFree(PVOID MemoryPointer, ULONG Tag)
Definition: mm.h:181
HCELL_INDEX List
Definition: cmdata.h:75
#define _Inout_
Definition: ms_sal.h:378
#define ERROR_SUCCESS
Definition: deptool.c:10
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ PNDIS_STRING SubKeyName
Definition: ndis.h:4723
USHORT Flags
Definition: cmdata.h:129
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:105
#define _Out_
Definition: ms_sal.h:345
#define TRUE
Definition: types.h:120
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
BOOLEAN RegImportBinaryHive(_In_ PVOID ChunkBase, _In_ ULONG ChunkSize)
Definition: registry.c:66
PHBASE_BLOCK BaseBlock
Definition: hivedata.h:303
#define CM_KEY_NODE_SIGNATURE
Definition: cmdata.h:21
VOID NTAPI CmpFree(IN PVOID Ptr, IN ULONG Quota)
Definition: registry.c:57
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)
Definition: hiveinit.c:522
unsigned char * PUCHAR
Definition: retypes.h:3
BOOLEAN RegInitCurrentControlSet(_In_ BOOLEAN LastKnownGood)
Definition: registry.c:112
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
#define WARN(fmt,...)
Definition: debug.h:112
LONG NTSTATUS
Definition: precomp.h:26
LONG RegQueryValue(_In_ HKEY Key, _In_z_ PCWSTR ValueName, _Out_opt_ PULONG Type, _Out_opt_ PUCHAR Data, _Inout_opt_ PULONG DataSize)
Definition: registry.c:418
HCELL_INDEX NTAPI CmpFindSubKeyByNumber(IN PHHIVE Hive, IN PCM_KEY_NODE Node, IN ULONG Number)
Definition: cmindex.c:600
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
Definition: wdfdriver.h:213
#define HCELL_NIL
Definition: hivedata.h:85
PVOID NTAPI CmpAllocate(IN SIZE_T Size, IN BOOLEAN Paged, IN ULONG Tag)
Definition: registry.c:46
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
PHHIVE SystemHive
Definition: registry.c:32
uint16_t * PWCHAR
Definition: typedefs.h:56
USHORT NameLength
Definition: cmdata.h:114
static PCMHIVE CmSystemHive
Definition: registry.c:29
#define HvGetCell(Hive, Cell)
Definition: cmlib.h:381
static HCELL_INDEX SystemRootCell
Definition: registry.c:30
#define L(x)
Definition: ntvdm.h:50
struct _CELL_DATA * PCELL_DATA
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
HKEY CurrentControlSetKey
Definition: registry.c:33
#define FALSE
Definition: types.h:117
#define UNICODE_NULL
USHORT NameLength
Definition: cmdata.h:125
_Inout_ PUCHAR _In_ PUCHAR _Out_ PUCHAR _Out_ PULONG ChunkSize
Definition: rtlfuncs.h:2274
long LONG
Definition: pedump.c:60
VOID NTAPI CmpCopyCompressedName(OUT PWCHAR Destination, IN ULONG DestinationLength, IN PWCHAR Source, IN ULONG SourceLength)
Definition: cmname.c:56
WCHAR Name[ANYSIZE_ARRAY]
Definition: cmdata.h:131
FORCEINLINE PVOID FrLdrTempAlloc(_In_ SIZE_T Size, _In_ ULONG Tag)
Definition: mm.h:188
#define HCI_TO_HKEY(CellIndex)
Definition: registry.c:35
unsigned char BOOLEAN
struct _CM_KEY_NODE * PCM_KEY_NODE
#define _In_
Definition: ms_sal.h:308
#define _In_z_
Definition: ms_sal.h:313
_In_ ULONG _In_opt_ WDFREQUEST _In_opt_ PVOID _In_ size_t _In_ PVOID _In_ size_t _Out_ size_t * DataLength
Definition: cdrom.h:1437
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
Definition: wdfdevice.h:2697
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define HINIT_FLAT
Definition: hivedata.h:17
DBG_DEFAULT_CHANNEL(REGISTRY)
CHILD_LIST ValueList
Definition: cmdata.h:103
Status
Definition: gdiplustypes.h:24
PCELL_DATA NTAPI CmpValueToData(IN PHHIVE Hive, IN PCM_KEY_VALUE Value, OUT PULONG Length)
Definition: cmvalue.c:167
#define RegEnumKey
Definition: winreg.h:509
#define TRACE(s)
Definition: solgame.cpp:4
FORCEINLINE PVOID FrLdrHeapAlloc(SIZE_T MemorySize, ULONG Tag)
Definition: mm.h:174
#define ASSERT(a)
Definition: mode.c:44
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
ULONG HCELL_INDEX
Definition: hivedata.h:80
_In_ WDFCOLLECTION _In_ ULONG Index
#define VALUE_COMP_NAME
Definition: cmdata.h:44
USHORT Signature
Definition: cmdata.h:92
Type
Definition: Type.h:6
HCELL_INDEX KeyList[ANYSIZE_ARRAY]
Definition: cmdata.h:205
USHORT Signature
Definition: cmdata.h:124
#define GET_CM_KEY_NODE(hHive, hKey)
Definition: registry.c:42
#define GET_HHIVE(CmHive)
Definition: registry.c:40
static VOID RepGetValueData(_In_ PHHIVE Hive, _In_ PCM_KEY_VALUE ValueCell, _Out_opt_ PULONG Type, _Out_opt_ PUCHAR Data, _Inout_opt_ PULONG DataSize)
Definition: registry.c:381
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING ValueName
Definition: wdfregistry.h:240
#define _Inout_opt_
Definition: ms_sal.h:379
HCELL_INDEX RootCell
Definition: hivedata.h:143
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN _In_opt_ PVOID Tag
Definition: wdfdevice.h:4061
ULONG Count
Definition: cmdata.h:74
#define GET_HHIVE_FROM_HKEY(hKey)
Definition: registry.c:41
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,...
Definition: cmboot.c:84
#define ERR(fmt,...)
Definition: debug.h:110
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define HvReleaseCell(Hive, Cell)
Definition: cmlib.h:384
_Must_inspect_result_ _In_opt_ WDFKEY ParentKey
Definition: wdfregistry.h:69
unsigned short USHORT
Definition: pedump.c:61
HCELL_INDEX NTAPI CmpFindValueByName(IN PHHIVE Hive, IN PCM_KEY_NODE KeyNode, IN PCUNICODE_STRING Name)
Definition: cmvalue.c:99
struct _CM_KEY_VALUE * PCM_KEY_VALUE
#define _Out_opt_
Definition: ms_sal.h:346
unsigned int * PULONG
Definition: retypes.h:1
#define min(a, b)
Definition: monoChain.cc:55
#define NULL
Definition: types.h:112
unsigned int ULONG
Definition: retypes.h:1
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define ERROR_PATH_NOT_FOUND
Definition: winerror.h:106
HCELL_INDEX NTAPI CmpFindSubKeyByName(IN PHHIVE Hive, IN PCM_KEY_NODE Parent, IN PCUNICODE_STRING SearchName)
Definition: cmindex.c:683
NTSYSAPI BOOLEAN NTAPI RtlEqualUnicodeString(PUNICODE_STRING String1, PUNICODE_STRING String2, BOOLEAN CaseInSensitive)
USHORT NTAPI CmpCompressedNameSize(IN PWCHAR Name, IN ULONG Length)
Definition: cmname.c:95
_In_ NDIS_STATUS _In_ ULONG _In_ USHORT _In_opt_ PVOID _In_ ULONG DataSize
Definition: ndis.h:4751
#define RegEnumValue
Definition: winreg.h:511
#define HKEY_TO_HCI(hKey)
Definition: registry.h:28
LONG RegOpenKey(_In_ HKEY ParentKey, _In_z_ PCWSTR KeyName, _Out_ PHKEY Key)
Definition: registry.c:263
static BOOLEAN GetNextPathElement(_Out_ PUNICODE_STRING NextElement, _Inout_ PUNICODE_STRING RemainingPath)
Definition: registry.c:150
Definition: cmlib.h:244
USHORT Flags
Definition: cmdata.h:93
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
FORCEINLINE VOID FrLdrTempFree(PVOID Allocation, ULONG Tag)
Definition: mm.h:197