ReactOS  0.4.15-dev-3440-g915569a
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 
25 #include <debug.h>
26 DBG_DEFAULT_CHANNEL(REGISTRY);
27 
28 static PCMHIVE CmHive;
31 
32 PVOID
33 NTAPI
35  IN SIZE_T Size,
36  IN BOOLEAN Paged,
37  IN ULONG Tag)
38 {
41 
42  return FrLdrTempAlloc(Size, Tag);
43 }
44 
45 VOID
46 NTAPI
48  IN PVOID Ptr,
49  IN ULONG Quota)
50 {
52  FrLdrTempFree(Ptr, 0);
53 }
54 
55 BOOLEAN
57  _In_ PVOID ChunkBase,
59 {
61 
62  TRACE("RegImportBinaryHive(%p, 0x%lx)\n", ChunkBase, ChunkSize);
63 
64  /* Allocate and initialize the hive */
65  CmHive = CmpAllocate(sizeof(CMHIVE), FALSE, 'eviH');
67  HINIT_FLAT, // HINIT_MEMORY_INPLACE
68  0,
69  0,
70  ChunkBase,
72  CmpFree,
73  NULL,
74  NULL,
75  NULL,
76  NULL,
77  1,
78  NULL);
79  if (!NT_SUCCESS(Status))
80  {
81  ERR("Corrupted hive %p!\n", ChunkBase);
82  CmpFree(CmHive, 0);
83  return FALSE;
84  }
85 
86  /* Save the root key node */
88 
89  TRACE("RegImportBinaryHive done\n");
90  return TRUE;
91 }
92 
93 LONG
95  _In_ BOOLEAN LastKnownGood)
96 {
97  WCHAR ControlSetKeyName[80];
98  HKEY SelectKey;
99  HKEY SystemKey;
100  ULONG CurrentSet = 0;
101  ULONG DefaultSet = 0;
102  ULONG LastKnownGoodSet = 0;
103  ULONG DataSize;
104  LONG Error;
105 
106  TRACE("RegInitCurrentControlSet\n");
107 
109  L"\\Registry\\Machine\\SYSTEM\\Select",
110  &SelectKey);
111  if (Error != ERROR_SUCCESS)
112  {
113  ERR("RegOpenKey() failed (Error %u)\n", (int)Error);
114  return Error;
115  }
116 
117  DataSize = sizeof(ULONG);
118  Error = RegQueryValue(SelectKey,
119  L"Default",
120  NULL,
121  (PUCHAR)&DefaultSet,
122  &DataSize);
123  if (Error != ERROR_SUCCESS)
124  {
125  ERR("RegQueryValue('Default') failed (Error %u)\n", (int)Error);
126  RegCloseKey(SelectKey);
127  return Error;
128  }
129 
130  DataSize = sizeof(ULONG);
131  Error = RegQueryValue(SelectKey,
132  L"LastKnownGood",
133  NULL,
134  (PUCHAR)&LastKnownGoodSet,
135  &DataSize);
136  if (Error != ERROR_SUCCESS)
137  {
138  ERR("RegQueryValue('LastKnownGood') failed (Error %u)\n", (int)Error);
139  RegCloseKey(SelectKey);
140  return Error;
141  }
142 
143  RegCloseKey(SelectKey);
144 
145  CurrentSet = (LastKnownGood) ? LastKnownGoodSet : DefaultSet;
146  wcscpy(ControlSetKeyName, L"ControlSet");
147  switch(CurrentSet)
148  {
149  case 1:
150  wcscat(ControlSetKeyName, L"001");
151  break;
152  case 2:
153  wcscat(ControlSetKeyName, L"002");
154  break;
155  case 3:
156  wcscat(ControlSetKeyName, L"003");
157  break;
158  case 4:
159  wcscat(ControlSetKeyName, L"004");
160  break;
161  case 5:
162  wcscat(ControlSetKeyName, L"005");
163  break;
164  }
165 
167  L"\\Registry\\Machine\\SYSTEM",
168  &SystemKey);
169  if (Error != ERROR_SUCCESS)
170  {
171  ERR("RegOpenKey(SystemKey) failed (Error %lu)\n", Error);
172  return Error;
173  }
174 
175  Error = RegOpenKey(SystemKey,
176  ControlSetKeyName,
178 
179  RegCloseKey(SystemKey);
180 
181  if (Error != ERROR_SUCCESS)
182  {
183  ERR("RegOpenKey(CurrentControlSetKey) failed (Error %lu)\n", Error);
184  return Error;
185  }
186 
187  TRACE("RegInitCurrentControlSet done\n");
188  return ERROR_SUCCESS;
189 }
190 
191 static
192 BOOLEAN
194  _Out_ PUNICODE_STRING NextElement,
195  _Inout_ PUNICODE_STRING RemainingPath)
196 {
197  /* Check if there are any characters left */
198  if (RemainingPath->Length < sizeof(WCHAR))
199  {
200  /* Nothing left, bail out early */
201  return FALSE;
202  }
203 
204  /* The next path elements starts with the remaining path */
205  NextElement->Buffer = RemainingPath->Buffer;
206 
207  /* Loop until the path element ends */
208  while ((RemainingPath->Length >= sizeof(WCHAR)) &&
209  (RemainingPath->Buffer[0] != '\\'))
210  {
211  /* Skip this character */
212  RemainingPath->Buffer++;
213  RemainingPath->Length -= sizeof(WCHAR);
214  }
215 
216  NextElement->Length = (USHORT)(RemainingPath->Buffer - NextElement->Buffer) * sizeof(WCHAR);
217  NextElement->MaximumLength = NextElement->Length;
218 
219  /* Check if the path element ended with a path separator */
220  if (RemainingPath->Length >= sizeof(WCHAR))
221  {
222  /* Skip the path separator */
223  ASSERT(RemainingPath->Buffer[0] == '\\');
224  RemainingPath->Buffer++;
225  RemainingPath->Length -= sizeof(WCHAR);
226  }
227 
228  /* Return whether we got any characters */
229  return TRUE;
230 }
231 
232 LONG
234  _In_ HKEY Key,
235  _In_ ULONG Index,
236  _Out_ PWCHAR Name,
237  _Inout_ PULONG NameSize,
238  _Out_opt_ PHKEY SubKey)
239 {
240  PHHIVE Hive = &CmHive->Hive;
241  PCM_KEY_NODE KeyNode, SubKeyNode;
242  HCELL_INDEX CellIndex;
243  USHORT NameLength;
244 
245  TRACE("RegEnumKey(%p, %lu, %p, %p->%u)\n",
246  Key, Index, Name, NameSize, NameSize ? *NameSize : 0);
247 
248  /* Get the key node */
249  KeyNode = (PCM_KEY_NODE)Key;
251 
252  CellIndex = CmpFindSubKeyByNumber(Hive, KeyNode, Index);
253  if (CellIndex == HCELL_NIL)
254  {
255  TRACE("RegEnumKey index out of bounds (%d) in key (%.*s)\n",
256  Index, KeyNode->NameLength, KeyNode->Name);
257  return ERROR_NO_MORE_ITEMS;
258  }
259 
260  /* Get the value cell */
261  SubKeyNode = (PCM_KEY_NODE)HvGetCell(Hive, CellIndex);
262  ASSERT(SubKeyNode != NULL);
263  ASSERT(SubKeyNode->Signature == CM_KEY_NODE_SIGNATURE);
264 
265  if (SubKeyNode->Flags & KEY_COMP_NAME)
266  {
267  NameLength = CmpCompressedNameSize(SubKeyNode->Name, SubKeyNode->NameLength);
268 
269  /* Compressed name */
271  *NameSize,
272  SubKeyNode->Name,
273  SubKeyNode->NameLength);
274  }
275  else
276  {
277  NameLength = SubKeyNode->NameLength;
278 
279  /* Normal name */
280  RtlCopyMemory(Name, SubKeyNode->Name,
281  min(*NameSize, SubKeyNode->NameLength));
282  }
283 
284  if (*NameSize >= NameLength + sizeof(WCHAR))
285  {
286  Name[NameLength / sizeof(WCHAR)] = UNICODE_NULL;
287  }
288 
289  *NameSize = NameLength + sizeof(WCHAR);
290 
291  HvReleaseCell(Hive, CellIndex);
292 
293  if (SubKey != NULL)
294  *SubKey = (HKEY)SubKeyNode;
295  // else
296  // RegCloseKey((HKEY)SubKeyNode);
297 
298  TRACE("RegEnumKey done -> %u, '%.*S'\n", *NameSize, *NameSize, Name);
299  return ERROR_SUCCESS;
300 }
301 
302 LONG
306  _Out_ PHKEY Key)
307 {
308  UNICODE_STRING RemainingPath, SubKeyName;
309  UNICODE_STRING CurrentControlSet = RTL_CONSTANT_STRING(L"CurrentControlSet");
310  PHHIVE Hive = &CmHive->Hive;
311  PCM_KEY_NODE KeyNode;
312  HCELL_INDEX CellIndex;
313 
314  TRACE("RegOpenKey(%p, '%S', %p)\n", ParentKey, KeyName, Key);
315 
316  /* Initialize the remaining path name */
317  RtlInitUnicodeString(&RemainingPath, KeyName);
318 
319  /* Get the parent key node */
320  KeyNode = (PCM_KEY_NODE)ParentKey;
321 
322  /* Check if we have a parent key */
323  if (KeyNode == NULL)
324  {
325  UNICODE_STRING SubKeyName1, SubKeyName2, SubKeyName3;
327  UNICODE_STRING MachinePath = RTL_CONSTANT_STRING(L"MACHINE");
328  UNICODE_STRING SystemPath = RTL_CONSTANT_STRING(L"SYSTEM");
329 
330  TRACE("RegOpenKey: absolute path\n");
331 
332  if ((RemainingPath.Length < sizeof(WCHAR)) ||
333  RemainingPath.Buffer[0] != '\\')
334  {
335  /* The key path is not absolute */
336  ERR("RegOpenKey: invalid path '%S' (%wZ)\n", KeyName, &RemainingPath);
337  return ERROR_PATH_NOT_FOUND;
338  }
339 
340  /* Skip initial path separator */
341  RemainingPath.Buffer++;
342  RemainingPath.Length -= sizeof(WCHAR);
343 
344  /* Get the first 3 path elements */
345  GetNextPathElement(&SubKeyName1, &RemainingPath);
346  GetNextPathElement(&SubKeyName2, &RemainingPath);
347  GetNextPathElement(&SubKeyName3, &RemainingPath);
348  TRACE("RegOpenKey: %wZ / %wZ / %wZ\n", &SubKeyName1, &SubKeyName2, &SubKeyName3);
349 
350  /* Check if we have the correct path */
351  if (!RtlEqualUnicodeString(&SubKeyName1, &RegistryPath, TRUE) ||
352  !RtlEqualUnicodeString(&SubKeyName2, &MachinePath, TRUE) ||
353  !RtlEqualUnicodeString(&SubKeyName3, &SystemPath, TRUE))
354  {
355  /* The key path is not inside HKLM\Machine\System */
356  ERR("RegOpenKey: invalid path '%S' (%wZ)\n", KeyName, &RemainingPath);
357  return ERROR_PATH_NOT_FOUND;
358  }
359 
360  /* Use the root key */
361  KeyNode = RootKeyNode;
362  }
363 
365 
366  /* Check if this is the root key */
367  if (KeyNode == RootKeyNode)
368  {
369  UNICODE_STRING TempPath = RemainingPath;
370 
371  /* Get the first path element */
372  GetNextPathElement(&SubKeyName, &TempPath);
373 
374  /* Check if this is CurrentControlSet */
375  if (RtlEqualUnicodeString(&SubKeyName, &CurrentControlSet, TRUE))
376  {
377  /* Use the CurrentControlSetKey and update the remaining path */
379  RemainingPath = TempPath;
380  }
381  }
382 
383  TRACE("RegOpenKey: RemainingPath '%wZ'\n", &RemainingPath);
384 
385  /* Loop while there are path elements */
386  while (GetNextPathElement(&SubKeyName, &RemainingPath))
387  {
388  TRACE("RegOpenKey: next element '%wZ'\n", &SubKeyName);
389 
390  /* Get the next sub key */
391  CellIndex = CmpFindSubKeyByName(Hive, KeyNode, &SubKeyName);
392  if (CellIndex == HCELL_NIL)
393  {
394  ERR("Did not find sub key '%wZ' (full %S)\n", &SubKeyName, KeyName);
395  return ERROR_PATH_NOT_FOUND;
396  }
397 
398  /* Get the found key */
399  KeyNode = (PCM_KEY_NODE)HvGetCell(Hive, CellIndex);
400  ASSERT(KeyNode);
401  }
402 
403  *Key = (HKEY)KeyNode;
404 
405  TRACE("RegOpenKey done\n");
406  return ERROR_SUCCESS;
407 }
408 
409 static
410 VOID
412  _In_ PHHIVE Hive,
413  _In_ PCM_KEY_VALUE ValueCell,
417 {
419  PVOID DataCell;
420 
421  /* Does the caller want the type? */
422  if (Type != NULL)
423  *Type = ValueCell->Type;
424 
425  /* Does the caller provide DataSize? */
426  if (DataSize != NULL)
427  {
428  // NOTE: CmpValueToData doesn't support big data (the function will
429  // bugcheck if so), FreeLdr is not supposed to read such data.
430  // If big data is needed, use instead CmpGetValueData.
431  // CmpGetValueData(Hive, ValueCell, DataSize, &DataCell, ...);
432  DataCell = CmpValueToData(Hive, ValueCell, &DataLength);
433 
434  /* Does the caller want the data? */
435  if ((Data != NULL) && (*DataSize != 0))
436  {
438  DataCell,
439  min(*DataSize, DataLength));
440  }
441 
442  /* Return the actual data length */
443  *DataSize = DataLength;
444  }
445 }
446 
447 LONG
449  _In_ HKEY Key,
454 {
455  PHHIVE Hive = &CmHive->Hive;
456  PCM_KEY_NODE KeyNode;
457  PCM_KEY_VALUE ValueCell;
458  HCELL_INDEX CellIndex;
459  UNICODE_STRING ValueNameString;
460 
461  TRACE("RegQueryValue(%p, '%S', %p, %p, %p)\n",
463 
464  /* Get the key node */
465  KeyNode = (PCM_KEY_NODE)Key;
467 
468  /* Initialize value name string */
469  RtlInitUnicodeString(&ValueNameString, ValueName);
470  CellIndex = CmpFindValueByName(Hive, KeyNode, &ValueNameString);
471  if (CellIndex == HCELL_NIL)
472  {
473  TRACE("RegQueryValue value not found in key (%.*s)\n",
474  KeyNode->NameLength, KeyNode->Name);
475  return ERROR_FILE_NOT_FOUND;
476  }
477 
478  /* Get the value cell */
479  ValueCell = (PCM_KEY_VALUE)HvGetCell(Hive, CellIndex);
480  ASSERT(ValueCell != NULL);
481 
482  RepGetValueData(Hive, ValueCell, Type, Data, DataSize);
483 
484  HvReleaseCell(Hive, CellIndex);
485 
486  TRACE("RegQueryValue success\n");
487  return ERROR_SUCCESS;
488 }
489 
490 /*
491  * NOTE: This function is currently unused in FreeLdr; however it is kept here
492  * as an implementation reference of RegEnumValue using CMLIB that may be used
493  * elsewhere in ReactOS.
494  */
495 #if 0
496 LONG
498  _In_ HKEY Key,
499  _In_ ULONG Index,
501  _Inout_ PULONG NameSize,
505 {
506  PHHIVE Hive = &CmHive->Hive;
507  PCM_KEY_NODE KeyNode;
508  PCELL_DATA ValueListCell;
509  PCM_KEY_VALUE ValueCell;
510  USHORT NameLength;
511 
512  TRACE("RegEnumValue(%p, %lu, %S, %p, %p, %p, %p (%lu))\n",
513  Key, Index, ValueName, NameSize, Type, Data, DataSize, *DataSize);
514 
515  /* Get the key node */
516  KeyNode = (PCM_KEY_NODE)Key;
518 
519  /* Check if the index is valid */
520  if ((KeyNode->ValueList.Count == 0) ||
521  (KeyNode->ValueList.List == HCELL_NIL) ||
522  (Index >= KeyNode->ValueList.Count))
523  {
524  ERR("RegEnumValue: index invalid\n");
525  return ERROR_NO_MORE_ITEMS;
526  }
527 
528  ValueListCell = (PCELL_DATA)HvGetCell(Hive, KeyNode->ValueList.List);
529  ASSERT(ValueListCell != NULL);
530 
531  /* Get the value cell */
532  ValueCell = (PCM_KEY_VALUE)HvGetCell(Hive, ValueListCell->KeyList[Index]);
533  ASSERT(ValueCell != NULL);
534  ASSERT(ValueCell->Signature == CM_KEY_VALUE_SIGNATURE);
535 
536  if (ValueCell->Flags & VALUE_COMP_NAME)
537  {
538  NameLength = CmpCompressedNameSize(ValueCell->Name, ValueCell->NameLength);
539 
540  /* Compressed name */
542  *NameSize,
543  ValueCell->Name,
544  ValueCell->NameLength);
545  }
546  else
547  {
548  NameLength = ValueCell->NameLength;
549 
550  /* Normal name */
551  RtlCopyMemory(ValueName, ValueCell->Name,
552  min(*NameSize, ValueCell->NameLength));
553  }
554 
555  if (*NameSize >= NameLength + sizeof(WCHAR))
556  {
557  ValueName[NameLength / sizeof(WCHAR)] = UNICODE_NULL;
558  }
559 
560  *NameSize = NameLength + sizeof(WCHAR);
561 
562  RepGetValueData(Hive, ValueCell, Type, Data, DataSize);
563 
564  HvReleaseCell(Hive, ValueListCell->KeyList[Index]);
565  HvReleaseCell(Hive, KeyNode->ValueList.List);
566 
567  TRACE("RegEnumValue done -> %u, '%.*S'\n", *NameSize, *NameSize, ValueName);
568  return ERROR_SUCCESS;
569 }
570 #endif
571 
572 /* EOF */
#define CM_KEY_VALUE_SIGNATURE
Definition: cmdata.h:24
LONG WINAPI RegCloseKey(IN HKEY hKey)
Definition: registry.c:512
#define KEY_COMP_NAME
Definition: cmdata.h:35
const uint16_t * PCWSTR
Definition: typedefs.h:57
#define IN
Definition: typedefs.h:39
static PCM_KEY_NODE RootKeyNode
Definition: registry.c:29
WCHAR Name[ANYSIZE_ARRAY]
Definition: cmdata.h:116
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:56
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:47
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
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
#define HvReleaseCell(h, c)
Definition: cmlib.h:392
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:448
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:34
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
uint16_t * PWCHAR
Definition: typedefs.h:56
USHORT NameLength
Definition: cmdata.h:114
LONG RegEnumKey(_In_ HKEY Key, _In_ ULONG Index, _Out_ PWCHAR Name, _Inout_ PULONG NameSize, _Out_opt_ PHKEY SubKey)
Definition: registry.c:233
LONG RegInitCurrentControlSet(_In_ BOOLEAN LastKnownGood)
Definition: registry.c:94
#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
static HKEY CurrentControlSetKey
Definition: registry.c:30
#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
PVOID CMAPI HvGetCell(PHHIVE RegistryHive, HCELL_INDEX CellOffset)
Definition: hivecell.c:67
WCHAR Name[ANYSIZE_ARRAY]
Definition: cmdata.h:131
FORCEINLINE PVOID FrLdrTempAlloc(_In_ SIZE_T Size, _In_ ULONG Tag)
Definition: mm.h:188
unsigned char BOOLEAN
struct _CM_KEY_NODE * PCM_KEY_NODE
#define _In_
Definition: ms_sal.h:308
HHIVE Hive
Definition: cm.h:394
#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 TRACE(s)
Definition: solgame.cpp:4
HCELL_INDEX NTAPI CmpFindValueByName(IN PHHIVE Hive, IN PCM_KEY_NODE KeyNode, IN PUNICODE_STRING Name)
Definition: cmvalue.c:99
#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
BOOL Error
Definition: chkdsk.c:66
HCELL_INDEX KeyList[ANYSIZE_ARRAY]
Definition: cmdata.h:205
USHORT Signature
Definition: cmdata.h:124
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:411
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING ValueName
Definition: wdfregistry.h:240
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
#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 ERR(fmt,...)
Definition: debug.h:110
ULONG_PTR SIZE_T
Definition: typedefs.h:80
_Must_inspect_result_ _In_opt_ WDFKEY ParentKey
Definition: wdfregistry.h:69
unsigned short USHORT
Definition: pedump.c:61
struct _CM_KEY_VALUE * PCM_KEY_VALUE
static PCMHIVE CmHive
Definition: registry.c:28
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
#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
static const char HKEY
Definition: registry.c:45
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
LONG RegOpenKey(_In_ HKEY ParentKey, _In_z_ PCWSTR KeyName, _Out_ PHKEY Key)
Definition: registry.c:303
static BOOLEAN GetNextPathElement(_Out_ PUNICODE_STRING NextElement, _Inout_ PUNICODE_STRING RemainingPath)
Definition: registry.c:193
Definition: cm.h:392
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