ReactOS  0.4.15-dev-4869-g35a816a
cmlib.h
Go to the documentation of this file.
1 /*
2  * PROJECT: Registry manipulation library
3  * LICENSE: GPL - See COPYING in the top level directory
4  * COPYRIGHT: Copyright 2005 Filip Navara <navaraf@reactos.org>
5  * Copyright 2001 - 2005 Eric Kohl
6  */
7 
8 #ifndef _CMLIB_H_
9 #define _CMLIB_H_
10 
11 //
12 // Debug support switch
13 //
14 #define _CMLIB_DEBUG_ 1
15 
16 #ifdef CMLIB_HOST
17  #include <typedefs.h>
18  #include <stdio.h>
19  #include <string.h>
20 
21  // NTDDI_xxx versions we allude to in the library (see psdk/sdkddkver.h)
22  #define NTDDI_WS03SP4 0x05020400
23  #define NTDDI_WIN6 0x06000000
24  #define NTDDI_LONGHORN NTDDI_WIN6
25  #define NTDDI_VISTA NTDDI_WIN6
26  #define NTDDI_WIN7 0x06010000
27 
28  #define NTDDI_VERSION NTDDI_WS03SP4 // This is the ReactOS NT kernel version
29 
30  /* C_ASSERT Definition */
31  #define C_ASSERT(expr) extern char (*c_assert(void)) [(expr) ? 1 : -1]
32 
33  #ifdef _WIN32
34  #define strncasecmp _strnicmp
35  #define strcasecmp _stricmp
36  #endif // _WIN32
37 
38  #if (!defined(_MSC_VER) || (_MSC_VER < 1500))
39  #define _In_
40  #define _Out_
41  #define _Inout_
42  #define _In_opt_
43  #define _In_range_(x, y)
44  #endif
45 
46  #define __drv_aliasesMem
47 
48  #ifndef min
49  #define min(a, b) (((a) < (b)) ? (a) : (b))
50  #endif
51 
52  // #ifndef max
53  // #define max(a, b) (((a) > (b)) ? (a) : (b))
54  // #endif
55 
56  // Definitions copied from <ntstatus.h>
57  // We only want to include host headers, so we define them manually
58  #define STATUS_SUCCESS ((NTSTATUS)0x00000000)
59  #define STATUS_NOT_IMPLEMENTED ((NTSTATUS)0xC0000002)
60  #define STATUS_NO_MEMORY ((NTSTATUS)0xC0000017)
61  #define STATUS_INSUFFICIENT_RESOURCES ((NTSTATUS)0xC000009A)
62  #define STATUS_REGISTRY_CORRUPT ((NTSTATUS)0xC000014C)
63  #define STATUS_NOT_REGISTRY_FILE ((NTSTATUS)0xC000015C)
64  #define STATUS_REGISTRY_RECOVERED ((NTSTATUS)0x40000009)
65 
66  #define REG_OPTION_VOLATILE 1
67  #define OBJ_CASE_INSENSITIVE 0x00000040L
68  #define USHORT_MAX USHRT_MAX
69 
70  #define OBJ_NAME_PATH_SEPARATOR ((WCHAR)L'\\')
71  #define UNICODE_NULL ((WCHAR)0)
72 
73  VOID NTAPI
77 
78  LONG NTAPI
80  IN PCUNICODE_STRING String1,
83 
84  // FIXME: DECLSPEC_NORETURN
85  VOID
86  NTAPI
88  IN ULONG BugCheckCode,
89  IN ULONG_PTR BugCheckParameter1,
90  IN ULONG_PTR BugCheckParameter2,
91  IN ULONG_PTR BugCheckParameter3,
92  IN ULONG_PTR BugCheckParameter4);
93 
94  VOID NTAPI
96  OUT PLARGE_INTEGER CurrentTime);
97 
98  WCHAR NTAPI
100  IN WCHAR Source);
101 
102  VOID NTAPI
104  IN PRTL_BITMAP BitMapHeader,
105  IN PULONG BitMapBuffer,
106  IN ULONG SizeOfBitMap);
107 
108  ULONG NTAPI
110  IN PRTL_BITMAP BitMapHeader,
112  IN ULONG HintIndex);
113 
114  VOID NTAPI
115  RtlSetBits(
116  IN PRTL_BITMAP BitMapHeader,
118  IN ULONG NumberToSet);
119 
120  VOID NTAPI
122  IN PRTL_BITMAP BitMapHeader);
123 
124  #define RtlCheckBit(BMH,BP) (((((PLONG)(BMH)->Buffer)[(BP) / 32]) >> ((BP) % 32)) & 0x1)
125  #define UNREFERENCED_PARAMETER(P) {(P)=(P);}
126 
127  #define PKTHREAD PVOID
128  #define PKGUARDED_MUTEX PVOID
129  #define PERESOURCE PVOID
130  #define PFILE_OBJECT PVOID
131  #define PKEVENT PVOID
132  #define PWORK_QUEUE_ITEM PVOID
133  #define EX_PUSH_LOCK PULONG_PTR
134 
135  // Definitions copied from <ntifs.h>
136  // We only want to include host headers, so we define them manually
137 
139 
140  typedef struct _SECURITY_DESCRIPTOR_RELATIVE
141  {
142  UCHAR Revision;
143  UCHAR Sbz1;
145  ULONG Owner;
146  ULONG Group;
147  ULONG Sacl;
148  ULONG Dacl;
150 
151  #define CMLTRACE(x, ...)
152  #undef PAGED_CODE
153  #define PAGED_CODE()
154  #define REGISTRY_ERROR ((ULONG)0x00000051L)
155 #else
156  //
157  // Debug/Tracing support
158  //
159  #if _CMLIB_DEBUG_
160  #ifdef NEW_DEBUG_SYSTEM_IMPLEMENTED // enable when Debug Filters are implemented
161  #define CMLTRACE DbgPrintEx
162  #else
163  #define CMLTRACE(x, ...) \
164  if (x & CmlibTraceLevel) DbgPrint(__VA_ARGS__)
165  #endif
166  #else
167  #define CMLTRACE(x, ...) DPRINT(__VA_ARGS__)
168  #endif
169 
170  #include <ntdef.h>
171  #include <ntifs.h>
172  #include <bugcodes.h>
173  #undef PAGED_CODE
174  #define PAGED_CODE()
175 
176  /* Prevent inclusion of Windows headers through <wine/unicode.h> */
177  #define _WINDEF_
178  #define _WINBASE_
179  #define _WINNLS_
180 #endif
181 
182 
183 //
184 // These define the Debug Masks Supported
185 //
186 #define CMLIB_HCELL_DEBUG 0x01
187 
188 #ifndef ROUND_UP
189 #define ROUND_UP(a,b) ((((a)+(b)-1)/(b))*(b))
190 #define ROUND_DOWN(a,b) (((a)/(b))*(b))
191 #endif
192 
193 //
194 // PAGE_SIZE definition
195 //
196 #ifndef PAGE_SIZE
197 #if defined(TARGET_i386) || defined(TARGET_amd64) || \
198  defined(TARGET_arm) || defined(TARGET_arm64)
199 #define PAGE_SIZE 0x1000
200 #else
201 #error Local PAGE_SIZE definition required when built as host
202 #endif
203 #endif
204 
205 #define TAG_CM ' MC'
206 #define TAG_KCB 'bkMC'
207 #define TAG_CMHIVE 'vHMC'
208 #define TAG_CMSD 'DSMC'
209 
210 #define CMAPI NTAPI
211 
212 #include <wine/unicode.h>
213 #include <wchar.h>
214 #include "hivedata.h"
215 #include "cmdata.h"
216 
217 #if defined(_TYPEDEFS_HOST_H) || defined(_BLDR_)
218 
219 #define PCM_KEY_SECURITY_CACHE_ENTRY PVOID
220 #define PCM_KEY_CONTROL_BLOCK PVOID
221 #define PCM_CELL_REMAP_BLOCK PVOID
222 
223 // See also ntoskrnl/include/internal/cm.h
224 #define CMP_SECURITY_HASH_LISTS 64
225 
226 // #endif // Commented out until one finds a way to properly include
227  // this header in the bootloader and in ntoskrnl.
228 
229 //
230 // Use Count Log and Entry
231 //
232 typedef struct _CM_USE_COUNT_LOG_ENTRY
233 {
235  PVOID Stack[7];
237 
238 typedef struct _CM_USE_COUNT_LOG
239 {
240  USHORT Next;
241  USHORT Size;
244 
245 //
246 // Configuration Manager Hive Structure
247 //
248 typedef struct _CMHIVE
249 {
250  HHIVE Hive;
270  ULONG UseCount;
278  BOOLEAN Frozen;
287  ULONG Flags;
292 } CMHIVE, *PCMHIVE;
293 
294 #endif // See comment above
295 
296 typedef struct _HV_HIVE_CELL_PAIR
297 {
301 
302 #define STATIC_CELL_PAIR_COUNT 4
303 typedef struct _HV_TRACK_CELL_REF
304 {
311 
312 extern ULONG CmlibTraceLevel;
313 
314 //
315 // Hack since bigkeys are not yet supported
316 //
317 #define ASSERT_VALUE_BIG(h, s) \
318  ASSERTMSG("Big keys not supported!\n", !CmpIsKeyValueBig(h, s));
319 
320 //
321 // Returns whether or not this is a small valued key
322 //
323 static inline
324 BOOLEAN
326  IN ULONG Length)
327 {
328  /* Check if the length has the special size value */
330  {
331  /* It does, so this is a small key: return the real length */
332  *RealLength = Length - CM_KEY_VALUE_SPECIAL_SIZE;
333  return TRUE;
334  }
335 
336  /* This is not a small key, return the length we read */
337  *RealLength = Length;
338  return FALSE;
339 }
340 
341 //
342 // Returns whether or not this is a big valued key
343 //
344 static inline
345 BOOLEAN
347  IN ULONG Length)
348 {
349  /* Check if the hive is XP Beta 1 or newer */
350  if (Hive->Version >= HSYS_WHISTLER_BETA1)
351  {
352  /* Check if the key length is valid for a big value key */
354  {
355  /* Yes, this value is big */
356  return TRUE;
357  }
358  }
359 
360  /* Not a big value key */
361  return FALSE;
362 }
363 
364 /*
365  * Public Hive functions.
366  */
369  PHHIVE RegistryHive,
370  ULONG OperationType,
371  ULONG HiveFlags,
372  ULONG FileType,
373  PVOID HiveData OPTIONAL,
376  PFILE_SET_SIZE_ROUTINE FileSetSize,
377  PFILE_WRITE_ROUTINE FileWrite,
378  PFILE_READ_ROUTINE FileRead,
379  PFILE_FLUSH_ROUTINE FileFlush,
380  ULONG Cluster OPTIONAL,
382 
383 VOID CMAPI
384 HvFree(
385  PHHIVE RegistryHive);
386 
387 #define HvGetCell(Hive, Cell) \
388  (Hive)->GetCellRoutine(Hive, Cell)
389 
390 #define HvReleaseCell(Hive, Cell) \
391 do { \
392  if ((Hive)->ReleaseCellRoutine) \
393  (Hive)->ReleaseCellRoutine(Hive, Cell); \
394 } while(0)
395 
396 LONG CMAPI
398  PHHIVE RegistryHive,
399  PVOID Cell);
400 
403  PHHIVE RegistryHive,
404  ULONG Size,
406  IN HCELL_INDEX Vicinity);
407 
410  IN PHHIVE RegistryHive,
411  IN HCELL_INDEX CellIndex
412 );
413 
416  PHHIVE RegistryHive,
417  HCELL_INDEX CellOffset,
418  ULONG Size);
419 
420 VOID CMAPI
421 HvFreeCell(
422  PHHIVE RegistryHive,
423  HCELL_INDEX CellOffset);
424 
427  PHHIVE RegistryHive,
428  HCELL_INDEX CellOffset,
429  BOOLEAN HoldingLock);
430 
433  IN PHHIVE Hive,
434  IN HCELL_INDEX Cell
435 );
436 
437 BOOLEAN
438 CMAPI
440  IN PHHIVE RegistryHive
441 );
442 
444 HvSyncHive(
445  PHHIVE RegistryHive);
446 
449  PHHIVE RegistryHive);
450 
451 BOOLEAN
452 CMAPI
454  IN OUT PHV_TRACK_CELL_REF CellRef,
455  IN PHHIVE Hive,
456  IN HCELL_INDEX Cell
457 );
458 
459 VOID
460 CMAPI
462  IN OUT PHV_TRACK_CELL_REF CellRef
463 );
464 
465 /*
466  * Private functions.
467  */
468 
471  _In_ PHHIVE Hive,
472  _In_ HCELL_INDEX CellIndex);
473 
474 PHBIN CMAPI
475 HvpAddBin(
476  PHHIVE RegistryHive,
477  ULONG Size,
479 
482  PHHIVE Hive);
483 
484 ULONG CMAPI
486  PHBASE_BLOCK HiveHeader);
487 
488 
489 /* Old-style Public "Cmlib" functions */
490 
493  PHHIVE Hive,
494  PCWSTR Name);
495 
496 VOID CMAPI
498  PHHIVE RegistryHive);
499 
500 
501 /* NT-style Public Cm functions */
502 
503 //
504 // Cell Index Routines
505 //
507 NTAPI
509  IN PHHIVE Hive,
511  IN PCUNICODE_STRING SearchName
512 );
513 
515 NTAPI
517  IN PHHIVE Hive,
519  IN ULONG Number
520 );
521 
522 ULONG
523 NTAPI
525  IN ULONG Hash,
527  IN BOOLEAN AllowSeparators
528 );
529 
530 BOOLEAN
531 NTAPI
533  IN PHHIVE Hive,
536 );
537 
538 BOOLEAN
539 NTAPI
541  IN PHHIVE Hive,
543  IN HCELL_INDEX TargetKey
544 );
545 
546 BOOLEAN
547 NTAPI
549  IN PHHIVE Hive,
551  HCELL_INDEX TargetKey
552 );
553 
554 
555 //
556 // Name Functions
557 //
558 LONG
559 NTAPI
561  IN PCUNICODE_STRING SearchName,
562  IN PWCHAR CompressedName,
563  IN ULONG NameLength
564 );
565 
566 USHORT
567 NTAPI
569  IN PHHIVE Hive,
571 );
572 
573 USHORT
574 NTAPI
576  IN PWCHAR Name,
577  IN ULONG Length
578 );
579 
580 USHORT
581 NTAPI
583  IN PHHIVE Hive,
586 );
587 
588 VOID
589 NTAPI
592  IN ULONG DestinationLength,
593  IN PWCHAR Source,
594  IN ULONG SourceLength
595 );
596 
597 BOOLEAN
598 NTAPI
600  IN PHHIVE Hive,
603  OUT PULONG ChildIndex OPTIONAL,
604  OUT PHCELL_INDEX CellIndex
605 );
606 
607 
608 //
609 // Cell Value Routines
610 //
612 NTAPI
614  IN PHHIVE Hive,
615  IN PCM_KEY_NODE KeyNode,
617 );
618 
620 NTAPI
622  IN PHHIVE Hive,
625 );
626 
627 NTSTATUS
628 NTAPI
630  IN PHHIVE Hive,
631  IN PVOID Data,
632  IN ULONG DataSize,
633  IN HSTORAGE_TYPE StorageType,
634  IN HCELL_INDEX ValueCell,
635  OUT PHCELL_INDEX DataCell
636 );
637 
638 NTSTATUS
639 NTAPI
641  IN PHHIVE Hive,
642  IN HCELL_INDEX ValueCell,
643  IN ULONG Index,
644  IN HSTORAGE_TYPE StorageType,
646 );
647 
648 BOOLEAN
649 NTAPI
651  IN PHHIVE Hive,
652  IN HCELL_INDEX Cell
653 );
654 
655 BOOLEAN
656 NTAPI
658  IN PHHIVE Hive,
660 );
661 
662 BOOLEAN
663 NTAPI
665  IN PHHIVE Hive,
666  IN HCELL_INDEX DataCell,
668 );
669 
670 NTSTATUS
671 NTAPI
673  IN PHHIVE Hive,
674  IN ULONG Index,
676 );
677 
678 BOOLEAN
679 NTAPI
681  IN PHHIVE Hive,
683  OUT PULONG Length,
684  OUT PVOID *Buffer,
685  OUT PBOOLEAN BufferAllocated,
686  OUT PHCELL_INDEX CellToRelease
687 );
688 
689 NTSTATUS
690 NTAPI
692  IN PHHIVE SourceHive,
693  IN PCHILD_LIST SrcValueList,
694  IN PHHIVE DestinationHive,
695  IN OUT PCHILD_LIST DestValueList,
696  IN HSTORAGE_TYPE StorageType
697 );
698 
699 NTSTATUS
700 NTAPI
702  IN PHHIVE Hive,
703  IN HCELL_INDEX Cell,
705 );
706 
707 VOID
708 NTAPI
710  IN PHHIVE Hive,
711  IN HCELL_INDEX SecurityCell
712 );
713 
714 VOID
715 NTAPI
717  IN PHHIVE Hive,
718  IN HCELL_INDEX Cell
719 );
720 
721 /******************************************************************************/
722 
723 /* To be implemented by the user of this library */
724 PVOID
725 NTAPI
727  IN SIZE_T Size,
728  IN BOOLEAN Paged,
729  IN ULONG Tag
730 );
731 
732 VOID
733 NTAPI
734 CmpFree(
735  IN PVOID Ptr,
736  IN ULONG Quota
737 );
738 
739 #endif /* _CMLIB_H_ */
#define KeQuerySystemTime(t)
Definition: env_spec_w32.h:570
PKGUARDED_MUTEX ViewLock
Definition: cm.h:403
static int Hash(const char *)
Definition: reader.c:2257
BOOLEAN CMAPI HvIsCellDirty(IN PHHIVE Hive, IN HCELL_INDEX Cell)
Definition: hivecell.c:125
LIST_ENTRY TrustClassEntry
Definition: cm.h:435
const uint16_t * PCWSTR
Definition: typedefs.h:57
#define IN
Definition: typedefs.h:39
struct _CMHIVE * PCMHIVE
PWORK_QUEUE_ITEM UnloadWorkItem
Definition: cm.h:426
PHBIN CMAPI HvpAddBin(PHHIVE RegistryHive, ULONG Size, HSTORAGE_TYPE Storage)
Definition: hivebin.c:12
struct _CM_USE_COUNT_LOG * PCM_USE_COUNT_LOG
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
VOID NTAPI CmpFree(IN PVOID Ptr, IN ULONG Quota)
Definition: registry.c:57
WORD * PSECURITY_DESCRIPTOR_CONTROL
Definition: lsa.idl:37
BOOLEAN(CMAPI * PFILE_SET_SIZE_ROUTINE)(struct _HHIVE *RegistryHive, ULONG FileType, ULONG FileSize, ULONG OldfileSize)
Definition: hivedata.h:241
ULONG NTAPI CmpComputeHashKey(IN ULONG Hash, IN PCUNICODE_STRING Name, IN BOOLEAN AllowSeparators)
Definition: cmindex.c:460
BOOLEAN CMAPI HvIsCellAllocated(IN PHHIVE RegistryHive, IN HCELL_INDEX CellIndex)
Definition: hivecell.c:43
#define TRUE
Definition: types.h:120
LONG SecurityHitHint
Definition: cm.h:420
HCELL_INDEX CMAPI HvReallocateCell(PHHIVE RegistryHive, HCELL_INDEX CellOffset, ULONG Size)
Definition: hivecell.c:393
ULONG CMAPI HvpHiveHeaderChecksum(PHBASE_BLOCK HiveHeader)
Definition: hivesum.c:17
LIST_ENTRY NotifyList
Definition: cm.h:399
CM_USE_COUNT_LOG_ENTRY Log[32]
Definition: cm.h:389
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
NTSTATUS NTAPI CmpFreeKeyByCell(IN PHHIVE Hive, IN HCELL_INDEX Cell, IN BOOLEAN Unlink)
Definition: cmkeydel.c:159
BOOLEAN NTAPI CmpGetValueData(IN PHHIVE Hive, IN PCM_KEY_VALUE Value, OUT PULONG Length, OUT PVOID *Buffer, OUT PBOOLEAN BufferAllocated, OUT PHCELL_INDEX CellToRelease)
Definition: cmvalue.c:125
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
ULONG SecurityCount
Definition: cm.h:418
USHORT Count
Definition: cmlib.h:305
PVOID NTAPI CmpAllocate(IN SIZE_T Size, IN BOOLEAN Paged, IN ULONG Tag)
Definition: registry.c:46
USHORT StaticCount
Definition: cmlib.h:309
LONG NTSTATUS
Definition: precomp.h:26
NTSYSAPI void WINAPI RtlInitializeBitMap(PRTL_BITMAP, PULONG, ULONG)
VOID NTAPI CmpFreeSecurityDescriptor(IN PHHIVE Hive, IN HCELL_INDEX Cell)
Definition: cmse.c:65
#define STATIC_CELL_PAIR_COUNT
Definition: cmlib.h:302
HCELL_INDEX NTAPI CmpFindSubKeyByNumber(IN PHHIVE Hive, IN PCM_KEY_NODE Node, IN ULONG Number)
Definition: cmindex.c:600
BOOLEAN Frozen
Definition: cm.h:425
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
CM_USE_COUNT_LOG UseCountLog
Definition: cm.h:432
VOID CMAPI HvReleaseFreeCellRefArray(IN OUT PHV_TRACK_CELL_REF CellRef)
Definition: hivecell.c:606
ULONG Flags
Definition: cm.h:434
ULONG FlushCount
Definition: cm.h:436
HCELL_INDEX CMAPI HvAllocateCell(PHHIVE RegistryHive, ULONG Size, HSTORAGE_TYPE Storage, IN HCELL_INDEX Vicinity)
NTSYSAPI ULONG WINAPI RtlFindSetBits(PCRTL_BITMAP, ULONG, ULONG)
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING ACPI_OBJECT_LIST ACPI_BUFFER *ReturnObjectBuffer ACPI_DEVICE_INFO **ReturnBuffer ACPI_HANDLE Parent
Definition: acpixf.h:728
ULONG CmlibTraceLevel
Definition: cminit.c:12
EX_PUSH_LOCK SecurityLock
Definition: cm.h:408
uint16_t * PWCHAR
Definition: typedefs.h:56
#define CM_KEY_VALUE_SPECIAL_SIZE
Definition: cm.h:77
NTSTATUS CMAPI HvpCreateHiveFreeCellList(PHHIVE Hive)
Definition: hivecell.c:278
static int Unlink(const char **args)
Definition: vfdcmd.c:2549
PKTHREAD HiveLockOwner
Definition: cm.h:402
USHORT PinnedViews
Definition: cm.h:416
NTSTATUS NTAPI CmpRemoveValueFromList(IN PHHIVE Hive, IN ULONG Index, IN OUT PCHILD_LIST ChildList)
Definition: cmvalue.c:320
_In_opt_ PALLOCATE_FUNCTION Allocate
Definition: exfuncs.h:814
BOOLEAN NTAPI CmpAddSubKey(IN PHHIVE Hive, IN HCELL_INDEX Parent, IN HCELL_INDEX Child)
Definition: cmindex.c:1465
NTSTATUS NTAPI CmpAddValueToList(IN PHHIVE Hive, IN HCELL_INDEX ValueCell, IN ULONG Index, IN HSTORAGE_TYPE StorageType, IN OUT PCHILD_LIST ChildList)
Definition: cmvalue.c:207
_In_ ULONG _In_ ULONG HintIndex
Definition: rtlfuncs.h:609
#define CMAPI
Definition: cmlib.h:210
#define CMP_SECURITY_HASH_LISTS
Definition: cm.h:82
_In_opt_ PALLOCATE_FUNCTION _In_opt_ PFREE_FUNCTION Free
Definition: exfuncs.h:814
UNICODE_STRING FileUserName
Definition: cm.h:414
uint32_t ULONG_PTR
Definition: typedefs.h:65
USHORT NTAPI CmpCopyName(IN PHHIVE Hive, OUT PWCHAR Destination, IN PCUNICODE_STRING Source)
Definition: cmname.c:21
_In_ WDFREQUEST _In_ PIO_STACK_LOCATION Stack
Definition: wdfrequest.h:636
BOOLEAN NTAPI CmpFreeValue(IN PHHIVE Hive, IN HCELL_INDEX Cell)
Definition: cmvalue.c:73
USHORT NTAPI CmpNameSize(IN PHHIVE Hive, IN PCUNICODE_STRING Name)
Definition: cmname.c:74
ERESOURCE * PERESOURCE
Definition: env_spec_w32.h:595
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
_In_ ULONG NumberToFind
Definition: rtlfuncs.h:609
_In_ WDFDEVICE _In_ WDF_SPECIAL_FILE_TYPE FileType
Definition: wdfdevice.h:2739
#define FALSE
Definition: types.h:117
BOOLEAN(CMAPI * PFILE_READ_ROUTINE)(struct _HHIVE *RegistryHive, ULONG FileType, PULONG FileOffset, PVOID Buffer, SIZE_T BufferLength)
Definition: hivedata.h:223
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFDEVICE Child
Definition: wdffdo.h:533
BOOLEAN(CMAPI * PFILE_FLUSH_ROUTINE)(struct _HHIVE *RegistryHive, ULONG FileType, PLARGE_INTEGER FileOffset, ULONG Length)
Definition: hivedata.h:249
long LONG
Definition: pedump.c:60
_In_ const STRING _In_ BOOLEAN CaseInSensitive
Definition: rtlfuncs.h:2335
WORD SECURITY_DESCRIPTOR_CONTROL
Definition: lsa.idl:37
VOID NTAPI CmpCopyCompressedName(OUT PWCHAR Destination, IN ULONG DestinationLength, IN PWCHAR Source, IN ULONG SourceLength)
Definition: cmname.c:56
struct _HV_HIVE_CELL_PAIR * PHV_HIVE_CELL_PAIR
PCM_KEY_CONTROL_BLOCK RootKcb
Definition: cm.h:424
ULONG GrowOffset
Definition: cm.h:428
struct _SECURITY_DESCRIPTOR_RELATIVE * PISECURITY_DESCRIPTOR_RELATIVE
HANDLE FileHandles[HFILE_TYPE_MAX]
Definition: cm.h:398
BOOLEAN CMAPI HvWriteHive(PHHIVE RegistryHive)
Definition: hivewrt.c:285
static BOOLEAN CmpIsKeyValueSmall(OUT PULONG RealLength, IN ULONG Length)
Definition: cmlib.h:325
HCELL_INDEX Cell
Definition: cm.h:381
unsigned char BOOLEAN
UNICODE_STRING FileFullPath
Definition: cm.h:413
_Out_ _Inout_ POEM_STRING DestinationString
Definition: rtlfuncs.h:1868
ULONG SecurityCacheSize
Definition: cm.h:419
ULONG * PHCELL_INDEX
Definition: hivedata.h:80
#define _In_
Definition: ms_sal.h:308
HHIVE Hive
Definition: cm.h:397
_In_ ULONG _In_opt_ WDFREQUEST _In_opt_ PVOID _In_ size_t _In_ PVOID _In_ size_t _Out_ size_t * DataLength
Definition: cdrom.h:1437
VOID CMAPI HvFree(PHHIVE RegistryHive)
Definition: hiveinit.c:628
Definition: bufpool.h:45
#define HFILE_TYPE_MAX
Definition: hivedata.h:36
struct _HV_HIVE_CELL_PAIR HV_HIVE_CELL_PAIR
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:406
WCHAR NTAPI RtlUpcaseUnicodeChar(_In_ WCHAR Source)
Definition: nlsboot.c:176
HV_HIVE_CELL_PAIR StaticArray[STATIC_CELL_PAIR_COUNT]
Definition: cmlib.h:308
PCELL_DATA NTAPI CmpValueToData(IN PHHIVE Hive, IN PCM_KEY_VALUE Value, OUT PULONG Length)
Definition: cmvalue.c:167
NTSTATUS NTAPI CmpSetValueDataNew(IN PHHIVE Hive, IN PVOID Data, IN ULONG DataSize, IN HSTORAGE_TYPE StorageType, IN HCELL_INDEX ValueCell, OUT PHCELL_INDEX DataCell)
Definition: cmvalue.c:289
struct _CM_USE_COUNT_LOG CM_USE_COUNT_LOG
BOOLEAN HiveIsLoading
Definition: cm.h:437
BOOLEAN CMAPI CmCreateRootNode(PHHIVE Hive, PCWSTR Name)
Definition: cminit.c:17
__wchar_t WCHAR
Definition: xmlstorage.h:180
ULONG HCELL_INDEX
Definition: hivedata.h:80
_In_ WDFCOLLECTION _In_ ULONG Index
BOOLEAN(CMAPI * PFILE_WRITE_ROUTINE)(struct _HHIVE *RegistryHive, ULONG FileType, PULONG FileOffset, PVOID Buffer, SIZE_T BufferLength)
Definition: hivedata.h:232
struct _CM_USE_COUNT_LOG_ENTRY CM_USE_COUNT_LOG_ENTRY
struct _CMHIVE CMHIVE
EX_PUSH_LOCK HiveLock
Definition: cm.h:401
Definition: cm.h:199
USHORT Next
Definition: cm.h:387
VOID(CMAPI * PFREE_ROUTINE)(PVOID Ptr, ULONG Quota)
Definition: hivedata.h:217
BOOLEAN CMAPI HvMarkCellDirty(PHHIVE RegistryHive, HCELL_INDEX CellOffset, BOOLEAN HoldingLock)
Definition: hivecell.c:99
_In_ PUNICODE_STRING _Inout_ PUNICODE_STRING Destination
Definition: rtlfuncs.h:2950
NTSTATUS NTAPI CmpCopyKeyValueList(IN PHHIVE SourceHive, IN PCHILD_LIST SrcValueList, IN PHHIVE DestinationHive, IN OUT PCHILD_LIST DestValueList, IN HSTORAGE_TYPE StorageType)
Definition: cmvalue.c:521
PERESOURCE FlusherLock
Definition: cm.h:407
* PFILE_OBJECT
Definition: iotypes.h:1998
Definition: cm.h:379
LIST_ENTRY HiveList
Definition: cm.h:400
BOOLEAN CMAPI HvSyncHive(PHHIVE RegistryHive)
Definition: hivewrt.c:243
VOID CMAPI HvFreeCell(PHHIVE RegistryHive, HCELL_INDEX CellOffset)
Definition: hivecell.c:440
BOOLEAN CMAPI HvTrackCellRef(IN OUT PHV_TRACK_CELL_REF CellRef, IN PHHIVE Hive, IN HCELL_INDEX Cell)
Definition: hivecell.c:526
HCELL_INDEX Cell
Definition: cmlib.h:299
unsigned char UCHAR
Definition: xmlstorage.h:181
char * PBOOLEAN
Definition: retypes.h:11
PCELL_DATA CMAPI HvpGetCellData(_In_ PHHIVE Hive, _In_ HCELL_INDEX CellIndex)
Definition: hivecell.c:67
LONG CMAPI HvGetCellSize(PHHIVE RegistryHive, PVOID Cell)
_Out_ _Inout_ POEM_STRING _In_ PCUNICODE_STRING SourceString
Definition: rtlfuncs.h:1868
ULONG RtlCompareUnicodeString(PUNICODE_STRING s1, PUNICODE_STRING s2, BOOLEAN UpCase)
Definition: string_lib.cpp:31
USHORT Size
Definition: cm.h:388
LIST_ENTRY LRUViewListHead
Definition: cm.h:410
EX_PUSH_LOCK WriterLock
Definition: cm.h:405
USHORT MappedViews
Definition: cm.h:415
Definition: typedefs.h:119
struct _SECURITY_DESCRIPTOR_RELATIVE SECURITY_DESCRIPTOR_RELATIVE
PKTHREAD ViewLockOwner
Definition: cm.h:404
_In_ ULONG StartingIndex
Definition: rtlfuncs.h:395
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN _In_opt_ PVOID Tag
Definition: wdfdevice.h:4061
_In_opt_ PENTER_STATE_SYSTEM_HANDLER _In_opt_ PVOID _In_ LONG _In_opt_ LONG volatile * Number
Definition: ntpoapi.h:204
PKTHREAD WriterLockOwner
Definition: cm.h:406
ULONG UseCount
Definition: cm.h:417
PFILE_OBJECT FileObject
Definition: cm.h:412
struct _HV_TRACK_CELL_REF * PHV_TRACK_CELL_REF
LIST_ENTRY KnodeConvertListHead
Definition: cm.h:430
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_CHILD_LIST_CONFIG _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFCHILDLIST * ChildList
Definition: wdfchildlist.h:474
ULONG_PTR SIZE_T
Definition: typedefs.h:80
struct _CM_USE_COUNT_LOG_ENTRY * PCM_USE_COUNT_LOG_ENTRY
_Must_inspect_result_ _In_opt_ WDFKEY ParentKey
Definition: wdfregistry.h:69
PCM_CELL_REMAP_BLOCK CellRemapArray
Definition: cm.h:431
PKTHREAD CreatorOwner
Definition: cm.h:438
struct _HV_TRACK_CELL_REF HV_TRACK_CELL_REF
SECURITY_DESCRIPTOR_CONTROL Control
Definition: setypes.h:835
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
LONG NTAPI CmpCompareCompressedName(IN PCUNICODE_STRING SearchName, IN PWCHAR CompressedName, IN ULONG NameLength)
Definition: cmname.c:109
HSTORAGE_TYPE
Definition: hivedata.h:100
NTSYSAPI void WINAPI RtlSetBits(PRTL_BITMAP, ULONG, ULONG)
#define CM_KEY_VALUE_BIG
Definition: cm.h:76
VOID NTAPI CmpRemoveSecurityCellList(IN PHHIVE Hive, IN HCELL_INDEX SecurityCell)
Definition: cmse.c:19
unsigned int * PULONG
Definition: retypes.h:1
HCELL_INDEX NTAPI CmpFindSubKeyByName(IN PHHIVE Hive, IN PCM_KEY_NODE Parent, IN PCUNICODE_STRING SearchName)
Definition: cmindex.c:683
PKTHREAD HiveSecurityLockOwner
Definition: cm.h:409
LIST_ENTRY PinViewListHead
Definition: cm.h:411
PKEVENT UnloadEvent
Definition: cm.h:423
NTSYSAPI void WINAPI RtlClearAllBits(PRTL_BITMAP)
static BOOLEAN CmpIsKeyValueBig(IN PHHIVE Hive, IN ULONG Length)
Definition: cmlib.h:346
CM_USE_COUNT_LOG LockHiveLog
Definition: cm.h:433
BOOLEAN NTAPI CmpMarkIndexDirty(IN PHHIVE Hive, HCELL_INDEX ParentKey, HCELL_INDEX TargetKey)
_In_ const STRING * String2
Definition: rtlfuncs.h:2304
PVOID(CMAPI * PALLOCATE_ROUTINE)(SIZE_T Size, BOOLEAN Paged, ULONG Tag)
Definition: hivedata.h:210
#define HSYS_WHISTLER_BETA1
Definition: hivedata.h:59
#define OUT
Definition: typedefs.h:40
PCM_KEY_SECURITY_CACHE_ENTRY SecurityCache
Definition: cm.h:421
BOOLEAN NTAPI CmpRemoveSubKey(IN PHHIVE Hive, IN HCELL_INDEX ParentKey, IN HCELL_INDEX TargetKey)
Definition: cmindex.c:1694
unsigned int ULONG
Definition: retypes.h:1
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
VOID CMAPI CmPrepareHive(PHHIVE RegistryHive)
Definition: cminit.c:135
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3167
BOOLEAN NTAPI CmpFindNameInList(IN PHHIVE Hive, IN PCHILD_LIST ChildList, IN PCUNICODE_STRING Name, OUT PULONG ChildIndex OPTIONAL, OUT PHCELL_INDEX CellIndex)
Definition: cmname.c:149
BOOLEAN NTAPI CmpFreeValueData(IN PHHIVE Hive, IN HCELL_INDEX DataCell, IN ULONG DataLength)
Definition: cmvalue.c:44
LIST_ENTRY SecurityHash[CMP_SECURITY_HASH_LISTS]
Definition: cm.h:422
USHORT NTAPI CmpCompressedNameSize(IN PWCHAR Name, IN ULONG Length)
Definition: cmname.c:95
static IStorage Storage
Definition: ole2.c:3548
_In_ NDIS_STATUS _In_ ULONG _In_ USHORT _In_opt_ PVOID _In_ ULONG DataSize
Definition: ndis.h:4751
LIST_ENTRY KcbConvertListHead
Definition: cm.h:429
VOID NTAPI KeBugCheckEx(_In_ ULONG BugCheckCode, _In_ ULONG_PTR BugCheckParameter1, _In_ ULONG_PTR BugCheckParameter2, _In_ ULONG_PTR BugCheckParameter3, _In_ ULONG_PTR BugCheckParameter4)
Definition: rtlcompat.c:108
Definition: cm.h:395
PHV_HIVE_CELL_PAIR CellArray
Definition: cmlib.h:307
Definition: dlist.c:348
BOOLEAN CMAPI HvHiveWillShrink(IN PHHIVE RegistryHive)
Definition: hivewrt.c:277
BOOLEAN NTAPI CmpMarkValueDataDirty(IN PHHIVE Hive, IN PCM_KEY_VALUE Value)
Definition: cmvalue.c:19
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
BOOLEAN GrowOnlyMode
Definition: cm.h:427