xref: /reactos/ntoskrnl/include/internal/cm.h (revision 7115d7ba)
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 INIT_FUNCTION
699 VOID
700 NTAPI
701 CmpInitCallback(
702     VOID
703 );
704 
705 //
706 // KCB Cache/Delay Routines
707 //
708 INIT_FUNCTION
709 VOID
710 NTAPI
711 CmpInitializeCache(
712     VOID
713 );
714 
715 INIT_FUNCTION
716 VOID
717 NTAPI
718 CmpInitCmPrivateDelayAlloc(
719     VOID
720 );
721 
722 INIT_FUNCTION
723 VOID
724 NTAPI
725 CmpInitCmPrivateAlloc(
726     VOID
727 );
728 
729 INIT_FUNCTION
730 VOID
731 NTAPI
732 CmpInitDelayDerefKCBEngine(
733     VOID
734 );
735 
736 //
737 // Key Object Routines
738 //
739 VOID
740 NTAPI
741 CmpCloseKeyObject(
742     IN PEPROCESS Process OPTIONAL,
743     IN PVOID Object,
744     IN ACCESS_MASK GrantedAccess,
745     IN ULONG ProcessHandleCount,
746     IN ULONG SystemHandleCount
747 );
748 
749 VOID
750 NTAPI
751 CmpDeleteKeyObject(
752     IN PVOID Object
753 );
754 
755 NTSTATUS
756 NTAPI
757 CmpParseKey(
758     IN PVOID ParseObject,
759     IN PVOID ObjectType,
760     IN OUT PACCESS_STATE AccessState,
761     IN KPROCESSOR_MODE AccessMode,
762     IN ULONG Attributes,
763     IN OUT PUNICODE_STRING CompleteName,
764     IN OUT PUNICODE_STRING RemainingName,
765     IN OUT PVOID Context OPTIONAL,
766     IN PSECURITY_QUALITY_OF_SERVICE SecurityQos OPTIONAL,
767     OUT PVOID *Object
768 );
769 
770 NTSTATUS
771 NTAPI
772 CmpSecurityMethod(
773     IN PVOID Object,
774     IN SECURITY_OPERATION_CODE OperationType,
775     IN PSECURITY_INFORMATION SecurityInformation,
776     IN PSECURITY_DESCRIPTOR SecurityDescriptor,
777     IN OUT PULONG CapturedLength,
778     IN OUT PSECURITY_DESCRIPTOR *ObjectSecurityDescriptor,
779     IN POOL_TYPE PoolType,
780     IN PGENERIC_MAPPING GenericMapping
781 );
782 
783 NTSTATUS
784 NTAPI
785 CmpQueryKeyName(
786     IN PVOID Object,
787     IN BOOLEAN HasObjectName,
788     OUT POBJECT_NAME_INFORMATION ObjectNameInfo,
789     IN ULONG Length,
790     OUT PULONG ReturnLength,
791     IN KPROCESSOR_MODE AccessMode
792 );
793 
794 //
795 // Hive Routines
796 //
797 NTSTATUS
798 NTAPI
799 CmpInitializeHive(
800     OUT PCMHIVE *CmHive,
801     IN ULONG OperationType,
802     IN ULONG HiveFlags,
803     IN ULONG FileType,
804     IN PVOID HiveData OPTIONAL,
805     IN HANDLE Primary,
806     IN HANDLE Log,
807     IN HANDLE External,
808     IN PCUNICODE_STRING FileName OPTIONAL,
809     IN ULONG CheckFlags
810 );
811 
812 NTSTATUS
813 NTAPI
814 CmpDestroyHive(
815     IN PCMHIVE CmHive
816 );
817 
818 PSECURITY_DESCRIPTOR
819 NTAPI
820 CmpHiveRootSecurityDescriptor(
821     VOID
822 );
823 
824 NTSTATUS
825 NTAPI
826 CmpLinkHiveToMaster(
827     IN PUNICODE_STRING LinkName,
828     IN HANDLE RootDirectory,
829     IN PCMHIVE CmHive,
830     IN BOOLEAN Allocate,
831     IN PSECURITY_DESCRIPTOR SecurityDescriptor
832 );
833 
834 NTSTATUS
835 NTAPI
836 CmpOpenHiveFiles(
837     IN PCUNICODE_STRING BaseName,
838     IN PCWSTR Extension OPTIONAL,
839     OUT PHANDLE Primary,
840     OUT PHANDLE Log,
841     OUT PULONG PrimaryDisposition,
842     OUT PULONG LogDisposition,
843     IN BOOLEAN CreateAllowed,
844     IN BOOLEAN MarkAsSystemHive,
845     IN BOOLEAN NoBuffering,
846     OUT PULONG ClusterSize OPTIONAL
847 );
848 
849 VOID
850 NTAPI
851 CmpCloseHiveFiles(
852     IN PCMHIVE Hive
853 );
854 
855 NTSTATUS
856 NTAPI
857 CmpInitHiveFromFile(
858     IN PCUNICODE_STRING HiveName,
859     IN ULONG HiveFlags,
860     OUT PCMHIVE *Hive,
861     IN OUT PBOOLEAN New,
862     IN ULONG CheckFlags
863 );
864 
865 VOID
866 NTAPI
867 CmpInitializeHiveList(
868     VOID
869 );
870 
871 //
872 // Registry Utility Functions
873 //
874 BOOLEAN
875 NTAPI
876 CmpTestRegistryLockExclusive(
877     VOID
878 );
879 
880 BOOLEAN
881 NTAPI
882 CmpTestRegistryLock(
883     VOID
884 );
885 
886 VOID
887 NTAPI
888 CmpLockRegistryExclusive(
889     VOID
890 );
891 
892 VOID
893 NTAPI
894 CmpLockRegistry(
895     VOID
896 );
897 
898 VOID
899 NTAPI
900 CmpUnlockRegistry(
901     VOID
902 );
903 
904 VOID
905 NTAPI
906 CmpLockHiveFlusherExclusive(
907     IN PCMHIVE Hive
908 );
909 
910 VOID
911 NTAPI
912 CmpLockHiveFlusherShared(
913     IN PCMHIVE Hive
914 );
915 
916 BOOLEAN
917 NTAPI
918 CmpTestHiveFlusherLockExclusive(
919     IN PCMHIVE Hive
920 );
921 
922 BOOLEAN
923 NTAPI
924 CmpTestHiveFlusherLockShared(
925     IN PCMHIVE Hive
926 );
927 
928 VOID
929 NTAPI
930 CmpUnlockHiveFlusher(
931     IN PCMHIVE Hive
932 );
933 
934 //
935 // Delay Functions
936 //
937 PVOID
938 NTAPI
939 CmpAllocateDelayItem(
940     VOID
941 );
942 
943 VOID
944 NTAPI
945 CmpFreeDelayItem(
946     PVOID Entry
947 );
948 
949 VOID
950 NTAPI
951 CmpDelayDerefKeyControlBlock(
952     IN PCM_KEY_CONTROL_BLOCK Kcb
953 );
954 
955 VOID
956 NTAPI
957 CmpAddToDelayedClose(
958     IN PCM_KEY_CONTROL_BLOCK Kcb,
959     IN BOOLEAN LockHeldExclusively
960 );
961 
962 VOID
963 NTAPI
964 CmpArmDelayedCloseTimer(
965     VOID
966 );
967 
968 VOID
969 NTAPI
970 CmpRemoveFromDelayedClose(IN PCM_KEY_CONTROL_BLOCK Kcb);
971 
972 INIT_FUNCTION
973 VOID
974 NTAPI
975 CmpInitializeDelayedCloseTable(
976     VOID
977 );
978 
979 //
980 // KCB Functions
981 //
982 PCM_KEY_CONTROL_BLOCK
983 NTAPI
984 CmpCreateKeyControlBlock(
985     IN PHHIVE Hive,
986     IN HCELL_INDEX Index,
987     IN PCM_KEY_NODE Node,
988     IN PCM_KEY_CONTROL_BLOCK Parent,
989     IN ULONG Flags,
990     IN PUNICODE_STRING KeyName
991 );
992 
993 PCM_KEY_CONTROL_BLOCK
994 NTAPI
995 CmpAllocateKeyControlBlock(
996     VOID
997 );
998 
999 VOID
1000 NTAPI
1001 CmpFreeKeyControlBlock(
1002     IN PCM_KEY_CONTROL_BLOCK Kcb
1003 );
1004 
1005 VOID
1006 NTAPI
1007 CmpRemoveKeyControlBlock(
1008     IN PCM_KEY_CONTROL_BLOCK Kcb
1009 );
1010 
1011 VOID
1012 NTAPI
1013 CmpCleanUpKcbValueCache(
1014     IN PCM_KEY_CONTROL_BLOCK Kcb
1015 );
1016 
1017 VOID
1018 NTAPI
1019 CmpCleanUpKcbCacheWithLock(
1020     IN PCM_KEY_CONTROL_BLOCK Kcb,
1021     IN BOOLEAN LockHeldExclusively
1022 );
1023 
1024 VOID
1025 NTAPI
1026 CmpCleanUpSubKeyInfo(
1027     IN PCM_KEY_CONTROL_BLOCK Kcb
1028 );
1029 
1030 PUNICODE_STRING
1031 NTAPI
1032 CmpConstructName(
1033     IN PCM_KEY_CONTROL_BLOCK Kcb
1034 );
1035 
1036 BOOLEAN
1037 NTAPI
1038 CmpReferenceKeyControlBlock(
1039     IN PCM_KEY_CONTROL_BLOCK Kcb
1040 );
1041 
1042 VOID
1043 NTAPI
1044 CmpDereferenceKeyControlBlockWithLock(
1045     IN PCM_KEY_CONTROL_BLOCK Kcb,
1046     IN BOOLEAN LockHeldExclusively
1047 );
1048 
1049 VOID
1050 NTAPI
1051 CmpDereferenceKeyControlBlock(
1052     IN PCM_KEY_CONTROL_BLOCK Kcb
1053 );
1054 
1055 VOID
1056 NTAPI
1057 EnlistKeyBodyWithKCB(
1058     IN PCM_KEY_BODY KeyObject,
1059     IN ULONG Flags
1060 );
1061 
1062 VOID
1063 NTAPI
1064 DelistKeyBodyFromKCB(
1065     IN PCM_KEY_BODY KeyBody,
1066     IN BOOLEAN LockHeld
1067 );
1068 
1069 VOID
1070 NTAPI
1071 CmpAcquireTwoKcbLocksExclusiveByKey(
1072     IN ULONG ConvKey1,
1073     IN ULONG ConvKey2
1074 );
1075 
1076 VOID
1077 NTAPI
1078 CmpReleaseTwoKcbLockByKey(
1079     IN ULONG ConvKey1,
1080     IN ULONG ConvKey2
1081 );
1082 
1083 VOID
1084 NTAPI
1085 CmpFlushNotifiesOnKeyBodyList(
1086     IN PCM_KEY_CONTROL_BLOCK Kcb,
1087     IN BOOLEAN LockHeld
1088 );
1089 
1090 //
1091 // Parse Routines
1092 //
1093 BOOLEAN
1094 NTAPI
1095 CmpGetNextName(
1096     IN OUT PUNICODE_STRING RemainingName,
1097     OUT PUNICODE_STRING NextName,
1098     OUT PBOOLEAN LastName
1099 );
1100 
1101 //
1102 // Command Routines (Flush, Open, Close, Init);
1103 //
1104 BOOLEAN
1105 NTAPI
1106 CmpDoFlushAll(
1107     IN BOOLEAN ForceFlush
1108 );
1109 
1110 VOID
1111 NTAPI
1112 CmpShutdownWorkers(
1113     VOID
1114 );
1115 
1116 VOID
1117 NTAPI
1118 CmpCmdInit(
1119     IN BOOLEAN SetupBoot
1120 );
1121 
1122 NTSTATUS
1123 NTAPI
1124 CmpCmdHiveOpen(
1125     IN POBJECT_ATTRIBUTES FileAttributes,
1126     IN PSECURITY_CLIENT_CONTEXT ImpersonationContext,
1127     IN OUT PBOOLEAN Allocate,
1128     OUT PCMHIVE *NewHive,
1129     IN ULONG CheckFlags
1130 );
1131 
1132 VOID
1133 NTAPI
1134 CmpLazyFlush(
1135     VOID
1136 );
1137 
1138 //
1139 // Open/Create Routines
1140 //
1141 NTSTATUS
1142 NTAPI
1143 CmpDoCreate(
1144     IN PHHIVE Hive,
1145     IN HCELL_INDEX Cell,
1146     IN PACCESS_STATE AccessState,
1147     IN PUNICODE_STRING Name,
1148     IN KPROCESSOR_MODE AccessMode,
1149     IN PCM_PARSE_CONTEXT Context,
1150     IN PCM_KEY_CONTROL_BLOCK ParentKcb,
1151     OUT PVOID *Object
1152 );
1153 
1154 NTSTATUS
1155 NTAPI
1156 CmpCreateLinkNode(
1157     IN PHHIVE Hive,
1158     IN HCELL_INDEX Cell,
1159     IN PACCESS_STATE AccessState,
1160     IN UNICODE_STRING Name,
1161     IN KPROCESSOR_MODE AccessMode,
1162     IN ULONG CreateOptions,
1163     IN PCM_PARSE_CONTEXT Context,
1164     IN PCM_KEY_CONTROL_BLOCK ParentKcb,
1165     OUT PVOID *Object
1166 );
1167 
1168 //
1169 // Boot Routines
1170 //
1171 INIT_FUNCTION
1172 HCELL_INDEX
1173 NTAPI
1174 CmpFindControlSet(
1175     IN PHHIVE SystemHive,
1176     IN HCELL_INDEX RootCell,
1177     IN PUNICODE_STRING SelectKeyName,
1178     OUT PBOOLEAN AutoSelect
1179 );
1180 
1181 INIT_FUNCTION
1182 VOID
1183 NTAPI
1184 CmGetSystemControlValues(
1185     IN PVOID SystemHiveData,
1186     IN PCM_SYSTEM_CONTROL_VECTOR ControlVector
1187 );
1188 
1189 NTSTATUS
1190 NTAPI
1191 CmpSaveBootControlSet(
1192     IN USHORT ControlSet
1193 );
1194 
1195 //
1196 // Hardware Configuration Routines
1197 //
1198 INIT_FUNCTION
1199 NTSTATUS
1200 NTAPI
1201 CmpInitializeRegistryNode(
1202     IN PCONFIGURATION_COMPONENT_DATA CurrentEntry,
1203     IN HANDLE NodeHandle,
1204     OUT PHANDLE NewHandle,
1205     IN INTERFACE_TYPE InterfaceType,
1206     IN ULONG BusNumber,
1207     IN PUSHORT DeviceIndexTable
1208 );
1209 
1210 NTSTATUS
1211 NTAPI
1212 CmpInitializeMachineDependentConfiguration(
1213     IN PLOADER_PARAMETER_BLOCK LoaderBlock
1214 );
1215 
1216 INIT_FUNCTION
1217 NTSTATUS
1218 NTAPI
1219 CmpInitializeHardwareConfiguration(
1220     IN PLOADER_PARAMETER_BLOCK LoaderBlock
1221 );
1222 
1223 //
1224 // Wrapper Routines
1225 //
1226 NTSTATUS
1227 NTAPI
1228 CmpCreateEvent(
1229     IN EVENT_TYPE EventType,
1230     OUT PHANDLE EventHandle,
1231     OUT PKEVENT *Event
1232 );
1233 
1234 PVOID
1235 NTAPI
1236 CmpAllocate(
1237     IN SIZE_T Size,
1238     IN BOOLEAN Paged,
1239     IN ULONG Tag
1240 );
1241 
1242 VOID
1243 NTAPI
1244 CmpFree(
1245     IN PVOID Ptr,
1246     IN ULONG Quota
1247 );
1248 
1249 BOOLEAN
1250 NTAPI
1251 CmpFileRead(
1252     IN PHHIVE RegistryHive,
1253     IN ULONG FileType,
1254     IN OUT PULONG FileOffset,
1255     OUT PVOID Buffer,
1256     IN SIZE_T BufferLength
1257 );
1258 
1259 BOOLEAN
1260 NTAPI
1261 CmpFileWrite(
1262     IN PHHIVE RegistryHive,
1263     IN ULONG FileType,
1264     IN OUT PULONG FileOffset,
1265     IN PVOID Buffer,
1266     IN SIZE_T BufferLength
1267 );
1268 
1269 BOOLEAN
1270 NTAPI
1271 CmpFileSetSize(
1272     IN PHHIVE RegistryHive,
1273     IN ULONG FileType,
1274     IN ULONG FileSize,
1275     IN ULONG OldFileSize
1276 );
1277 
1278 BOOLEAN
1279 NTAPI
1280 CmpFileFlush(
1281    IN PHHIVE RegistryHive,
1282    IN ULONG FileType,
1283    IN OUT PLARGE_INTEGER FileOffset,
1284    IN ULONG Length
1285 );
1286 
1287 //
1288 // Configuration Manager side of Registry System Calls
1289 //
1290 NTSTATUS
1291 NTAPI
1292 CmEnumerateValueKey(
1293     IN PCM_KEY_CONTROL_BLOCK Kcb,
1294     IN ULONG Index,
1295     IN KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass,
1296     IN PVOID KeyValueInformation,
1297     IN ULONG Length,
1298     IN PULONG ResultLength);
1299 
1300 NTSTATUS
1301 NTAPI
1302 CmSetValueKey(
1303     IN PCM_KEY_CONTROL_BLOCK Kcb,
1304     IN PUNICODE_STRING ValueName,
1305     IN ULONG Type,
1306     IN PVOID Data,
1307     IN ULONG DataSize);
1308 
1309 NTSTATUS
1310 NTAPI
1311 CmQueryKey(IN PCM_KEY_CONTROL_BLOCK Kcb,
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 CmEnumerateKey(IN PCM_KEY_CONTROL_BLOCK Kcb,
1321     IN ULONG Index,
1322     IN KEY_INFORMATION_CLASS KeyInformationClass,
1323     IN PVOID KeyInformation,
1324     IN ULONG Length,
1325     IN PULONG ResultLength
1326 );
1327 
1328 NTSTATUS
1329 NTAPI
1330 CmDeleteKey(
1331     IN PCM_KEY_BODY KeyBody
1332 );
1333 
1334 NTSTATUS
1335 NTAPI
1336 CmFlushKey(
1337     IN PCM_KEY_CONTROL_BLOCK Kcb,
1338     IN BOOLEAN EclusiveLock
1339 );
1340 
1341 NTSTATUS
1342 NTAPI
1343 CmDeleteValueKey(
1344     IN PCM_KEY_CONTROL_BLOCK Kcb,
1345     IN UNICODE_STRING ValueName
1346 );
1347 
1348 NTSTATUS
1349 NTAPI
1350 CmQueryValueKey(
1351     IN PCM_KEY_CONTROL_BLOCK Kcb,
1352     IN UNICODE_STRING ValueName,
1353     IN KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass,
1354     IN PVOID KeyValueInformation,
1355     IN ULONG Length,
1356     IN PULONG ResultLength
1357 );
1358 
1359 NTSTATUS
1360 NTAPI
1361 CmLoadKey(
1362     IN POBJECT_ATTRIBUTES TargetKey,
1363     IN POBJECT_ATTRIBUTES SourceFile,
1364     IN ULONG Flags,
1365     IN PCM_KEY_BODY KeyBody
1366 );
1367 
1368 NTSTATUS
1369 NTAPI
1370 CmUnloadKey(
1371     IN PCM_KEY_CONTROL_BLOCK Kcb,
1372     IN ULONG Flags
1373 );
1374 
1375 ULONG
1376 NTAPI
1377 CmpEnumerateOpenSubKeys(
1378     IN PCM_KEY_CONTROL_BLOCK RootKcb,
1379     IN BOOLEAN RemoveEmptyCacheEntries,
1380     IN BOOLEAN DereferenceOpenedEntries
1381 );
1382 
1383 HCELL_INDEX
1384 NTAPI
1385 CmpCopyCell(
1386     IN PHHIVE SourceHive,
1387     IN HCELL_INDEX SourceCell,
1388     IN PHHIVE DestinationHive,
1389     IN HSTORAGE_TYPE StorageType
1390 );
1391 
1392 NTSTATUS
1393 NTAPI
1394 CmpDeepCopyKey(
1395     IN PHHIVE SourceHive,
1396     IN HCELL_INDEX SrcKeyCell,
1397     IN PHHIVE DestinationHive,
1398     IN HSTORAGE_TYPE StorageType,
1399     OUT PHCELL_INDEX DestKeyCell OPTIONAL
1400 );
1401 
1402 NTSTATUS
1403 NTAPI
1404 CmSaveKey(
1405     IN PCM_KEY_CONTROL_BLOCK Kcb,
1406     IN HANDLE FileHandle,
1407     IN ULONG Flags
1408 );
1409 
1410 NTSTATUS
1411 NTAPI
1412 CmSaveMergedKeys(
1413     IN PCM_KEY_CONTROL_BLOCK HighKcb,
1414     IN PCM_KEY_CONTROL_BLOCK LowKcb,
1415     IN HANDLE FileHandle
1416 );
1417 
1418 //
1419 // Startup and Shutdown
1420 //
1421 INIT_FUNCTION
1422 BOOLEAN
1423 NTAPI
1424 CmInitSystem1(
1425     VOID
1426 );
1427 
1428 VOID
1429 NTAPI
1430 CmShutdownSystem(
1431     VOID
1432 );
1433 
1434 VOID
1435 NTAPI
1436 CmSetLazyFlushState(
1437     IN BOOLEAN Enable
1438 );
1439 
1440 VOID
1441 NTAPI
1442 CmpSetVersionData(
1443     VOID
1444 );
1445 
1446 //
1447 // Driver List Routines
1448 //
1449 INIT_FUNCTION
1450 PUNICODE_STRING*
1451 NTAPI
1452 CmGetSystemDriverList(
1453     VOID
1454 );
1455 
1456 INIT_FUNCTION
1457 BOOLEAN
1458 NTAPI
1459 CmpFindDrivers(
1460     IN PHHIVE Hive,
1461     IN HCELL_INDEX ControlSet,
1462     IN SERVICE_LOAD_TYPE LoadType,
1463     IN PWSTR BootFileSystem OPTIONAL,
1464     IN PLIST_ENTRY DriverListHead
1465 );
1466 
1467 INIT_FUNCTION
1468 BOOLEAN
1469 NTAPI
1470 CmpSortDriverList(
1471     IN PHHIVE Hive,
1472     IN HCELL_INDEX ControlSet,
1473     IN PLIST_ENTRY DriverListHead
1474 );
1475 
1476 INIT_FUNCTION
1477 BOOLEAN
1478 NTAPI
1479 CmpResolveDriverDependencies(
1480     IN PLIST_ENTRY DriverListHead
1481 );
1482 
1483 INIT_FUNCTION
1484 BOOLEAN
1485 NTAPI
1486 CmpIsSafe(
1487     IN PHHIVE Hive,
1488     IN HCELL_INDEX SafeBootCell,
1489     IN HCELL_INDEX DriverCell);
1490 
1491 //
1492 // Global variables accessible from all of Cm
1493 //
1494 extern ULONG CmpTraceLevel;
1495 extern BOOLEAN CmpSpecialBootCondition;
1496 extern BOOLEAN CmpFlushOnLockRelease;
1497 extern BOOLEAN CmpShareSystemHives;
1498 extern BOOLEAN CmpMiniNTBoot;
1499 extern BOOLEAN CmpNoVolatileCreates;
1500 extern EX_PUSH_LOCK CmpHiveListHeadLock, CmpLoadHiveLock;
1501 extern LIST_ENTRY CmpHiveListHead;
1502 extern POBJECT_TYPE CmpKeyObjectType;
1503 extern ERESOURCE CmpRegistryLock;
1504 extern PCM_KEY_HASH_TABLE_ENTRY CmpCacheTable;
1505 extern PCM_NAME_HASH_TABLE_ENTRY CmpNameCacheTable;
1506 extern KGUARDED_MUTEX CmpDelayedCloseTableLock;
1507 extern CMHIVE CmControlHive;
1508 extern WCHAR CmDefaultLanguageId[];
1509 extern ULONG CmDefaultLanguageIdLength;
1510 extern ULONG CmDefaultLanguageIdType;
1511 extern WCHAR CmInstallUILanguageId[];
1512 extern ULONG CmInstallUILanguageIdLength;
1513 extern ULONG CmInstallUILanguageIdType;
1514 extern ULONG CmNtGlobalFlag;
1515 extern LANGID PsInstallUILanguageId;
1516 extern LANGID PsDefaultUILanguageId;
1517 extern CM_SYSTEM_CONTROL_VECTOR CmControlVector[];
1518 extern ULONG CmpConfigurationAreaSize;
1519 extern PCM_FULL_RESOURCE_DESCRIPTOR CmpConfigurationData;
1520 extern UNICODE_STRING CmTypeName[];
1521 extern UNICODE_STRING CmClassName[];
1522 extern CMP_MF_TYPE CmpMultifunctionTypes[];
1523 extern USHORT CmpUnknownBusCount;
1524 extern ULONG CmpTypeCount[MaximumType + 1];
1525 extern HIVE_LIST_ENTRY CmpMachineHiveList[];
1526 extern UNICODE_STRING CmSymbolicLinkValueName;
1527 extern UNICODE_STRING CmpSystemStartOptions;
1528 extern UNICODE_STRING CmpLoadOptions;
1529 extern BOOLEAN CmSelfHeal;
1530 extern BOOLEAN CmpSelfHeal;
1531 extern ULONG CmpBootType;
1532 extern HANDLE CmpRegistryRootHandle;
1533 extern BOOLEAN ExpInTextModeSetup;
1534 extern BOOLEAN InitIsWinPEMode;
1535 extern ULONG CmpHashTableSize;
1536 extern ULONG CmpDelayedCloseSize, CmpDelayedCloseIndex;
1537 extern BOOLEAN CmpNoWrite;
1538 extern BOOLEAN CmpForceForceFlush;
1539 extern BOOLEAN CmpWasSetupBoot;
1540 extern BOOLEAN CmpProfileLoaded;
1541 extern PCMHIVE CmiVolatileHive;
1542 extern LIST_ENTRY CmiKeyObjectListHead;
1543 extern BOOLEAN CmpHoldLazyFlush;
1544 
1545 //
1546 // Inlined functions
1547 //
1548 #include "cm_x.h"
1549