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