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