[NTOS] Drastically reduce the hackish function CmpGetRegistryPath() for the text...
[reactos.git] / ntoskrnl / config / cmdata.c
1 /*
2 * PROJECT: ReactOS Kernel
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: ntoskrnl/config/cmdata.c
5 * PURPOSE: Configuration Manager - Global Configuration Data
6 * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
7 */
8
9 /* INCLUDES ******************************************************************/
10
11 #include "ntoskrnl.h"
12 #define NDEBUG
13 #include "debug.h"
14 #include "./../mm/ARM3/miarm.h"
15
16 /* GLOBALS *******************************************************************/
17
18 ULONG DummyData;
19 ULONG CmNtGlobalFlag;
20 extern ULONG MmProductType;
21
22 WCHAR CmDefaultLanguageId[12];
23 ULONG CmDefaultLanguageIdLength = sizeof(CmDefaultLanguageId);
24 ULONG CmDefaultLanguageIdType;
25
26 WCHAR CmInstallUILanguageId[12];
27 ULONG CmInstallUILanguageIdLength = sizeof(CmInstallUILanguageId);
28 ULONG CmInstallUILanguageIdType;
29
30 WCHAR CmSuiteBuffer[128];
31 ULONG CmSuiteBufferLength = sizeof(CmSuiteBuffer);
32 ULONG CmSuiteBufferType;
33
34 CMHIVE CmControlHive;
35
36 ULONG CmpConfigurationAreaSize = PAGE_SIZE * 4;
37 PCM_FULL_RESOURCE_DESCRIPTOR CmpConfigurationData;
38
39 EX_PUSH_LOCK CmpHiveListHeadLock, CmpLoadHiveLock;
40
41 HIVE_LIST_ENTRY CmpMachineHiveList[] =
42 {
43 { L"HARDWARE", L"MACHINE\\", NULL, HIVE_VOLATILE , 0 , NULL, FALSE, FALSE, FALSE},
44 { L"SECURITY", L"MACHINE\\", NULL, 0 , 0 , NULL, FALSE, FALSE, FALSE},
45 { L"SOFTWARE", L"MACHINE\\", NULL, 0 , 0 , NULL, FALSE, FALSE, FALSE},
46 { L"SYSTEM", L"MACHINE\\", NULL, 0 , 0 , NULL, FALSE, FALSE, FALSE},
47 { L"DEFAULT", L"USER\\.DEFAULT", NULL, 0 , 0 , NULL, FALSE, FALSE, FALSE},
48 { L"SAM", L"MACHINE\\", NULL, HIVE_NOLAZYFLUSH , 0 , NULL, FALSE, FALSE, FALSE},
49 { NULL, NULL, 0, 0 , 0 , NULL, FALSE, FALSE, FALSE}
50 };
51
52 UNICODE_STRING CmSymbolicLinkValueName =
53 RTL_CONSTANT_STRING(L"SymbolicLinkValue");
54
55 UNICODE_STRING CmpLoadOptions;
56
57 BOOLEAN CmpShareSystemHives;
58 BOOLEAN CmSelfHeal = TRUE;
59 BOOLEAN CmpSelfHeal = TRUE;
60 BOOLEAN CmpMiniNTBoot;
61 ULONG CmpBootType;
62
63 USHORT CmpUnknownBusCount;
64 ULONG CmpTypeCount[MaximumType + 1];
65
66 HANDLE CmpRegistryRootHandle;
67
68 INIT_FUNCTION UNICODE_STRING CmClassName[MaximumClass + 1] =
69 {
70 RTL_CONSTANT_STRING(L"System"),
71 RTL_CONSTANT_STRING(L"Processor"),
72 RTL_CONSTANT_STRING(L"Cache"),
73 RTL_CONSTANT_STRING(L"Adapter"),
74 RTL_CONSTANT_STRING(L"Controller"),
75 RTL_CONSTANT_STRING(L"Peripheral"),
76 RTL_CONSTANT_STRING(L"MemoryClass"),
77 RTL_CONSTANT_STRING(L"Undefined")
78 };
79
80 INIT_FUNCTION UNICODE_STRING CmTypeName[MaximumType + 1] =
81 {
82 RTL_CONSTANT_STRING(L"System"),
83 RTL_CONSTANT_STRING(L"CentralProcessor"),
84 RTL_CONSTANT_STRING(L"FloatingPointProcessor"),
85 RTL_CONSTANT_STRING(L"PrimaryICache"),
86 RTL_CONSTANT_STRING(L"PrimaryDCache"),
87 RTL_CONSTANT_STRING(L"SecondaryICache"),
88 RTL_CONSTANT_STRING(L"SecondaryDCache"),
89 RTL_CONSTANT_STRING(L"SecondaryCache"),
90 RTL_CONSTANT_STRING(L"EisaAdapter"),
91 RTL_CONSTANT_STRING(L"TcAdapter"),
92 RTL_CONSTANT_STRING(L"ScsiAdapter"),
93 RTL_CONSTANT_STRING(L"DtiAdapter"),
94 RTL_CONSTANT_STRING(L"MultifunctionAdapter"),
95 RTL_CONSTANT_STRING(L"DiskController"),
96 RTL_CONSTANT_STRING(L"TapeController"),
97 RTL_CONSTANT_STRING(L"CdRomController"),
98 RTL_CONSTANT_STRING(L"WormController"),
99 RTL_CONSTANT_STRING(L"SerialController"),
100 RTL_CONSTANT_STRING(L"NetworkController"),
101 RTL_CONSTANT_STRING(L"DisplayController"),
102 RTL_CONSTANT_STRING(L"ParallelController"),
103 RTL_CONSTANT_STRING(L"PointerController"),
104 RTL_CONSTANT_STRING(L"KeyboardController"),
105 RTL_CONSTANT_STRING(L"AudioController"),
106 RTL_CONSTANT_STRING(L"OtherController"),
107 RTL_CONSTANT_STRING(L"DiskPeripheral"),
108 RTL_CONSTANT_STRING(L"FloppyDiskPeripheral"),
109 RTL_CONSTANT_STRING(L"TapePeripheral"),
110 RTL_CONSTANT_STRING(L"ModemPeripheral"),
111 RTL_CONSTANT_STRING(L"MonitorPeripheral"),
112 RTL_CONSTANT_STRING(L"PrinterPeripheral"),
113 RTL_CONSTANT_STRING(L"PointerPeripheral"),
114 RTL_CONSTANT_STRING(L"KeyboardPeripheral"),
115 RTL_CONSTANT_STRING(L"TerminalPeripheral"),
116 RTL_CONSTANT_STRING(L"OtherPeripheral"),
117 RTL_CONSTANT_STRING(L"LinePeripheral"),
118 RTL_CONSTANT_STRING(L"NetworkPeripheral"),
119 RTL_CONSTANT_STRING(L"SystemMemory"),
120 RTL_CONSTANT_STRING(L"DockingInformation"),
121 RTL_CONSTANT_STRING(L"RealModeIrqRoutingTable"),
122 RTL_CONSTANT_STRING(L"RealModePCIEnumeration"),
123 RTL_CONSTANT_STRING(L"Undefined")
124 };
125
126 INIT_FUNCTION CMP_MF_TYPE CmpMultifunctionTypes[] =
127 {
128 {"ISA", Isa, 0},
129 {"MCA", MicroChannel, 0},
130 {"PCI", PCIBus, 0},
131 {"VME", VMEBus, 0},
132 {"PCMCIA", PCMCIABus, 0},
133 {"CBUS", CBus, 0},
134 {"MPIPI", MPIBus, 0},
135 {"MPSA", MPSABus, 0},
136 {NULL, Internal, 0}
137 };
138
139 INIT_FUNCTION CM_SYSTEM_CONTROL_VECTOR CmControlVector[] =
140 {
141 {
142 L"Session Manager",
143 L"ProtectionMode",
144 &DummyData,
145 NULL,
146 NULL
147 },
148
149 {
150 L"Session Manager",
151 L"ObjectSecurityMode",
152 &DummyData,
153 NULL,
154 NULL
155 },
156
157 {
158 L"Session Manager",
159 L"LUIDDeviceMapsDisabled",
160 &DummyData,
161 NULL,
162 NULL
163 },
164
165 {
166 L"LSA",
167 L"AuditBaseDirectories",
168 &DummyData,
169 NULL,
170 NULL
171 },
172
173 {
174 L"LSA",
175 L"AuditBaseObjects",
176 &DummyData,
177 NULL,
178 NULL
179 },
180
181 {
182 L"LSA\\audit",
183 L"ProcessAccessesToAudit",
184 &DummyData,
185 NULL,
186 NULL
187 },
188
189 {
190 L"TimeZoneInformation",
191 L"ActiveTimeBias",
192 &DummyData,
193 NULL,
194 NULL
195 },
196
197 {
198 L"TimeZoneInformation",
199 L"Bias",
200 &DummyData,
201 NULL,
202 NULL
203 },
204
205 {
206 L"TimeZoneInformation",
207 L"RealTimeIsUniversal",
208 &DummyData,
209 NULL,
210 NULL
211 },
212
213 {
214 L"Session Manager",
215 L"GlobalFlag",
216 &CmNtGlobalFlag,
217 NULL,
218 NULL
219 },
220
221 {
222 L"Session Manager\\Memory Management",
223 L"PagedPoolQuota",
224 &DummyData,
225 NULL,
226 NULL
227 },
228
229 {
230 L"Session Manager\\Memory Management",
231 L"NonPagedPoolQuota",
232 &DummyData,
233 NULL,
234 NULL
235 },
236
237 {
238 L"Session Manager\\Memory Management",
239 L"PagingFileQuota",
240 &DummyData,
241 NULL,
242 NULL
243 },
244
245 {
246 L"Session Manager\\Memory Management",
247 L"AllocationPreference",
248 &DummyData,
249 NULL,
250 NULL
251 },
252
253 {
254 L"Session Manager\\Memory Management",
255 L"DynamicMemory",
256 &MmDynamicPfn,
257 NULL,
258 NULL
259 },
260
261 {
262 L"Session Manager\\Memory Management",
263 L"Mirroring",
264 &MmMirroring,
265 NULL,
266 NULL
267 },
268
269 {
270 L"Session Manager\\Memory Management",
271 L"SystemViewSize",
272 &DummyData,
273 NULL,
274 NULL
275 },
276
277 {
278 L"Session Manager\\Memory Management",
279 L"SessionImageSize",
280 &DummyData,
281 NULL,
282 NULL
283 },
284
285 {
286 L"Session Manager\\Memory Management",
287 L"SessionPoolSize",
288 &DummyData,
289 NULL,
290 NULL
291 },
292
293 {
294 L"Session Manager\\Memory Management",
295 L"PoolUsageMaximum",
296 &MmConsumedPoolPercentage,
297 NULL,
298 NULL
299 },
300
301 {
302 L"Session Manager\\Memory Management",
303 L"MapAllocationFragment",
304 &MmAllocationFragment,
305 NULL,
306 NULL
307 },
308
309 {
310 L"Session Manager\\Memory Management",
311 L"PagedPoolSize",
312 &MmSizeOfPagedPoolInBytes,
313 NULL,
314 NULL
315 },
316
317 {
318 L"Session Manager\\Memory Management",
319 L"NonPagedPoolSize",
320 &MmSizeOfNonPagedPoolInBytes,
321 NULL,
322 NULL
323 },
324
325 {
326 L"Session Manager\\Memory Management",
327 L"NonPagedPoolMaximumPercent",
328 &DummyData,
329 NULL,
330 NULL
331 },
332
333 {
334 L"Session Manager\\Memory Management",
335 L"LargeSystemCache",
336 &MmLargeSystemCache,
337 NULL,
338 NULL
339 },
340
341 {
342 L"Session Manager\\Memory Management",
343 L"LargeStackSize",
344 &MmLargeStackSize,
345 NULL,
346 NULL
347 },
348
349 {
350 L"Session Manager\\Memory Management",
351 L"SystemPages",
352 &MmNumberOfSystemPtes,
353 NULL,
354 NULL
355 },
356
357 {
358 L"Session Manager\\Memory Management",
359 L"LowMemoryThreshold",
360 &MmLowMemoryThreshold,
361 NULL,
362 NULL
363 },
364
365 {
366 L"Session Manager\\Memory Management",
367 L"HighMemoryThreshold",
368 &MmHighMemoryThreshold,
369 NULL,
370 NULL
371 },
372
373 {
374 L"Session Manager\\Memory Management",
375 L"DisablePagingExecutive",
376 &MmDisablePagingExecutive,
377 NULL,
378 NULL
379 },
380
381 {
382 L"Session Manager\\Memory Management",
383 L"ModifiedPageLife",
384 &DummyData,
385 NULL,
386 NULL
387 },
388
389 {
390 L"Session Manager\\Memory Management",
391 L"SecondLevelDataCache",
392 &MmSecondaryColors,
393 NULL,
394 NULL
395 },
396
397 {
398 L"Session Manager\\Memory Management",
399 L"ClearPageFileAtShutdown",
400 &MmZeroPageFile,
401 NULL,
402 NULL
403 },
404
405 {
406 L"Session Manager\\Memory Management",
407 L"PoolTagSmallTableSize",
408 &DummyData,
409 NULL,
410 NULL
411 },
412
413 {
414 L"Session Manager\\Memory Management",
415 L"PoolTagBigTableSize",
416 &DummyData,
417 NULL,
418 NULL
419 },
420
421 {
422 L"Session Manager\\Memory Management",
423 L"PoolTag",
424 &DummyData,
425 NULL,
426 NULL
427 },
428
429 {
430 L"Session Manager\\Memory Management",
431 L"PoolTagOverruns",
432 &DummyData,
433 NULL,
434 NULL
435 },
436
437 {
438 L"Session Manager\\Memory Management",
439 L"SnapUnloads",
440 &DummyData,
441 NULL,
442 NULL
443 },
444
445 {
446 L"Session Manager\\Memory Management",
447 L"ProtectNonPagedPool",
448 &MmProtectFreedNonPagedPool,
449 NULL,
450 NULL
451 },
452
453 {
454 L"Session Manager\\Memory Management",
455 L"TrackLockedPages",
456 &MmTrackLockedPages,
457 NULL,
458 NULL
459 },
460
461 {
462 L"Session Manager\\Memory Management",
463 L"TrackPtes",
464 &MmTrackPtes,
465 NULL,
466 NULL
467 },
468
469 {
470 L"Session Manager\\Memory Management",
471 L"VerifyDrivers",
472 MmVerifyDriverBuffer,
473 &MmVerifyDriverBufferLength,
474 &MmVerifyDriverBufferType
475 },
476
477 {
478 L"Session Manager\\Memory Management",
479 L"VerifyDriverLevel",
480 &MmVerifyDriverLevel,
481 NULL,
482 NULL
483 },
484
485 {
486 L"Session Manager\\Memory Management",
487 L"VerifyMode",
488 &DummyData,
489 NULL,
490 NULL
491 },
492
493 {
494 L"Session Manager\\Memory Management",
495 L"LargePageMinimum",
496 &DummyData,
497 NULL,
498 NULL
499 },
500
501 {
502 L"Session Manager\\Memory Management",
503 L"EnforceWriteProtection",
504 &MmEnforceWriteProtection,
505 NULL,
506 NULL
507 },
508
509 {
510 L"Session Manager\\Memory Management",
511 L"MakeLowMemory",
512 &MmMakeLowMemory,
513 NULL,
514 NULL
515 },
516
517 {
518 L"Session Manager\\Memory Management",
519 L"WriteWatch",
520 &DummyData,
521 NULL,
522 NULL
523 },
524
525 {
526 L"Session Manager\\Memory Management",
527 L"MinimumStackCommitInBytes",
528 &MmMinimumStackCommitInBytes,
529 NULL,
530 NULL
531 },
532
533 {
534 L"Session Manager\\Executive",
535 L"AdditionalCriticalWorkerThreads",
536 &DummyData,
537 NULL,
538 NULL
539 },
540
541 {
542 L"Session Manager\\Executive",
543 L"AdditionalDelayedWorkerThreads",
544 &DummyData,
545 NULL,
546 NULL
547 },
548
549 {
550 L"Session Manager\\Executive",
551 L"PriorityQuantumMatrix",
552 &DummyData,
553 &DummyData,
554 NULL
555 },
556
557 {
558 L"Session Manager\\Kernel",
559 L"DpcQueueDepth",
560 &DummyData,
561 NULL,
562 NULL
563 },
564
565 {
566 L"Session Manager\\Kernel",
567 L"MinimumDpcRate",
568 &DummyData,
569 NULL,
570 NULL
571 },
572
573 {
574 L"Session Manager\\Kernel",
575 L"AdjustDpcThreshold",
576 &DummyData,
577 NULL,
578 NULL
579 },
580
581 {
582 L"Session Manager\\Kernel",
583 L"IdealDpcRate",
584 &DummyData,
585 NULL,
586 NULL
587 },
588
589 {
590 L"Session Manager\\I/O System",
591 L"CountOperations",
592 &DummyData,
593 NULL,
594 NULL
595 },
596
597 {
598 L"Session Manager\\I/O System",
599 L"LargeIrpStackLocations",
600 &DummyData,
601 NULL,
602 NULL
603 },
604
605 {
606 L"Session Manager\\I/O System",
607 L"IoVerifierLevel",
608 &DummyData,
609 NULL,
610 NULL
611 },
612
613 {
614 L"Session Manager",
615 L"ResourceTimeoutCount",
616 &DummyData,
617 NULL,
618 NULL
619 },
620
621 {
622 L"Session Manager",
623 L"CriticalSectionTimeout",
624 &MmCritsectTimeoutSeconds,
625 NULL,
626 NULL
627 },
628
629 {
630 L"Session Manager",
631 L"HeapSegmentReserve",
632 &MmHeapSegmentReserve,
633 NULL,
634 NULL
635 },
636 {
637 L"Session Manager",
638 L"HeapSegmentCommit",
639 &MmHeapSegmentCommit,
640 NULL,
641 NULL
642 },
643
644 {
645 L"Session Manager",
646 L"HeapDeCommitTotalFreeThreshold",
647 &MmHeapDeCommitTotalFreeThreshold,
648 NULL,
649 NULL
650 },
651
652 {
653 L"Session Manager",
654 L"HeapDeCommitFreeBlockThreshold",
655 &MmHeapDeCommitFreeBlockThreshold,
656 NULL,
657 NULL
658 },
659
660 {
661 L"ProductOptions",
662 L"ProductType",
663 &MmProductType,
664 NULL,
665 NULL
666 },
667
668 {
669 L"Terminal Server",
670 L"TSEnabled",
671 &DummyData,
672 NULL,
673 NULL
674 },
675
676 {
677 L"Terminal Server",
678 L"TSAppCompat",
679 &DummyData,
680 NULL,
681 NULL
682 },
683
684
685 {
686 L"ProductOptions",
687 L"ProductSuite",
688 CmSuiteBuffer,
689 &CmSuiteBufferLength,
690 &CmSuiteBufferType
691 },
692
693 {
694 L"Windows",
695 L"CSDVersion",
696 &CmNtCSDVersion,
697 NULL,
698 NULL
699 },
700
701 {
702 L"Windows",
703 L"CSDReleaseType",
704 &CmNtCSDReleaseType,
705 NULL,
706 NULL
707 },
708
709 {
710 L"Nls\\Language",
711 L"Default",
712 CmDefaultLanguageId,
713 &CmDefaultLanguageIdLength,
714 &CmDefaultLanguageIdType
715 },
716
717 {
718 L"Nls\\Language",
719 L"InstallLanguage",
720 CmInstallUILanguageId,
721 &CmInstallUILanguageIdLength,
722 &CmInstallUILanguageIdType
723 },
724
725 {
726 L"\0\0",
727 L"RegistrySizeLimit",
728 &DummyData,
729 &DummyData,
730 &DummyData
731 },
732
733 {
734 L"Session Manager",
735 L"ForceNpxEmulation",
736 &DummyData,
737 NULL,
738 NULL
739 },
740
741 {
742 L"Session Manager",
743 L"PowerPolicySimulate",
744 &DummyData,
745 NULL,
746 NULL
747 },
748
749 {
750 L"Session Manager\\Executive",
751 L"MaxTimeSeparationBeforeCorrect",
752 &DummyData,
753 NULL,
754 NULL
755 },
756
757 {
758 L"Windows",
759 L"ShutdownTime",
760 &DummyData,
761 &DummyData,
762 NULL
763 },
764
765 {
766 L"PriorityControl",
767 L"Win32PrioritySeparation",
768 &PsRawPrioritySeparation,
769 NULL,
770 NULL
771 },
772
773 {
774 L"Session Manager",
775 L"EnableTimerWatchdog",
776 &DummyData,
777 NULL,
778 NULL
779 },
780
781 {
782 L"Session Manager",
783 L"Debugger Retries",
784 &KdpContext.KdpDefaultRetries,
785 NULL,
786 NULL
787 },
788
789 {
790 L"Session Manager\\Debug Print Filter",
791 L"WIN2000",
792 &Kd_WIN2000_Mask,
793 NULL,
794 NULL
795 },
796
797 /* TODO: Add the other masks */
798
799 {
800 L"WMI",
801 L"MaxEventSize",
802 &DummyData,
803 NULL,
804 NULL
805 },
806
807 {
808 L"WMI\\Trace",
809 L"UsePerformanceClock",
810 &DummyData,
811 NULL,
812 NULL
813 },
814
815 {
816 L"WMI\\Trace",
817 L"TraceAlignment",
818 &DummyData,
819 NULL,
820 NULL
821 },
822
823 {
824 NULL,
825 NULL,
826 NULL,
827 NULL,
828 NULL
829 }
830 };