xref: /reactos/ntoskrnl/include/internal/cm.h (revision 7b1049c8)
1 /*
2  * PROJECT:         ReactOS Kernel
3  * LICENSE:         GPL - See COPYING in the top level directory
4  * FILE:            ntoskrnl/include/internal/cm.h
5  * PURPOSE:         Internal header for the Configuration Manager
6  * PROGRAMMERS:     Alex Ionescu (alex.ionescu@reactos.org)
7  */
8 #define _CM_
9 #include "cmlib.h"
10 #include <cmreslist.h>
11 
12 //
13 // Define this if you want debugging support
14 //
15 #define _CM_DEBUG_                                      0x00
16 
17 //
18 // These define the Debug Masks Supported
19 //
20 #define CM_HANDLE_DEBUG                                 0x01
21 #define CM_NAMESPACE_DEBUG                              0x02
22 #define CM_SECURITY_DEBUG                               0x04
23 #define CM_REFERENCE_DEBUG                              0x08
24 #define CM_CALLBACK_DEBUG                               0x10
25 
26 //
27 // Debug/Tracing support
28 //
29 #if _CM_DEBUG_
30 #ifdef NEW_DEBUG_SYSTEM_IMPLEMENTED // enable when Debug Filters are implemented
31 #define CMTRACE DbgPrintEx
32 #else
33 #define CMTRACE(x, ...)                                 \
34     if (x & CmpTraceLevel) DbgPrint(__VA_ARGS__)
35 #endif
36 #else
37 #define CMTRACE(x, fmt, ...) DPRINT(fmt, ##__VA_ARGS__)
38 #endif
39 
40 //
41 // Hack since bigkeys are not yet supported
42 //
43 #define ASSERT_VALUE_BIG(h, s)                          \
44     ASSERTMSG("Big keys not supported!\n", !CmpIsKeyValueBig(h, s));
45 
46 //
47 // CM_KEY_CONTROL_BLOCK Signatures
48 //
49 #define CM_KCB_SIGNATURE                                'bKmC'
50 #define CM_KCB_INVALID_SIGNATURE                        '4FmC'
51 
52 //
53 // CM_KEY_CONTROL_BLOCK ExtFlags
54 //
55 #define CM_KCB_NO_SUBKEY                                0x01
56 #define CM_KCB_SUBKEY_ONE                               0x02
57 #define CM_KCB_SUBKEY_HINT                              0x04
58 #define CM_KCB_SYM_LINK_FOUND                           0x08
59 #define CM_KCB_KEY_NON_EXIST                            0x10
60 #define CM_KCB_NO_DELAY_CLOSE                           0x20
61 #define CM_KCB_INVALID_CACHED_INFO                      0x40
62 #define CM_KCB_READ_ONLY_KEY                            0x80
63 
64 //
65 // CM_KEY_BODY Types
66 //
67 #define CM_KEY_BODY_TYPE                                0x6B793032
68 
69 //
70 // CM_KEY_VALUE Types
71 //
72 #define CM_KEY_VALUE_SMALL                              0x4
73 #define CM_KEY_VALUE_BIG                                0x3FD8
74 #define CM_KEY_VALUE_SPECIAL_SIZE                       0x80000000
75 
76 //
77 // Number of various lists and hashes
78 //
79 #define CMP_SECURITY_HASH_LISTS                         64
80 #define CMP_MAX_CALLBACKS                               100
81 
82 //
83 // Hashing Constants
84 //
85 #define CMP_HASH_IRRATIONAL                             314159269
86 #define CMP_HASH_PRIME                                  1000000007
87 
88 //
89 // CmpCreateKeyControlBlock Flags
90 //
91 #define CMP_CREATE_FAKE_KCB                             0x1
92 #define CMP_LOCK_HASHES_FOR_KCB                         0x2
93 
94 //
95 // CmpDoCreate and CmpDoOpen flags
96 //
97 #define CMP_CREATE_KCB_KCB_LOCKED                       0x2
98 #define CMP_OPEN_KCB_NO_CREATE                          0x4
99 
100 //
101 // EnlistKeyBodyWithKCB Flags
102 //
103 #define CMP_ENLIST_KCB_LOCKED_SHARED                    0x1
104 #define CMP_ENLIST_KCB_LOCKED_EXCLUSIVE                 0x2
105 
106 //
107 // Unload Flags
108 //
109 #define CMP_UNLOCK_KCB_LOCKED                    0x1
110 #define CMP_UNLOCK_REGISTRY_LOCKED               0x2
111 
112 //
113 // Maximum size of Value Cache
114 //
115 #define MAXIMUM_CACHED_DATA                             2 * PAGE_SIZE
116 
117 //
118 // Hives to load on startup
119 //
120 #define CM_NUMBER_OF_MACHINE_HIVES                      6
121 
122 //
123 // Number of items that can fit inside an Allocation Page
124 //
125 #define CM_KCBS_PER_PAGE                                \
126     ((PAGE_SIZE - FIELD_OFFSET(CM_ALLOC_PAGE, AllocPage)) / sizeof(CM_KEY_CONTROL_BLOCK))
127 #define CM_DELAYS_PER_PAGE                              \
128     ((PAGE_SIZE - FIELD_OFFSET(CM_ALLOC_PAGE, AllocPage)) / sizeof(CM_DELAY_ALLOC))
129 
130 //
131 // Value Search Results
132 //
133 typedef enum _VALUE_SEARCH_RETURN_TYPE
134 {
135     SearchSuccess,
136     SearchNeedExclusiveLock,
137     SearchFail
138 } VALUE_SEARCH_RETURN_TYPE;
139 
140 //
141 // Key Hash
142 //
143 typedef struct _CM_KEY_HASH
144 {
145     ULONG ConvKey;
146     struct _CM_KEY_HASH *NextHash;
147     PHHIVE KeyHive;
148     HCELL_INDEX KeyCell;
149 } CM_KEY_HASH, *PCM_KEY_HASH;
150 
151 //
152 // Key Hash Table Entry
153 //
154 typedef struct _CM_KEY_HASH_TABLE_ENTRY
155 {
156     EX_PUSH_LOCK Lock;
157     PKTHREAD Owner;
158     PCM_KEY_HASH Entry;
159 } CM_KEY_HASH_TABLE_ENTRY, *PCM_KEY_HASH_TABLE_ENTRY;
160 
161 //
162 // Name Hash
163 //
164 typedef struct _CM_NAME_HASH
165 {
166     ULONG ConvKey;
167     struct _CM_NAME_HASH *NextHash;
168     USHORT NameLength;
169     WCHAR Name[ANYSIZE_ARRAY];
170 } CM_NAME_HASH, *PCM_NAME_HASH;
171 
172 //
173 // Name Hash Table Entry
174 //
175 typedef struct _CM_NAME_HASH_TABLE_ENTRY
176 {
177     EX_PUSH_LOCK Lock;
178     PCM_NAME_HASH Entry;
179 } CM_NAME_HASH_TABLE_ENTRY, *PCM_NAME_HASH_TABLE_ENTRY;
180 
181 //
182 // Key Security Cache
183 //
184 typedef struct _CM_KEY_SECURITY_CACHE
185 {
186     HCELL_INDEX Cell;
187     ULONG ConvKey;
188     LIST_ENTRY List;
189     ULONG DescriptorLength;
190     SECURITY_DESCRIPTOR_RELATIVE Descriptor;
191 } CM_KEY_SECURITY_CACHE, *PCM_KEY_SECURITY_CACHE;
192 
193 //
194 // Key Security Cache Entry
195 //
196 typedef struct _CM_KEY_SECURITY_CACHE_ENTRY
197 {
198     HCELL_INDEX Cell;
199     PCM_KEY_SECURITY_CACHE CachedSecurity;
200 } CM_KEY_SECURITY_CACHE_ENTRY, *PCM_KEY_SECURITY_CACHE_ENTRY;
201 
202 //
203 // Cached Child List
204 //
205 typedef struct _CACHED_CHILD_LIST
206 {
207     ULONG Count;
208     union
209     {
210         ULONG ValueList;
211         struct _CM_KEY_CONTROL_BLOCK *RealKcb;
212     };
213 } CACHED_CHILD_LIST, *PCACHED_CHILD_LIST;
214 
215 //
216 // Index Hint Block
217 //
218 typedef struct _CM_INDEX_HINT_BLOCK
219 {
220     ULONG Count;
221     ULONG HashKey[ANYSIZE_ARRAY];
222 } CM_INDEX_HINT_BLOCK, *PCM_INDEX_HINT_BLOCK;
223 
224 //
225 // Key Body
226 //
227 typedef struct _CM_KEY_BODY
228 {
229     ULONG Type;
230     struct _CM_KEY_CONTROL_BLOCK *KeyControlBlock;
231     struct _CM_NOTIFY_BLOCK *NotifyBlock;
232     HANDLE ProcessID;
233     LIST_ENTRY KeyBodyList;
234 } CM_KEY_BODY, *PCM_KEY_BODY;
235 
236 //
237 // Name Control Block (NCB)
238 //
239 typedef struct _CM_NAME_CONTROL_BLOCK
240 {
241     BOOLEAN Compressed;
242     USHORT RefCount;
243     union
244     {
245         CM_NAME_HASH NameHash;
246         struct
247         {
248             ULONG ConvKey;
249             PCM_KEY_HASH NextHash;
250             USHORT NameLength;
251             WCHAR Name[ANYSIZE_ARRAY];
252         };
253     };
254 } CM_NAME_CONTROL_BLOCK, *PCM_NAME_CONTROL_BLOCK;
255 
256 //
257 // Key Control Block (KCB)
258 //
259 typedef struct _CM_KEY_CONTROL_BLOCK
260 {
261     ULONG Signature;
262     ULONG RefCount;
263     struct
264     {
265         ULONG ExtFlags:8;
266         ULONG PrivateAlloc:1;
267         ULONG Delete:1;
268         ULONG DelayedCloseIndex:12;
269         ULONG TotalLevels:10;
270     };
271     union
272     {
273         CM_KEY_HASH KeyHash;
274         struct
275         {
276             ULONG ConvKey;
277             PCM_KEY_HASH NextHash;
278             PHHIVE KeyHive;
279             HCELL_INDEX KeyCell;
280         };
281     };
282     struct _CM_KEY_CONTROL_BLOCK *ParentKcb;
283     PCM_NAME_CONTROL_BLOCK NameBlock;
284     PCM_KEY_SECURITY_CACHE CachedSecurity;
285     CACHED_CHILD_LIST ValueCache;
286     union
287     {
288         PCM_INDEX_HINT_BLOCK IndexHint;
289         ULONG HashKey;
290         ULONG SubKeyCount;
291     };
292     union
293     {
294         LIST_ENTRY KeyBodyListHead;
295         LIST_ENTRY FreeListEntry;
296     };
297     PCM_KEY_BODY KeyBodyArray[4];
298     PVOID DelayCloseEntry;
299     LARGE_INTEGER KcbLastWriteTime;
300     USHORT KcbMaxNameLen;
301     USHORT KcbMaxValueNameLen;
302     ULONG KcbMaxValueDataLen;
303     struct
304     {
305          ULONG KcbUserFlags : 4;
306          ULONG KcbVirtControlFlags : 4;
307          ULONG KcbDebug : 8;
308          ULONG Flags : 16;
309     };
310     ULONG InDelayClose;
311 } CM_KEY_CONTROL_BLOCK, *PCM_KEY_CONTROL_BLOCK;
312 
313 //
314 // Notify Block
315 //
316 typedef struct _CM_NOTIFY_BLOCK
317 {
318     LIST_ENTRY HiveList;
319     LIST_ENTRY PostList;
320     PCM_KEY_CONTROL_BLOCK KeyControlBlock;
321     PCM_KEY_BODY KeyBody;
322     ULONG Filter:29;
323     ULONG WatchTree:30;
324     ULONG NotifyPending:31;
325 } CM_NOTIFY_BLOCK, *PCM_NOTIFY_BLOCK;
326 
327 //
328 // Re-map Block
329 //
330 typedef struct _CM_CELL_REMAP_BLOCK
331 {
332     HCELL_INDEX OldCell;
333     HCELL_INDEX NewCell;
334 } CM_CELL_REMAP_BLOCK, *PCM_CELL_REMAP_BLOCK;
335 
336 //
337 // Allocation Page
338 //
339 typedef struct _CM_ALLOC_PAGE
340 {
341     ULONG FreeCount;
342     ULONG Reserved;
343     PVOID AllocPage;
344 } CM_ALLOC_PAGE, *PCM_ALLOC_PAGE;
345 
346 //
347 // Allocation Page Entry
348 //
349 typedef struct _CM_DELAY_ALLOC
350 {
351     LIST_ENTRY ListEntry;
352     PCM_KEY_CONTROL_BLOCK Kcb;
353 } CM_DELAY_ALLOC, *PCM_DELAY_ALLOC;
354 
355 //
356 // Delayed Close Entry
357 //
358 typedef struct _CM_DELAYED_CLOSE_ENTRY
359 {
360     LIST_ENTRY DelayedLRUList;
361     PCM_KEY_CONTROL_BLOCK KeyControlBlock;
362 } CM_DELAYED_CLOSE_ENTRY, *PCM_DELAYED_CLOSE_ENTRY;
363 
364 //
365 // Delayed KCB Dereference Entry
366 //
367 typedef struct _CM_DELAY_DEREF_KCB_ITEM
368 {
369     LIST_ENTRY ListEntry;
370     PCM_KEY_CONTROL_BLOCK Kcb;
371 } CM_DELAY_DEREF_KCB_ITEM, *PCM_DELAY_DEREF_KCB_ITEM;
372 
373 //
374 // Use Count Log and Entry
375 //
376 typedef struct _CM_USE_COUNT_LOG_ENTRY
377 {
378     HCELL_INDEX Cell;
379     PVOID Stack[7];
380 } CM_USE_COUNT_LOG_ENTRY, *PCM_USE_COUNT_LOG_ENTRY;
381 
382 typedef struct _CM_USE_COUNT_LOG
383 {
384     USHORT Next;
385     USHORT Size;
386     CM_USE_COUNT_LOG_ENTRY Log[32];
387 } CM_USE_COUNT_LOG, *PCM_USE_COUNT_LOG;
388 
389 //
390 // Configuration Manager Hive Structure
391 //
392 typedef struct _CMHIVE
393 {
394     HHIVE Hive;
395     HANDLE FileHandles[HFILE_TYPE_MAX];
396     LIST_ENTRY NotifyList;
397     LIST_ENTRY HiveList;
398     EX_PUSH_LOCK HiveLock;
399     PKTHREAD HiveLockOwner;
400     PKGUARDED_MUTEX ViewLock;
401     PKTHREAD ViewLockOwner;
402     EX_PUSH_LOCK WriterLock;
403     PKTHREAD WriterLockOwner;
404     PERESOURCE FlusherLock;
405     EX_PUSH_LOCK SecurityLock;
406     PKTHREAD HiveSecurityLockOwner;
407     LIST_ENTRY LRUViewListHead;
408     LIST_ENTRY PinViewListHead;
409     PFILE_OBJECT FileObject;
410     UNICODE_STRING FileFullPath;
411     UNICODE_STRING FileUserName;
412     USHORT MappedViews;
413     USHORT PinnedViews;
414     ULONG UseCount;
415     ULONG SecurityCount;
416     ULONG SecurityCacheSize;
417     LONG SecurityHitHint;
418     PCM_KEY_SECURITY_CACHE_ENTRY SecurityCache;
419     LIST_ENTRY SecurityHash[CMP_SECURITY_HASH_LISTS];
420     PKEVENT UnloadEvent;
421     PCM_KEY_CONTROL_BLOCK RootKcb;
422     BOOLEAN Frozen;
423     PWORK_QUEUE_ITEM UnloadWorkItem;
424     BOOLEAN GrowOnlyMode;
425     ULONG GrowOffset;
426     LIST_ENTRY KcbConvertListHead;
427     LIST_ENTRY KnodeConvertListHead;
428     PCM_CELL_REMAP_BLOCK CellRemapArray;
429     CM_USE_COUNT_LOG UseCountLog;
430     CM_USE_COUNT_LOG LockHiveLog;
431     ULONG Flags;
432     LIST_ENTRY TrustClassEntry;
433     ULONG FlushCount;
434     BOOLEAN HiveIsLoading;
435     PKTHREAD CreatorOwner;
436 } CMHIVE, *PCMHIVE;
437 
438 //
439 // Cached Value Index
440 //
441 typedef struct _CM_CACHED_VALUE_INDEX
442 {
443     HCELL_INDEX CellIndex;
444     union
445     {
446         CELL_DATA CellData;
447         ULONG_PTR List[ANYSIZE_ARRAY];
448     } Data;
449 } CM_CACHED_VALUE_INDEX, *PCM_CACHED_VALUE_INDEX;
450 
451 //
452 // Cached Value
453 //
454 typedef struct _CM_CACHED_VALUE
455 {
456     USHORT DataCacheType;
457     USHORT ValueKeySize;
458     ULONG HashKey;
459     CM_KEY_VALUE KeyValue;
460 } CM_CACHED_VALUE, *PCM_CACHED_VALUE;
461 
462 //
463 // Hive List Entry
464 //
465 typedef struct _HIVE_LIST_ENTRY
466 {
467     PWSTR Name;
468     PWSTR BaseName;
469     PCMHIVE CmHive;
470     ULONG HHiveFlags;
471     ULONG CmHiveFlags;
472     PCMHIVE CmHive2;
473     BOOLEAN ThreadFinished;
474     BOOLEAN ThreadStarted;
475     BOOLEAN Allocate;
476 } HIVE_LIST_ENTRY, *PHIVE_LIST_ENTRY;
477 
478 //
479 // Parse context for Key Object
480 //
481 typedef struct _CM_PARSE_CONTEXT
482 {
483     ULONG TitleIndex;
484     UNICODE_STRING Class;
485     ULONG CreateOptions;
486     ULONG Disposition;
487     CM_KEY_REFERENCE ChildHive;
488     HANDLE PredefinedHandle;
489     BOOLEAN CreateLink;
490     BOOLEAN CreateOperation;
491     PCMHIVE OriginatingPoint;
492 } CM_PARSE_CONTEXT, *PCM_PARSE_CONTEXT;
493 
494 //
495 // MultiFunction Adapter Recognizer Structure
496 //
497 typedef struct _CMP_MF_TYPE
498 {
499     PCHAR Identifier;
500     USHORT InterfaceType;
501     USHORT Count;
502 } CMP_MF_TYPE, *PCMP_MF_TYPE;
503 
504 //
505 // System Control Vector
506 //
507 typedef struct _CM_SYSTEM_CONTROL_VECTOR
508 {
509     PWCHAR KeyPath;
510     PWCHAR ValueName;
511     PVOID Buffer;
512     PULONG BufferLength;
513     PULONG Type;
514 } CM_SYSTEM_CONTROL_VECTOR, *PCM_SYSTEM_CONTROL_VECTOR;
515 
516 //
517 // Structure for CmpQueryValueDataFromCache
518 //
519 typedef struct _KEY_VALUE_INFORMATION
520 {
521     union
522     {
523         KEY_VALUE_BASIC_INFORMATION KeyValueBasicInformation;
524         KEY_VALUE_FULL_INFORMATION KeyValueFullInformation;
525         KEY_VALUE_PARTIAL_INFORMATION KeyValuePartialInformation;
526         KEY_VALUE_PARTIAL_INFORMATION_ALIGN64 KeyValuePartialInformationAlign64;
527     };
528 } KEY_VALUE_INFORMATION, *PKEY_VALUE_INFORMATION;
529 
530 typedef struct _KEY_INFORMATION
531 {
532     union
533     {
534         KEY_BASIC_INFORMATION KeyBasicInformation;
535         KEY_FULL_INFORMATION KeyFullInformation;
536         KEY_NODE_INFORMATION KeyNodeInformation;
537     };
538 } KEY_INFORMATION, *PKEY_INFORMATION;
539 
540 ///////////////////////////////////////////////////////////////////////////////
541 //
542 // BUGBUG Old Hive Stuff for Temporary Support
543 //
544 NTSTATUS CmiCallRegisteredCallbacks(IN REG_NOTIFY_CLASS Argument1, IN PVOID Argument2);
545 ///////////////////////////////////////////////////////////////////////////////
546 
547 //
548 // Mapped View Hive Functions
549 //
550 VOID
551 NTAPI
552 CmpInitHiveViewList(
553     IN PCMHIVE Hive
554 );
555 
556 VOID
557 NTAPI
558 CmpDestroyHiveViewList(
559     IN PCMHIVE Hive
560 );
561 
562 //
563 // Security Cache Functions
564 //
565 VOID
566 NTAPI
567 CmpInitSecurityCache(
568     IN PCMHIVE Hive
569 );
570 
571 VOID
572 NTAPI
573 CmpDestroySecurityCache(
574     IN PCMHIVE Hive
575 );
576 
577 //
578 // Value Cache Functions
579 //
580 VALUE_SEARCH_RETURN_TYPE
581 NTAPI
582 CmpFindValueByNameFromCache(
583     IN PCM_KEY_CONTROL_BLOCK Kcb,
584     IN PCUNICODE_STRING Name,
585     OUT PCM_CACHED_VALUE **CachedValue,
586     OUT ULONG *Index,
587     OUT PCM_KEY_VALUE *Value,
588     OUT BOOLEAN *ValueIsCached,
589     OUT PHCELL_INDEX CellToRelease
590 );
591 
592 VALUE_SEARCH_RETURN_TYPE
593 NTAPI
594 CmpQueryKeyValueData(
595     IN PCM_KEY_CONTROL_BLOCK Kcb,
596     IN PCM_CACHED_VALUE *CachedValue,
597     IN PCM_KEY_VALUE ValueKey,
598     IN BOOLEAN ValueIsCached,
599     IN KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass,
600     IN PVOID KeyValueInformation,
601     IN ULONG Length,
602     OUT PULONG ResultLength,
603     OUT PNTSTATUS Status
604 );
605 
606 VALUE_SEARCH_RETURN_TYPE
607 NTAPI
608 CmpGetValueListFromCache(
609     IN PCM_KEY_CONTROL_BLOCK Kcb,
610     OUT PCELL_DATA *CellData,
611     OUT BOOLEAN *IndexIsCached,
612     OUT PHCELL_INDEX ValueListToRelease
613 );
614 
615 VALUE_SEARCH_RETURN_TYPE
616 NTAPI
617 CmpGetValueKeyFromCache(
618     IN PCM_KEY_CONTROL_BLOCK Kcb,
619     IN PCELL_DATA CellData,
620     IN ULONG Index,
621     OUT PCM_CACHED_VALUE **CachedValue,
622     OUT PCM_KEY_VALUE *Value,
623     IN BOOLEAN IndexIsCached,
624     OUT BOOLEAN *ValueIsCached,
625     OUT PHCELL_INDEX CellToRelease
626 );
627 
628 VALUE_SEARCH_RETURN_TYPE
629 NTAPI
630 CmpCompareNewValueDataAgainstKCBCache(
631     IN PCM_KEY_CONTROL_BLOCK Kcb,
632     IN PUNICODE_STRING ValueName,
633     IN ULONG Type,
634     IN PVOID Data,
635     IN ULONG DataSize
636 );
637 
638 //
639 // Registry Validation Functions
640 //
641 ULONG
642 NTAPI
643 CmCheckRegistry(
644     IN PCMHIVE Hive,
645     IN ULONG Flags
646 );
647 
648 //
649 // Hive List Routines
650 //
651 BOOLEAN
652 NTAPI
653 CmpGetHiveName(
654     IN  PCMHIVE Hive,
655     OUT PUNICODE_STRING HiveName
656 );
657 
658 NTSTATUS
659 NTAPI
660 CmpAddToHiveFileList(
661     IN PCMHIVE Hive
662 );
663 
664 VOID
665 NTAPI
666 CmpRemoveFromHiveFileList(
667     IN PCMHIVE Hive
668 );
669 
670 //
671 // Quota Routines
672 //
673 VOID
674 NTAPI
675 CmpSetGlobalQuotaAllowed(
676     VOID
677 );
678 
679 //
680 // Notification Routines
681 //
682 VOID
683 NTAPI
684 CmpReportNotify(
685     IN PCM_KEY_CONTROL_BLOCK Kcb,
686     IN PHHIVE Hive,
687     IN HCELL_INDEX Cell,
688     IN ULONG Filter
689 );
690 
691 VOID
692 NTAPI
693 CmpFlushNotify(
694     IN PCM_KEY_BODY KeyBody,
695     IN BOOLEAN LockHeld
696 );
697 
698 VOID
699 NTAPI
700 CmpInitCallback(
701     VOID
702 );
703 
704 //
705 // KCB Cache/Delay Routines
706 //
707 VOID
708 NTAPI
709 CmpInitializeCache(
710     VOID
711 );
712 
713 VOID
714 NTAPI
715 CmpInitCmPrivateDelayAlloc(
716     VOID
717 );
718 
719 VOID
720 NTAPI
721 CmpInitCmPrivateAlloc(
722     VOID
723 );
724 
725 VOID
726 NTAPI
727 CmpInitDelayDerefKCBEngine(
728     VOID
729 );
730 
731 //
732 // Key Object Routines
733 //
734 VOID
735 NTAPI
736 CmpCloseKeyObject(
737     IN PEPROCESS Process OPTIONAL,
738     IN PVOID Object,
739     IN ACCESS_MASK GrantedAccess,
740     IN ULONG ProcessHandleCount,
741     IN ULONG SystemHandleCount
742 );
743 
744 VOID
745 NTAPI
746 CmpDeleteKeyObject(
747     IN PVOID Object
748 );
749 
750 NTSTATUS
751 NTAPI
752 CmpParseKey(
753     IN PVOID ParseObject,
754     IN PVOID ObjectType,
755     IN OUT PACCESS_STATE AccessState,
756     IN KPROCESSOR_MODE AccessMode,
757     IN ULONG Attributes,
758     IN OUT PUNICODE_STRING CompleteName,
759     IN OUT PUNICODE_STRING RemainingName,
760     IN OUT PVOID Context OPTIONAL,
761     IN PSECURITY_QUALITY_OF_SERVICE SecurityQos OPTIONAL,
762     OUT PVOID *Object
763 );
764 
765 NTSTATUS
766 NTAPI
767 CmpSecurityMethod(
768     IN PVOID Object,
769     IN SECURITY_OPERATION_CODE OperationType,
770     IN PSECURITY_INFORMATION SecurityInformation,
771     IN PSECURITY_DESCRIPTOR SecurityDescriptor,
772     IN OUT PULONG CapturedLength,
773     IN OUT PSECURITY_DESCRIPTOR *ObjectSecurityDescriptor,
774     IN POOL_TYPE PoolType,
775     IN PGENERIC_MAPPING GenericMapping
776 );
777 
778 NTSTATUS
779 NTAPI
780 CmpQueryKeyName(
781     IN PVOID Object,
782     IN BOOLEAN HasObjectName,
783     OUT POBJECT_NAME_INFORMATION ObjectNameInfo,
784     IN ULONG Length,
785     OUT PULONG ReturnLength,
786     IN KPROCESSOR_MODE AccessMode
787 );
788 
789 //
790 // Hive Routines
791 //
792 NTSTATUS
793 NTAPI
794 CmpInitializeHive(
795     OUT PCMHIVE *CmHive,
796     IN ULONG OperationType,
797     IN ULONG HiveFlags,
798     IN ULONG FileType,
799     IN PVOID HiveData OPTIONAL,
800     IN HANDLE Primary,
801     IN HANDLE Log,
802     IN HANDLE External,
803     IN PCUNICODE_STRING FileName OPTIONAL,
804     IN ULONG CheckFlags
805 );
806 
807 NTSTATUS
808 NTAPI
809 CmpDestroyHive(
810     IN PCMHIVE CmHive
811 );
812 
813 PSECURITY_DESCRIPTOR
814 NTAPI
815 CmpHiveRootSecurityDescriptor(
816     VOID
817 );
818 
819 NTSTATUS
820 NTAPI
821 CmpLinkHiveToMaster(
822     IN PUNICODE_STRING LinkName,
823     IN HANDLE RootDirectory,
824     IN PCMHIVE CmHive,
825     IN BOOLEAN Allocate,
826     IN PSECURITY_DESCRIPTOR SecurityDescriptor
827 );
828 
829 NTSTATUS
830 NTAPI
831 CmpOpenHiveFiles(
832     IN PCUNICODE_STRING BaseName,
833     IN PCWSTR Extension OPTIONAL,
834     OUT PHANDLE Primary,
835     OUT PHANDLE Log,
836     OUT PULONG PrimaryDisposition,
837     OUT PULONG LogDisposition,
838     IN BOOLEAN CreateAllowed,
839     IN BOOLEAN MarkAsSystemHive,
840     IN BOOLEAN NoBuffering,
841     OUT PULONG ClusterSize OPTIONAL
842 );
843 
844 VOID
845 NTAPI
846 CmpCloseHiveFiles(
847     IN PCMHIVE Hive
848 );
849 
850 NTSTATUS
851 NTAPI
852 CmpInitHiveFromFile(
853     IN PCUNICODE_STRING HiveName,
854     IN ULONG HiveFlags,
855     OUT PCMHIVE *Hive,
856     IN OUT PBOOLEAN New,
857     IN ULONG CheckFlags
858 );
859 
860 VOID
861 NTAPI
862 CmpInitializeHiveList(
863     VOID
864 );
865 
866 //
867 // Registry Utility Functions
868 //
869 BOOLEAN
870 NTAPI
871 CmpTestRegistryLockExclusive(
872     VOID
873 );
874 
875 BOOLEAN
876 NTAPI
877 CmpTestRegistryLock(
878     VOID
879 );
880 
881 VOID
882 NTAPI
883 CmpLockRegistryExclusive(
884     VOID
885 );
886 
887 VOID
888 NTAPI
889 CmpLockRegistry(
890     VOID
891 );
892 
893 VOID
894 NTAPI
895 CmpUnlockRegistry(
896     VOID
897 );
898 
899 VOID
900 NTAPI
901 CmpLockHiveFlusherExclusive(
902     IN PCMHIVE Hive
903 );
904 
905 VOID
906 NTAPI
907 CmpLockHiveFlusherShared(
908     IN PCMHIVE Hive
909 );
910 
911 BOOLEAN
912 NTAPI
913 CmpTestHiveFlusherLockExclusive(
914     IN PCMHIVE Hive
915 );
916 
917 BOOLEAN
918 NTAPI
919 CmpTestHiveFlusherLockShared(
920     IN PCMHIVE Hive
921 );
922 
923 VOID
924 NTAPI
925 CmpUnlockHiveFlusher(
926     IN PCMHIVE Hive
927 );
928 
929 //
930 // Delay Functions
931 //
932 PVOID
933 NTAPI
934 CmpAllocateDelayItem(
935     VOID
936 );
937 
938 VOID
939 NTAPI
940 CmpFreeDelayItem(
941     PVOID Entry
942 );
943 
944 VOID
945 NTAPI
946 CmpDelayDerefKeyControlBlock(
947     IN PCM_KEY_CONTROL_BLOCK Kcb
948 );
949 
950 VOID
951 NTAPI
952 CmpAddToDelayedClose(
953     IN PCM_KEY_CONTROL_BLOCK Kcb,
954     IN BOOLEAN LockHeldExclusively
955 );
956 
957 VOID
958 NTAPI
959 CmpArmDelayedCloseTimer(
960     VOID
961 );
962 
963 VOID
964 NTAPI
965 CmpRemoveFromDelayedClose(IN PCM_KEY_CONTROL_BLOCK Kcb);
966 
967 VOID
968 NTAPI
969 CmpInitializeDelayedCloseTable(
970     VOID
971 );
972 
973 //
974 // KCB Functions
975 //
976 PCM_KEY_CONTROL_BLOCK
977 NTAPI
978 CmpCreateKeyControlBlock(
979     IN PHHIVE Hive,
980     IN HCELL_INDEX Index,
981     IN PCM_KEY_NODE Node,
982     IN PCM_KEY_CONTROL_BLOCK Parent,
983     IN ULONG Flags,
984     IN PUNICODE_STRING KeyName
985 );
986 
987 PCM_KEY_CONTROL_BLOCK
988 NTAPI
989 CmpAllocateKeyControlBlock(
990     VOID
991 );
992 
993 VOID
994 NTAPI
995 CmpFreeKeyControlBlock(
996     IN PCM_KEY_CONTROL_BLOCK Kcb
997 );
998 
999 VOID
1000 NTAPI
1001 CmpRemoveKeyControlBlock(
1002     IN PCM_KEY_CONTROL_BLOCK Kcb
1003 );
1004 
1005 VOID
1006 NTAPI
1007 CmpCleanUpKcbValueCache(
1008     IN PCM_KEY_CONTROL_BLOCK Kcb
1009 );
1010 
1011 VOID
1012 NTAPI
1013 CmpCleanUpKcbCacheWithLock(
1014     IN PCM_KEY_CONTROL_BLOCK Kcb,
1015     IN BOOLEAN LockHeldExclusively
1016 );
1017 
1018 VOID
1019 NTAPI
1020 CmpCleanUpSubKeyInfo(
1021     IN PCM_KEY_CONTROL_BLOCK Kcb
1022 );
1023 
1024 PUNICODE_STRING
1025 NTAPI
1026 CmpConstructName(
1027     IN PCM_KEY_CONTROL_BLOCK Kcb
1028 );
1029 
1030 BOOLEAN
1031 NTAPI
1032 CmpReferenceKeyControlBlock(
1033     IN PCM_KEY_CONTROL_BLOCK Kcb
1034 );
1035 
1036 VOID
1037 NTAPI
1038 CmpDereferenceKeyControlBlockWithLock(
1039     IN PCM_KEY_CONTROL_BLOCK Kcb,
1040     IN BOOLEAN LockHeldExclusively
1041 );
1042 
1043 VOID
1044 NTAPI
1045 CmpDereferenceKeyControlBlock(
1046     IN PCM_KEY_CONTROL_BLOCK Kcb
1047 );
1048 
1049 VOID
1050 NTAPI
1051 EnlistKeyBodyWithKCB(
1052     IN PCM_KEY_BODY KeyObject,
1053     IN ULONG Flags
1054 );
1055 
1056 VOID
1057 NTAPI
1058 DelistKeyBodyFromKCB(
1059     IN PCM_KEY_BODY KeyBody,
1060     IN BOOLEAN LockHeld
1061 );
1062 
1063 VOID
1064 NTAPI
1065 CmpAcquireTwoKcbLocksExclusiveByKey(
1066     IN ULONG ConvKey1,
1067     IN ULONG ConvKey2
1068 );
1069 
1070 VOID
1071 NTAPI
1072 CmpReleaseTwoKcbLockByKey(
1073     IN ULONG ConvKey1,
1074     IN ULONG ConvKey2
1075 );
1076 
1077 VOID
1078 NTAPI
1079 CmpFlushNotifiesOnKeyBodyList(
1080     IN PCM_KEY_CONTROL_BLOCK Kcb,
1081     IN BOOLEAN LockHeld
1082 );
1083 
1084 //
1085 // Parse Routines
1086 //
1087 BOOLEAN
1088 NTAPI
1089 CmpGetNextName(
1090     IN OUT PUNICODE_STRING RemainingName,
1091     OUT PUNICODE_STRING NextName,
1092     OUT PBOOLEAN LastName
1093 );
1094 
1095 //
1096 // Command Routines (Flush, Open, Close, Init);
1097 //
1098 BOOLEAN
1099 NTAPI
1100 CmpDoFlushAll(
1101     IN BOOLEAN ForceFlush
1102 );
1103 
1104 VOID
1105 NTAPI
1106 CmpShutdownWorkers(
1107     VOID
1108 );
1109 
1110 VOID
1111 NTAPI
1112 CmpCmdInit(
1113     IN BOOLEAN SetupBoot
1114 );
1115 
1116 NTSTATUS
1117 NTAPI
1118 CmpCmdHiveOpen(
1119     IN POBJECT_ATTRIBUTES FileAttributes,
1120     IN PSECURITY_CLIENT_CONTEXT ImpersonationContext,
1121     IN OUT PBOOLEAN Allocate,
1122     OUT PCMHIVE *NewHive,
1123     IN ULONG CheckFlags
1124 );
1125 
1126 VOID
1127 NTAPI
1128 CmpLazyFlush(
1129     VOID
1130 );
1131 
1132 //
1133 // Open/Create Routines
1134 //
1135 NTSTATUS
1136 NTAPI
1137 CmpDoCreate(
1138     IN PHHIVE Hive,
1139     IN HCELL_INDEX Cell,
1140     IN PACCESS_STATE AccessState,
1141     IN PUNICODE_STRING Name,
1142     IN KPROCESSOR_MODE AccessMode,
1143     IN PCM_PARSE_CONTEXT Context,
1144     IN PCM_KEY_CONTROL_BLOCK ParentKcb,
1145     OUT PVOID *Object
1146 );
1147 
1148 NTSTATUS
1149 NTAPI
1150 CmpCreateLinkNode(
1151     IN PHHIVE Hive,
1152     IN HCELL_INDEX Cell,
1153     IN PACCESS_STATE AccessState,
1154     IN UNICODE_STRING Name,
1155     IN KPROCESSOR_MODE AccessMode,
1156     IN ULONG CreateOptions,
1157     IN PCM_PARSE_CONTEXT Context,
1158     IN PCM_KEY_CONTROL_BLOCK ParentKcb,
1159     OUT PVOID *Object
1160 );
1161 
1162 //
1163 // Boot Routines
1164 //
1165 HCELL_INDEX
1166 NTAPI
1167 CmpFindControlSet(
1168     IN PHHIVE SystemHive,
1169     IN HCELL_INDEX RootCell,
1170     IN PUNICODE_STRING SelectKeyName,
1171     OUT PBOOLEAN AutoSelect
1172 );
1173 
1174 VOID
1175 NTAPI
1176 CmGetSystemControlValues(
1177     IN PVOID SystemHiveData,
1178     IN PCM_SYSTEM_CONTROL_VECTOR ControlVector
1179 );
1180 
1181 NTSTATUS
1182 NTAPI
1183 CmpSaveBootControlSet(
1184     IN USHORT ControlSet
1185 );
1186 
1187 //
1188 // Hardware Configuration Routines
1189 //
1190 NTSTATUS
1191 NTAPI
1192 CmpInitializeRegistryNode(
1193     IN PCONFIGURATION_COMPONENT_DATA CurrentEntry,
1194     IN HANDLE NodeHandle,
1195     OUT PHANDLE NewHandle,
1196     IN INTERFACE_TYPE InterfaceType,
1197     IN ULONG BusNumber,
1198     IN PUSHORT DeviceIndexTable
1199 );
1200 
1201 NTSTATUS
1202 NTAPI
1203 CmpInitializeMachineDependentConfiguration(
1204     IN PLOADER_PARAMETER_BLOCK LoaderBlock
1205 );
1206 
1207 NTSTATUS
1208 NTAPI
1209 CmpInitializeHardwareConfiguration(
1210     IN PLOADER_PARAMETER_BLOCK LoaderBlock
1211 );
1212 
1213 //
1214 // Wrapper Routines
1215 //
1216 NTSTATUS
1217 NTAPI
1218 CmpCreateEvent(
1219     IN EVENT_TYPE EventType,
1220     OUT PHANDLE EventHandle,
1221     OUT PKEVENT *Event
1222 );
1223 
1224 PVOID
1225 NTAPI
1226 CmpAllocate(
1227     IN SIZE_T Size,
1228     IN BOOLEAN Paged,
1229     IN ULONG Tag
1230 );
1231 
1232 VOID
1233 NTAPI
1234 CmpFree(
1235     IN PVOID Ptr,
1236     IN ULONG Quota
1237 );
1238 
1239 BOOLEAN
1240 NTAPI
1241 CmpFileRead(
1242     IN PHHIVE RegistryHive,
1243     IN ULONG FileType,
1244     IN OUT PULONG FileOffset,
1245     OUT PVOID Buffer,
1246     IN SIZE_T BufferLength
1247 );
1248 
1249 BOOLEAN
1250 NTAPI
1251 CmpFileWrite(
1252     IN PHHIVE RegistryHive,
1253     IN ULONG FileType,
1254     IN OUT PULONG FileOffset,
1255     IN PVOID Buffer,
1256     IN SIZE_T BufferLength
1257 );
1258 
1259 BOOLEAN
1260 NTAPI
1261 CmpFileSetSize(
1262     IN PHHIVE RegistryHive,
1263     IN ULONG FileType,
1264     IN ULONG FileSize,
1265     IN ULONG OldFileSize
1266 );
1267 
1268 BOOLEAN
1269 NTAPI
1270 CmpFileFlush(
1271    IN PHHIVE RegistryHive,
1272    IN ULONG FileType,
1273    IN OUT PLARGE_INTEGER FileOffset,
1274    IN ULONG Length
1275 );
1276 
1277 //
1278 // Configuration Manager side of Registry System Calls
1279 //
1280 NTSTATUS
1281 NTAPI
1282 CmEnumerateValueKey(
1283     IN PCM_KEY_CONTROL_BLOCK Kcb,
1284     IN ULONG Index,
1285     IN KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass,
1286     IN PVOID KeyValueInformation,
1287     IN ULONG Length,
1288     IN PULONG ResultLength);
1289 
1290 NTSTATUS
1291 NTAPI
1292 CmSetValueKey(
1293     IN PCM_KEY_CONTROL_BLOCK Kcb,
1294     IN PUNICODE_STRING ValueName,
1295     IN ULONG Type,
1296     IN PVOID Data,
1297     IN ULONG DataSize);
1298 
1299 NTSTATUS
1300 NTAPI
1301 CmQueryKey(IN PCM_KEY_CONTROL_BLOCK Kcb,
1302     IN KEY_INFORMATION_CLASS KeyInformationClass,
1303     IN PVOID KeyInformation,
1304     IN ULONG Length,
1305     IN PULONG ResultLength
1306 );
1307 
1308 NTSTATUS
1309 NTAPI
1310 CmEnumerateKey(IN PCM_KEY_CONTROL_BLOCK Kcb,
1311     IN ULONG Index,
1312     IN KEY_INFORMATION_CLASS KeyInformationClass,
1313     IN PVOID KeyInformation,
1314     IN ULONG Length,
1315     IN PULONG ResultLength
1316 );
1317 
1318 NTSTATUS
1319 NTAPI
1320 CmDeleteKey(
1321     IN PCM_KEY_BODY KeyBody
1322 );
1323 
1324 NTSTATUS
1325 NTAPI
1326 CmFlushKey(
1327     IN PCM_KEY_CONTROL_BLOCK Kcb,
1328     IN BOOLEAN EclusiveLock
1329 );
1330 
1331 NTSTATUS
1332 NTAPI
1333 CmDeleteValueKey(
1334     IN PCM_KEY_CONTROL_BLOCK Kcb,
1335     IN UNICODE_STRING ValueName
1336 );
1337 
1338 NTSTATUS
1339 NTAPI
1340 CmQueryValueKey(
1341     IN PCM_KEY_CONTROL_BLOCK Kcb,
1342     IN UNICODE_STRING ValueName,
1343     IN KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass,
1344     IN PVOID KeyValueInformation,
1345     IN ULONG Length,
1346     IN PULONG ResultLength
1347 );
1348 
1349 NTSTATUS
1350 NTAPI
1351 CmLoadKey(
1352     IN POBJECT_ATTRIBUTES TargetKey,
1353     IN POBJECT_ATTRIBUTES SourceFile,
1354     IN ULONG Flags,
1355     IN PCM_KEY_BODY KeyBody
1356 );
1357 
1358 NTSTATUS
1359 NTAPI
1360 CmUnloadKey(
1361     IN PCM_KEY_CONTROL_BLOCK Kcb,
1362     IN ULONG Flags
1363 );
1364 
1365 ULONG
1366 NTAPI
1367 CmpEnumerateOpenSubKeys(
1368     IN PCM_KEY_CONTROL_BLOCK RootKcb,
1369     IN BOOLEAN RemoveEmptyCacheEntries,
1370     IN BOOLEAN DereferenceOpenedEntries
1371 );
1372 
1373 HCELL_INDEX
1374 NTAPI
1375 CmpCopyCell(
1376     IN PHHIVE SourceHive,
1377     IN HCELL_INDEX SourceCell,
1378     IN PHHIVE DestinationHive,
1379     IN HSTORAGE_TYPE StorageType
1380 );
1381 
1382 NTSTATUS
1383 NTAPI
1384 CmpDeepCopyKey(
1385     IN PHHIVE SourceHive,
1386     IN HCELL_INDEX SrcKeyCell,
1387     IN PHHIVE DestinationHive,
1388     IN HSTORAGE_TYPE StorageType,
1389     OUT PHCELL_INDEX DestKeyCell OPTIONAL
1390 );
1391 
1392 NTSTATUS
1393 NTAPI
1394 CmSaveKey(
1395     IN PCM_KEY_CONTROL_BLOCK Kcb,
1396     IN HANDLE FileHandle,
1397     IN ULONG Flags
1398 );
1399 
1400 NTSTATUS
1401 NTAPI
1402 CmSaveMergedKeys(
1403     IN PCM_KEY_CONTROL_BLOCK HighKcb,
1404     IN PCM_KEY_CONTROL_BLOCK LowKcb,
1405     IN HANDLE FileHandle
1406 );
1407 
1408 //
1409 // Startup and Shutdown
1410 //
1411 BOOLEAN
1412 NTAPI
1413 CmInitSystem1(
1414     VOID
1415 );
1416 
1417 VOID
1418 NTAPI
1419 CmShutdownSystem(
1420     VOID
1421 );
1422 
1423 VOID
1424 NTAPI
1425 CmSetLazyFlushState(
1426     IN BOOLEAN Enable
1427 );
1428 
1429 VOID
1430 NTAPI
1431 CmpSetVersionData(
1432     VOID
1433 );
1434 
1435 //
1436 // Driver List Routines
1437 //
1438 PUNICODE_STRING*
1439 NTAPI
1440 CmGetSystemDriverList(
1441     VOID
1442 );
1443 
1444 BOOLEAN
1445 NTAPI
1446 CmpFindDrivers(
1447     IN PHHIVE Hive,
1448     IN HCELL_INDEX ControlSet,
1449     IN SERVICE_LOAD_TYPE LoadType,
1450     IN PWSTR BootFileSystem OPTIONAL,
1451     IN PLIST_ENTRY DriverListHead
1452 );
1453 
1454 BOOLEAN
1455 NTAPI
1456 CmpSortDriverList(
1457     IN PHHIVE Hive,
1458     IN HCELL_INDEX ControlSet,
1459     IN PLIST_ENTRY DriverListHead
1460 );
1461 
1462 BOOLEAN
1463 NTAPI
1464 CmpResolveDriverDependencies(
1465     IN PLIST_ENTRY DriverListHead
1466 );
1467 
1468 BOOLEAN
1469 NTAPI
1470 CmpIsSafe(
1471     IN PHHIVE Hive,
1472     IN HCELL_INDEX SafeBootCell,
1473     IN HCELL_INDEX DriverCell);
1474 
1475 //
1476 // Global variables accessible from all of Cm
1477 //
1478 extern ULONG CmpTraceLevel;
1479 extern BOOLEAN CmpSpecialBootCondition;
1480 extern BOOLEAN CmpFlushOnLockRelease;
1481 extern BOOLEAN CmpShareSystemHives;
1482 extern BOOLEAN CmpMiniNTBoot;
1483 extern BOOLEAN CmpNoVolatileCreates;
1484 extern EX_PUSH_LOCK CmpHiveListHeadLock, CmpLoadHiveLock;
1485 extern LIST_ENTRY CmpHiveListHead;
1486 extern POBJECT_TYPE CmpKeyObjectType;
1487 extern ERESOURCE CmpRegistryLock;
1488 extern PCM_KEY_HASH_TABLE_ENTRY CmpCacheTable;
1489 extern PCM_NAME_HASH_TABLE_ENTRY CmpNameCacheTable;
1490 extern KGUARDED_MUTEX CmpDelayedCloseTableLock;
1491 extern CMHIVE CmControlHive;
1492 extern WCHAR CmDefaultLanguageId[];
1493 extern ULONG CmDefaultLanguageIdLength;
1494 extern ULONG CmDefaultLanguageIdType;
1495 extern WCHAR CmInstallUILanguageId[];
1496 extern ULONG CmInstallUILanguageIdLength;
1497 extern ULONG CmInstallUILanguageIdType;
1498 extern ULONG CmNtGlobalFlag;
1499 extern LANGID PsInstallUILanguageId;
1500 extern LANGID PsDefaultUILanguageId;
1501 extern CM_SYSTEM_CONTROL_VECTOR CmControlVector[];
1502 extern ULONG CmpConfigurationAreaSize;
1503 extern PCM_FULL_RESOURCE_DESCRIPTOR CmpConfigurationData;
1504 extern UNICODE_STRING CmTypeName[];
1505 extern UNICODE_STRING CmClassName[];
1506 extern CMP_MF_TYPE CmpMultifunctionTypes[];
1507 extern USHORT CmpUnknownBusCount;
1508 extern ULONG CmpTypeCount[MaximumType + 1];
1509 extern HIVE_LIST_ENTRY CmpMachineHiveList[];
1510 extern UNICODE_STRING CmSymbolicLinkValueName;
1511 extern UNICODE_STRING CmpSystemStartOptions;
1512 extern UNICODE_STRING CmpLoadOptions;
1513 extern BOOLEAN CmSelfHeal;
1514 extern BOOLEAN CmpSelfHeal;
1515 extern ULONG CmpBootType;
1516 extern HANDLE CmpRegistryRootHandle;
1517 extern BOOLEAN ExpInTextModeSetup;
1518 extern BOOLEAN InitIsWinPEMode;
1519 extern ULONG CmpHashTableSize;
1520 extern ULONG CmpDelayedCloseSize, CmpDelayedCloseIndex;
1521 extern BOOLEAN CmpNoWrite;
1522 extern BOOLEAN CmpForceForceFlush;
1523 extern BOOLEAN CmpWasSetupBoot;
1524 extern BOOLEAN CmpProfileLoaded;
1525 extern PCMHIVE CmiVolatileHive;
1526 extern LIST_ENTRY CmiKeyObjectListHead;
1527 extern BOOLEAN CmpHoldLazyFlush;
1528 
1529 //
1530 // Inlined functions
1531 //
1532 #include "cm_x.h"
1533