ReactOS 0.4.15-dev-6675-gcbc63d8
cmsysini.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Kernel
3 * LICENSE: BSD - See COPYING.ARM in the top level directory
4 * PURPOSE: Configuration Manager - System Initialization Code
5 * PROGRAMMERS: ReactOS Portable Systems Group
6 * Alex Ionescu (alex.ionescu@reactos.org)
7 */
8
9/* INCLUDES *******************************************************************/
10
11#include "ntoskrnl.h"
12#define NDEBUG
13#include "debug.h"
14
33
35extern BOOLEAN CmFirstTime;
36
37/* FUNCTIONS ******************************************************************/
38
42 _In_z_ PCWSTR LinkKeyName,
43 _In_z_ PCWSTR TargetKeyName)
44{
48 HANDLE LinkKeyHandle;
50
51 PAGED_CODE();
52
53 /* Initialize the object attributes */
54 RtlInitUnicodeString(&KeyName, LinkKeyName);
56 &KeyName,
58 NULL,
59 NULL);
60
61 /* Create the link key */
62 Status = ZwCreateKey(&LinkKeyHandle,
65 0,
66 NULL,
69 if (!NT_SUCCESS(Status))
70 {
71 DPRINT1("CM: CmpLinkKeyToHive: couldn't create %S, Status = 0x%lx\n",
72 LinkKeyName, Status);
73 return FALSE;
74 }
75
76 /* Check if the new key was actually created */
78 {
79 DPRINT1("CM: CmpLinkKeyToHive: %S already exists!\n", LinkKeyName);
80 ZwClose(LinkKeyHandle);
81 return FALSE;
82 }
83
84 /* Set the target key name as link target */
85 RtlInitUnicodeString(&KeyName, TargetKeyName);
86 Status = ZwSetValueKey(LinkKeyHandle,
88 0,
90 KeyName.Buffer,
91 KeyName.Length);
92
93 /* Close the link key handle */
94 ObCloseHandle(LinkKeyHandle, KernelMode);
95
96 if (!NT_SUCCESS(Status))
97 {
98 DPRINT1("CM: CmpLinkKeyToHive: couldn't create symbolic link for %S, Status = 0x%lx\n",
99 TargetKeyName, Status);
100 return FALSE;
101 }
102
103 return TRUE;
104}
105
106VOID
107NTAPI
109{
110 PCM_KEY_BODY KeyBody = (PCM_KEY_BODY)DeletedObject;
112 REG_KEY_HANDLE_CLOSE_INFORMATION KeyHandleCloseInfo;
113 REG_POST_OPERATION_INFORMATION PostOperationInfo;
115 PAGED_CODE();
116
117 /* First off, prepare the handle close information callback */
118 PostOperationInfo.Object = KeyBody;
119 KeyHandleCloseInfo.Object = KeyBody;
121 &KeyHandleCloseInfo);
122 if (!NT_SUCCESS(Status))
123 {
124 /* If we failed, notify the post routine */
125 PostOperationInfo.Status = Status;
127 return;
128 }
129
130 /* Acquire hive lock */
132
133 /* Make sure this is a valid key body */
134 if (KeyBody->Type == CM_KEY_BODY_TYPE)
135 {
136 /* Get the KCB */
137 Kcb = KeyBody->KeyControlBlock;
138 if (Kcb)
139 {
140 /* Delist the key */
141 DelistKeyBodyFromKCB(KeyBody, FALSE);
142
143 /* Dereference the KCB */
145 }
146 }
147
148 /* Release the registry lock */
150
151 /* Do the post callback */
152 PostOperationInfo.Status = STATUS_SUCCESS;
154}
155
156VOID
157NTAPI
162 IN ULONG SystemHandleCount)
163{
165 PAGED_CODE();
166
167 /* Don't do anything if we're not the last handle */
168 if (SystemHandleCount > 1) return;
169
170 /* Make sure we're a valid key body */
171 if (KeyBody->Type == CM_KEY_BODY_TYPE)
172 {
173 /* Don't do anything if we don't have a notify block */
174 if (!KeyBody->NotifyBlock) return;
175
176 /* This shouldn't happen yet */
177 ASSERT(FALSE);
178 }
179}
180
182NTAPI
184 IN BOOLEAN HasName,
185 IN OUT POBJECT_NAME_INFORMATION ObjectNameInfo,
189{
193 PCM_KEY_BODY KeyBody = (PCM_KEY_BODY)ObjectBody;
195
196 /* Acquire hive lock */
198
199 /* Lock KCB shared */
201
202 /* Check if it's a deleted block */
203 if (Kcb->Delete)
204 {
205 /* Release the locks */
208
209 /* Let the caller know it's deleted */
210 return STATUS_KEY_DELETED;
211 }
212
213 /* Get the name */
215
216 /* Release the locks */
219
220 /* Check if we got the name */
222
223 /* Set the returned length */
224 *ReturnLength = KeyName->Length + sizeof(OBJECT_NAME_INFORMATION) + sizeof(WCHAR);
225
226 /* Calculate amount of bytes to copy into the buffer */
227 BytesToCopy = KeyName->Length + sizeof(WCHAR);
228
229 /* Check if the provided buffer is too small to fit even anything */
230 if ((Length <= sizeof(OBJECT_NAME_INFORMATION)) ||
231 ((Length < (*ReturnLength)) && (BytesToCopy < sizeof(WCHAR))))
232 {
233 /* Free the buffer allocated by CmpConstructName */
235
236 /* Return buffer length failure without writing anything there because nothing fits */
238 }
239
240 /* Check if the provided buffer can be partially written */
241 if (Length < (*ReturnLength))
242 {
243 /* Yes, indicate so in the return status */
245
246 /* Calculate amount of bytes which the provided buffer could handle */
248 }
249
250 /* Remove the null termination character from the size */
251 BytesToCopy -= sizeof(WCHAR);
252
253 /* Fill in the result */
255 {
256 /* Return data to user */
257 ObjectNameInfo->Name.Buffer = (PWCHAR)(ObjectNameInfo + 1);
258 ObjectNameInfo->Name.MaximumLength = KeyName->Length;
259 ObjectNameInfo->Name.Length = KeyName->Length;
260
261 /* Copy string content*/
262 RtlCopyMemory(ObjectNameInfo->Name.Buffer,
263 KeyName->Buffer,
265
266 /* Null terminate it */
267 ObjectNameInfo->Name.Buffer[BytesToCopy / sizeof(WCHAR)] = UNICODE_NULL;
268 }
270 {
271 /* Get the status */
273 }
274 _SEH2_END;
275
276 /* Free the buffer allocated by CmpConstructName */
278
279 /* Return status */
280 return Status;
281}
282
284NTAPI
286 IN ULONG HiveFlags,
287 OUT PCMHIVE *Hive,
289 IN ULONG CheckFlags)
290{
291 ULONG HiveDisposition, LogDisposition;
295 PCMHIVE NewHive;
296 PAGED_CODE();
297
298 /* Assume failure */
299 *Hive = NULL;
300
301 /* Open or create the hive files */
302 Status = CmpOpenHiveFiles(HiveName,
303 L".LOG",
304 &FileHandle,
305 &LogHandle,
306 &HiveDisposition,
307 &LogDisposition,
308 *New,
309 FALSE,
310 TRUE,
311 NULL);
312 if (!NT_SUCCESS(Status)) return Status;
313
314 /* Check if we have a log handle */
316
317 /* Check if we created or opened the hive */
318 if (HiveDisposition == FILE_CREATED)
319 {
320 /* Do a create operation */
322 *New = TRUE;
323 }
324 else
325 {
326 /* Open it as a file */
328 *New = FALSE;
329 }
330
331 /* Check if we're sharing hives */
333 {
334 /* Then force using the primary hive */
336 if (LogHandle)
337 {
338 /* Get rid of the log handle */
340 LogHandle = NULL;
341 }
342 }
343
344 /* Check if we're too late */
346 {
347 /* Fail */
350 return STATUS_TOO_LATE;
351 }
352
353 /* Initialize the hive */
354 Status = CmpInitializeHive(&NewHive,
355 Operation,
356 HiveFlags,
357 FileType,
358 NULL,
360 LogHandle,
361 NULL,
362 HiveName,
363 CheckFlags);
364 if (!NT_SUCCESS(Status))
365 {
366 /* Fail */
369 return Status;
370 }
371
372 /* Success, return hive */
373 *Hive = NewHive;
374
375 /* Duplicate the hive name */
377 HiveName->Length,
378 TAG_CM);
379 if (NewHive->FileFullPath.Buffer)
380 {
381 /* Copy the string */
383 HiveName->Buffer,
384 HiveName->Length);
385 NewHive->FileFullPath.Length = HiveName->Length;
386 NewHive->FileFullPath.MaximumLength = HiveName->Length;
387 }
388
389 /* Return success */
390 return STATUS_SUCCESS;
391}
392
393CODE_SEG("INIT")
395NTAPI
397{
402
403 ASSERT(LoaderBlock != NULL);
404
405 /* Setup attributes for loader options */
407 L"\\REGISTRY\\MACHINE\\SYSTEM\\CurrentControlSet\\"
408 L"Control");
410 &KeyName,
412 NULL,
413 NULL);
415 if (!NT_SUCCESS(Status))
416 return Status;
417
418 /* Setup the value for the system start options */
419 RtlInitUnicodeString(&KeyName, L"SystemStartOptions");
421 &KeyName,
422 0,
423 REG_SZ,
426 if (!NT_SUCCESS(Status))
427 goto Quit;
428
429 /* Setup the value for the system boot device in ARC format */
430 RtlInitUnicodeString(&KeyName, L"SystemBootDevice");
431 RtlCreateUnicodeStringFromAsciiz(&ValueName, LoaderBlock->ArcBootDeviceName);
433 &KeyName,
434 0,
435 REG_SZ,
436 ValueName.Buffer,
437 ValueName.Length);
438
439 /* Free the temporary string */
441
442Quit:
443 /* Close the key and return */
445 return Status;
446}
447
448static
449CODE_SEG("INIT")
452{
455 HANDLE ProfilesHandle = NULL;
456 HANDLE ProfileHandle = NULL;
459
460 DPRINT("CmpCreateHardwareProfile()\n");
461
462 /* Create the Hardware Profiles key */
463 RtlInitUnicodeString(&KeyName, L"Hardware Profiles");
465 &KeyName,
467 ControlSetHandle,
468 NULL);
469 Status = NtCreateKey(&ProfilesHandle,
472 0,
473 NULL,
474 0,
475 &Disposition);
476 if (!NT_SUCCESS(Status))
477 {
478 DPRINT1("Creating the Hardware Profile key failed\n");
479 goto done;
480 }
481
482 /* Sanity check */
484
485 /* Create the 0000 key */
488 &KeyName,
490 ProfilesHandle,
491 NULL);
492 Status = NtCreateKey(&ProfileHandle,
495 0,
496 NULL,
497 0,
498 &Disposition);
499 if (!NT_SUCCESS(Status))
500 {
501 DPRINT1("Creating the Hardware Profile\\0000 key failed\n");
502 goto done;
503 }
504
505 /* Sanity check */
507
508done:
509 if (ProfilesHandle)
510 NtClose(ProfilesHandle);
511
512 if (ProfileHandle)
513 NtClose(ProfileHandle);
514
515 DPRINT("CmpCreateHardwareProfile() done\n");
516
517 return Status;
518}
519
520CODE_SEG("INIT")
522NTAPI
524{
525 UNICODE_STRING ConfigName = RTL_CONSTANT_STRING(L"Control\\IDConfigDB");
526 UNICODE_STRING SelectName =
527 RTL_CONSTANT_STRING(L"\\Registry\\Machine\\System\\Select");
530 CHAR ValueInfoBuffer[128];
532 WCHAR UnicodeBuffer[128];
533 HANDLE SelectHandle = NULL;
535 HANDLE ConfigHandle = NULL;
536 HANDLE ProfileHandle = NULL;
537 HANDLE ParentHandle = NULL;
538 ULONG ControlSet, HwProfile;
541 PLOADER_PARAMETER_EXTENSION LoaderExtension;
542 PAGED_CODE();
543
544 /* ReactOS Hack: Hard-code current to 001 for SetupLdr */
545 if (LoaderBlock->RegistryBase == NULL)
546 {
547 /* Build the ControlSet001 key */
549 L"\\Registry\\Machine\\System\\ControlSet001");
551 &KeyName,
553 NULL,
554 NULL);
558 0,
559 NULL,
560 0,
561 &Disposition);
562 if (!NT_SUCCESS(Status))
563 {
564 DPRINT1("Failed to create ControlSet001 key: 0x%lx\n", Status);
565 goto Cleanup;
566 }
567
568 /* Create the Hardware Profile keys */
570 if (!NT_SUCCESS(Status))
571 {
572 DPRINT1("Failed to create Hardware profile keys: 0x%lx\n", Status);
573 goto Cleanup;
574 }
575
576 /* Use hard-coded setting */
577 ControlSet = 1;
578 }
579 else
580 {
581 /* Open the select key */
583 &SelectName,
585 NULL,
586 NULL);
587 Status = NtOpenKey(&SelectHandle, KEY_READ, &ObjectAttributes);
588 if (!NT_SUCCESS(Status))
589 {
590 DPRINT1("Failed to open select key: 0x%lx\n", Status);
591 goto Cleanup;
592 }
593
594 /* Open the current value */
595 RtlInitUnicodeString(&KeyName, L"Current");
596 Status = NtQueryValueKey(SelectHandle,
597 &KeyName,
599 ValueInfoBuffer,
600 sizeof(ValueInfoBuffer),
601 &ResultLength);
602 if (!NT_SUCCESS(Status))
603 {
604 DPRINT1("Failed to open the Current value: 0x%lx\n", Status);
605 goto Cleanup;
606 }
607
608 /* Get the actual value pointer, and get the control set ID */
609 ValueInfo = (PKEY_VALUE_FULL_INFORMATION)ValueInfoBuffer;
610 ControlSet = *(PULONG)((PUCHAR)ValueInfo + ValueInfo->DataOffset);
611 }
612
613 /* Create the current control set key */
615 L"\\Registry\\Machine\\System\\CurrentControlSet");
617 &KeyName,
619 NULL,
620 NULL);
624 0,
625 NULL,
627 &Disposition);
628 if (!NT_SUCCESS(Status))
629 goto Cleanup;
630
631 /* Sanity check */
633
634 /* Initialize the target link name */
635 Status = RtlStringCbPrintfW(UnicodeBuffer, sizeof(UnicodeBuffer),
636 L"\\Registry\\Machine\\System\\ControlSet%03ld",
637 ControlSet);
638 if (!NT_SUCCESS(Status))
639 goto Cleanup;
640
641 RtlInitUnicodeString(&KeyName, UnicodeBuffer);
642
643 /* Set the value */
646 0,
647 REG_LINK,
648 KeyName.Buffer,
649 KeyName.Length);
650 if (!NT_SUCCESS(Status))
651 goto Cleanup;
652
653 /* Get the configuration database key */
655 &ConfigName,
657 KeyHandle,
658 NULL);
659 Status = NtOpenKey(&ConfigHandle, KEY_READ, &ObjectAttributes);
660
661 /* Check if we don't have one */
662 if (!NT_SUCCESS(Status))
663 {
664 /* Cleanup and exit */
666 goto Cleanup;
667 }
668
669 /* ReactOS Hack: Hard-code current to 001 for SetupLdr */
670 if (LoaderBlock->RegistryBase == NULL)
671 {
672 HwProfile = 0;
673 }
674 else
675 {
676 /* Now get the current config */
677 RtlInitUnicodeString(&KeyName, L"CurrentConfig");
678 Status = NtQueryValueKey(ConfigHandle,
679 &KeyName,
681 ValueInfoBuffer,
682 sizeof(ValueInfoBuffer),
683 &ResultLength);
684
685 /* Set pointer to buffer */
686 ValueInfo = (PKEY_VALUE_FULL_INFORMATION)ValueInfoBuffer;
687
688 /* Check if we failed or got a non DWORD-value */
689 if (!(NT_SUCCESS(Status)) || (ValueInfo->Type != REG_DWORD))
690 {
692 goto Cleanup;
693 }
694
695 /* Get the hadware profile */
696 HwProfile = *(PULONG)((PUCHAR)ValueInfo + ValueInfo->DataOffset);
697 }
698
699 /* Open the hardware profile key */
701 L"\\Registry\\Machine\\System\\CurrentControlSet"
702 L"\\Hardware Profiles");
704 &KeyName,
706 NULL,
707 NULL);
708 Status = NtOpenKey(&ParentHandle, KEY_READ, &ObjectAttributes);
709 if (!NT_SUCCESS(Status))
710 {
711 /* Exit and clean up */
713 goto Cleanup;
714 }
715
716 /* Build the profile name */
717 RtlStringCbPrintfW(UnicodeBuffer, sizeof(UnicodeBuffer),
718 L"%04ld", HwProfile);
719 RtlInitUnicodeString(&KeyName, UnicodeBuffer);
720
721 /* Open the associated key */
723 &KeyName,
725 ParentHandle,
726 NULL);
727 Status = NtOpenKey(&ProfileHandle,
730 if (!NT_SUCCESS (Status))
731 {
732 /* Cleanup and exit */
734 goto Cleanup;
735 }
736
737 /* Check if we have a loader block extension */
738 LoaderExtension = LoaderBlock->Extension;
739 if (LoaderExtension)
740 {
741 DPRINT("ReactOS doesn't support NTLDR Profiles yet!\n");
742 }
743
744 /* Create the current hardware profile key */
746 L"\\Registry\\Machine\\System\\CurrentControlSet\\"
747 L"Hardware Profiles\\Current");
749 &KeyName,
751 NULL,
752 NULL);
756 0,
757 NULL,
759 &Disposition);
760 if (NT_SUCCESS(Status))
761 {
762 /* Sanity check */
764
765 /* Create the profile name */
766 RtlStringCbPrintfW(UnicodeBuffer, sizeof(UnicodeBuffer),
767 L"\\Registry\\Machine\\System\\CurrentControlSet\\"
768 L"Hardware Profiles\\%04ld",
769 HwProfile);
770 RtlInitUnicodeString(&KeyName, UnicodeBuffer);
771
772 /* Set it */
775 0,
776 REG_LINK,
777 KeyName.Buffer,
778 KeyName.Length);
779 }
780
782
783Cleanup:
784 /* Close every opened handle */
785 if (SelectHandle) NtClose(SelectHandle);
787 if (ConfigHandle) NtClose(ConfigHandle);
788 if (ProfileHandle) NtClose(ProfileHandle);
789 if (ParentHandle) NtClose(ParentHandle);
790
791 DPRINT("CmpCreateControlSet() done\n");
792 return Status;
793}
794
796NTAPI
799 IN PCMHIVE RegistryHive,
802{
805 CM_PARSE_CONTEXT ParseContext = {0};
807 PCM_KEY_BODY KeyBody;
808 PAGED_CODE();
809
810 /* Setup the object attributes */
812 LinkName,
816
817 /* Setup the parse context */
818 ParseContext.CreateLink = TRUE;
819 ParseContext.CreateOperation = TRUE;
820 ParseContext.ChildHive.KeyHive = &RegistryHive->Hive;
821
822 /* Check if we have a root keycell or if we need to create it */
823 if (Allocate)
824 {
825 /* Create it */
826 ParseContext.ChildHive.KeyCell = HCELL_NIL;
827 }
828 else
829 {
830 /* We have one */
831 ParseContext.ChildHive.KeyCell = RegistryHive->Hive.BaseBlock->RootCell;
832 }
833
834 /* Create the link node */
838 NULL,
840 (PVOID)&ParseContext,
841 &KeyHandle);
842 if (!NT_SUCCESS(Status)) return Status;
843
844 /* Mark the hive as clean */
845 RegistryHive->Hive.DirtyFlag = FALSE;
846
847 /* ReactOS Hack: Keep alive */
849 0,
852 (PVOID*)&KeyBody,
853 NULL);
855
856 /* Close the extra handle */
858 return STATUS_SUCCESS;
859}
860
861CODE_SEG("INIT")
863NTAPI
865{
866 static const UNICODE_STRING HiveName = RTL_CONSTANT_STRING(L"SYSTEM");
867 PVOID HiveBase;
875
876 PAGED_CODE();
877
878 /* Setup the ansi string */
879 RtlInitAnsiString(&LoadString, LoaderBlock->LoadOptions);
880
881 /* Allocate the unicode buffer */
882 Length = LoadString.Length * sizeof(WCHAR) + sizeof(UNICODE_NULL);
884 if (!Buffer)
885 {
886 /* Fail */
887 KeBugCheckEx(BAD_SYSTEM_CONFIG_INFO, 3, 1, (ULONG_PTR)LoaderBlock, 0);
888 }
889
890 /* Setup the unicode string */
891 RtlInitEmptyUnicodeString(&CmpLoadOptions, Buffer, (USHORT)Length);
892
893 /* Add the load options and null-terminate */
895 if (!NT_SUCCESS(Status))
896 {
897 return FALSE;
898 }
899
901 CmpLoadOptions.Length += sizeof(WCHAR);
902
903 /* Get the System Hive base address */
904 HiveBase = LoaderBlock->RegistryBase;
905
907 HiveBase ? HINIT_MEMORY : HINIT_CREATE,
910 HiveBase,
911 NULL,
912 NULL,
913 NULL,
914 &HiveName,
915 HiveBase ? 2 : 0);
916 if (!NT_SUCCESS(Status))
917 {
918 return FALSE;
919 }
920
921 /* Set the hive filename */
922 if (!RtlCreateUnicodeString(&SystemHive->FileFullPath, L"\\SystemRoot\\System32\\Config\\SYSTEM"))
923 return FALSE;
924
925 /* Manually set the hive as volatile, if in Live CD mode */
926 if (HiveBase && CmpShareSystemHives)
927 {
929 }
930
931 /* Save the boot type */
933
934 /* Are we in self-healing mode? */
935 if (!CmSelfHeal)
936 {
937 /* Disable self-healing internally and check if boot type wanted it */
939 if (CmpBootType & 4)
940 {
941 /* We're disabled, so bugcheck */
942 KeBugCheckEx(BAD_SYSTEM_CONFIG_INFO,
943 3,
944 3,
946 0);
947 }
948 }
949
950 /* Create the default security descriptor */
952
953 /* Attach it to the system key */
954 /* Let CmpLinkHiveToMaster allocate a new hive if we got none from the LoaderBlock. */
955 RtlInitUnicodeString(&KeyName, L"\\Registry\\Machine\\SYSTEM");
957 NULL,
959 !HiveBase,
961
962 /* Free the security descriptor */
964 if (!NT_SUCCESS(Status)) return FALSE;
965
966 /* Add the hive to the hive list */
968
969 /* Success! */
970 return TRUE;
971}
972
973CODE_SEG("INIT")
975NTAPI
977{
978 OBJECT_TYPE_INITIALIZER ObjectTypeInitializer;
980 GENERIC_MAPPING CmpKeyMapping = {KEY_READ,
981 KEY_WRITE,
984 PAGED_CODE();
985
986 /* Initialize the Key object type */
987 RtlZeroMemory(&ObjectTypeInitializer, sizeof(ObjectTypeInitializer));
989 ObjectTypeInitializer.Length = sizeof(ObjectTypeInitializer);
990 ObjectTypeInitializer.DefaultPagedPoolCharge = sizeof(CM_KEY_BODY);
991 ObjectTypeInitializer.GenericMapping = CmpKeyMapping;
992 ObjectTypeInitializer.PoolType = PagedPool;
993 ObjectTypeInitializer.ValidAccessMask = KEY_ALL_ACCESS;
994 ObjectTypeInitializer.UseDefaultObject = TRUE;
995 ObjectTypeInitializer.DeleteProcedure = CmpDeleteKeyObject;
996 ObjectTypeInitializer.ParseProcedure = CmpParseKey;
997 ObjectTypeInitializer.SecurityProcedure = CmpSecurityMethod;
998 ObjectTypeInitializer.QueryNameProcedure = CmpQueryKeyName;
999 ObjectTypeInitializer.CloseProcedure = CmpCloseKeyObject;
1000 ObjectTypeInitializer.SecurityRequired = TRUE;
1001 ObjectTypeInitializer.InvalidAttributes = OBJ_EXCLUSIVE | OBJ_PERMANENT;
1002
1003 /* Create it */
1004 return ObCreateObjectType(&Name, &ObjectTypeInitializer, NULL, &CmpKeyObjectType);
1005}
1006
1007CODE_SEG("INIT")
1008BOOLEAN
1009NTAPI
1011 IN PCWSTR Name,
1013{
1015 PCM_KEY_NODE KeyCell;
1016 PAGED_CODE();
1017
1018 /* Initialize the node name and allocate it */
1020 *Index = HvAllocateCell(Hive,
1022 CmpNameSize(Hive, &KeyName),
1023 Stable,
1024 HCELL_NIL);
1025 if (*Index == HCELL_NIL) return FALSE;
1026
1027 /* Set the cell index and get the data */
1028 Hive->BaseBlock->RootCell = *Index;
1029 KeyCell = (PCM_KEY_NODE)HvGetCell(Hive, *Index);
1030 if (!KeyCell) return FALSE;
1031
1032 /* Setup the cell */
1034 KeyCell->Flags = KEY_HIVE_ENTRY | KEY_NO_DELETE;
1036 KeyCell->Parent = HCELL_NIL;
1037 KeyCell->SubKeyCounts[Stable] = 0;
1038 KeyCell->SubKeyCounts[Volatile] = 0;
1039 KeyCell->SubKeyLists[Stable] = HCELL_NIL;
1040 KeyCell->SubKeyLists[Volatile] = HCELL_NIL;
1041 KeyCell->ValueList.Count = 0;
1042 KeyCell->ValueList.List = HCELL_NIL;
1043 KeyCell->Security = HCELL_NIL;
1044 KeyCell->Class = HCELL_NIL;
1045 KeyCell->ClassLength = 0;
1046 KeyCell->MaxNameLen = 0;
1047 KeyCell->MaxClassLen = 0;
1048 KeyCell->MaxValueNameLen = 0;
1049 KeyCell->MaxValueDataLen = 0;
1050
1051 /* Copy the name (this will also set the length) */
1052 KeyCell->NameLength = CmpCopyName(Hive, KeyCell->Name, &KeyName);
1053
1054 /* Check if the name was compressed and set the flag if so */
1055 if (KeyCell->NameLength < KeyName.Length)
1056 KeyCell->Flags |= KEY_COMP_NAME;
1057
1058 /* Return success */
1059 HvReleaseCell(Hive, *Index);
1060 return TRUE;
1061}
1062
1063CODE_SEG("INIT")
1064BOOLEAN
1065NTAPI
1067{
1071 HCELL_INDEX RootIndex;
1073 PCM_KEY_NODE KeyCell;
1076 PAGED_CODE();
1077
1078 /* Setup the root node */
1079 if (!CmpCreateRootNode(&CmiVolatileHive->Hive, L"REGISTRY", &RootIndex))
1080 {
1081 /* We failed */
1082 return FALSE;
1083 }
1084
1085 /* Create '\Registry' key. */
1086 RtlInitUnicodeString(&KeyName, L"\\REGISTRY");
1089 &KeyName,
1091 NULL,
1096 KernelMode,
1097 NULL,
1098 sizeof(CM_KEY_BODY),
1099 0,
1100 0,
1101 (PVOID*)&RootKey);
1103 if (!NT_SUCCESS(Status)) return FALSE;
1104
1105 /* Sanity check, and get the key cell */
1106 ASSERT((&CmiVolatileHive->Hive)->ReleaseCellRoutine == NULL);
1107 KeyCell = (PCM_KEY_NODE)HvGetCell(&CmiVolatileHive->Hive, RootIndex);
1108 if (!KeyCell) return FALSE;
1109
1110 /* Create the KCB */
1111 RtlInitUnicodeString(&KeyName, L"\\REGISTRY");
1113 RootIndex,
1114 KeyCell,
1115 NULL,
1116 0,
1117 &KeyName);
1118 if (!Kcb)
1119 {
1121 return FALSE;
1122 }
1123
1124 /* Initialize the object */
1125 RootKey->KeyControlBlock = Kcb;
1126 RootKey->Type = CM_KEY_BODY_TYPE;
1127 RootKey->NotifyBlock = NULL;
1128 RootKey->ProcessID = PsGetCurrentProcessId();
1129
1130 /* Link with KCB */
1132
1133 /* Insert the key into the namespace */
1135 NULL,
1137 0,
1138 NULL,
1140 if (!NT_SUCCESS(Status))
1141 {
1143 return FALSE;
1144 }
1145
1146 /* Reference the key again so that we never lose it */
1148 KEY_READ,
1149 NULL,
1150 KernelMode,
1151 (PVOID*)&RootKey,
1152 NULL);
1153 if (!NT_SUCCESS(Status))
1154 {
1156 return FALSE;
1157 }
1158
1159 /* Completely sucessful */
1160 return TRUE;
1161}
1162
1163static PCWSTR
1165{
1166 PCWSTR ConfigPath;
1167
1168 /* Check if we are booted in setup */
1169 if (!ExpInTextModeSetup)
1170 {
1171 ConfigPath = L"\\SystemRoot\\System32\\Config\\";
1172 }
1173 else
1174 {
1175 ConfigPath = L"\\SystemRoot\\";
1176 }
1177
1178 DPRINT1("CmpGetRegistryPath: ConfigPath = '%S'\n", ConfigPath);
1179
1180 return ConfigPath;
1181}
1182
1183_Function_class_(KSTART_ROUTINE)
1184VOID
1185NTAPI
1186CmpLoadHiveThread(IN PVOID StartContext)
1187{
1188 WCHAR FileBuffer[64], RegBuffer[64];
1189 PCWSTR ConfigPath;
1190 UNICODE_STRING TempName, FileName, RegName;
1191 ULONG i, ErrorResponse, WorkerCount, Length;
1192 USHORT FileStart;
1193 ULONG PrimaryDisposition, SecondaryDisposition, ClusterSize;
1194 PCMHIVE CmHive;
1195 HANDLE PrimaryHandle = NULL, LogHandle = NULL;
1197 PVOID ErrorParameters;
1198 PAGED_CODE();
1199
1200 /* Get the hive index, make sure it makes sense */
1201 i = PtrToUlong(StartContext);
1203
1204 /* We were started */
1206
1207 /* Build the file name and registry name strings */
1208 RtlInitEmptyUnicodeString(&FileName, FileBuffer, sizeof(FileBuffer));
1209 RtlInitEmptyUnicodeString(&RegName, RegBuffer, sizeof(RegBuffer));
1210
1211 /* Now build the system root path */
1212 ConfigPath = CmpGetRegistryPath();
1213 RtlInitUnicodeString(&TempName, ConfigPath);
1215 FileStart = FileName.Length;
1216
1217 /* And build the registry root path */
1218 RtlInitUnicodeString(&TempName, L"\\REGISTRY\\");
1219 RtlAppendUnicodeStringToString(&RegName, &TempName);
1220
1221 /* Build the base name */
1222 RtlInitUnicodeString(&TempName, CmpMachineHiveList[i].BaseName);
1223 RtlAppendUnicodeStringToString(&RegName, &TempName);
1224
1225 /* Check if this is a child of the root */
1226 if (RegName.Buffer[RegName.Length / sizeof(WCHAR) - 1] == OBJ_NAME_PATH_SEPARATOR)
1227 {
1228 /* Then setup the whole name */
1230 RtlAppendUnicodeStringToString(&RegName, &TempName);
1231 }
1232
1233 /* Now add the rest of the file name */
1235 FileName.Length = FileStart;
1237 if (!CmpMachineHiveList[i].CmHive)
1238 {
1239 /* We need to allocate a new hive structure */
1241
1242 /* Load the hive file */
1244 CmpMachineHiveList[i].HHiveFlags,
1245 &CmHive,
1247 0);
1248 if (!(NT_SUCCESS(Status)) ||
1250 {
1251 /*
1252 * We failed, or could not get a log file (unless
1253 * the hive is shared), raise a hard error.
1254 */
1255 ErrorParameters = &FileName;
1257 1,
1258 1,
1259 (PULONG_PTR)&ErrorParameters,
1260 OptionOk,
1261 &ErrorResponse);
1262 }
1263
1264 /* Set the hive flags and newly allocated hive pointer */
1266 CmpMachineHiveList[i].CmHive2 = CmHive;
1267 }
1268 else
1269 {
1270 /* We already have a hive, is it volatile? */
1271 CmHive = CmpMachineHiveList[i].CmHive;
1272 if (!(CmHive->Hive.HiveFlags & HIVE_VOLATILE))
1273 {
1274 /* It's now, open the hive file and log */
1276 L".LOG",
1277 &PrimaryHandle,
1278 &LogHandle,
1279 &PrimaryDisposition,
1280 &SecondaryDisposition,
1281 TRUE,
1282 TRUE,
1283 FALSE,
1284 &ClusterSize);
1285 if (!(NT_SUCCESS(Status)) || !(LogHandle))
1286 {
1287 /* Couldn't open the hive or its log file, raise a hard error */
1288 ErrorParameters = &FileName;
1290 1,
1291 1,
1292 (PULONG_PTR)&ErrorParameters,
1293 OptionOk,
1294 &ErrorResponse);
1295
1296 /* And bugcheck for posterity's sake */
1297 KeBugCheckEx(BAD_SYSTEM_CONFIG_INFO, 9, 0, i, Status);
1298 }
1299
1300 /* Save the file handles. This should remove our sync hacks */
1302 CmHive->FileHandles[HFILE_TYPE_PRIMARY] = PrimaryHandle;
1303
1304 /* Allow lazy flushing since the handles are there -- remove sync hacks */
1305 //ASSERT(CmHive->Hive.HiveFlags & HIVE_NOLAZYFLUSH);
1306 CmHive->Hive.HiveFlags &= ~HIVE_NOLAZYFLUSH;
1307
1308 /* Get the real size of the hive */
1310
1311 /* Check if the cluster size doesn't match */
1312 if (CmHive->Hive.Cluster != ClusterSize)
1313 {
1314 DPRINT1("FIXME: Support for CmHive->Hive.Cluster (%lu) != ClusterSize (%lu) is unimplemented!\n",
1315 CmHive->Hive.Cluster, ClusterSize);
1316 }
1317
1318 /* Set the file size */
1319 DPRINT("FIXME: Should set file size: %lu\n", Length);
1320 //if (!CmpFileSetSize((PHHIVE)CmHive, HFILE_TYPE_PRIMARY, Length, Length))
1321 //{
1322 /* This shouldn't fail */
1323 //ASSERT(FALSE);
1324 //}
1325
1326 /* Another thing we don't support is NTLDR-recovery */
1327 if (CmHive->Hive.BaseBlock->BootRecover) ASSERT(FALSE);
1328
1329 /* Finally, set our allocated hive to the same hive we've had */
1330 CmpMachineHiveList[i].CmHive2 = CmHive;
1331 ASSERT(CmpMachineHiveList[i].CmHive == CmpMachineHiveList[i].CmHive2);
1332 }
1333 }
1334
1335 /* We're done */
1337
1338 /* Check if we're the last worker */
1340 if (WorkerCount == CM_NUMBER_OF_MACHINE_HIVES)
1341 {
1342 /* Signal the event */
1344 }
1345
1346 /* Kill the thread */
1348}
1349
1350VOID
1351NTAPI
1353{
1354 WCHAR FileBuffer[64], RegBuffer[64];
1355 PCWSTR ConfigPath;
1356 UNICODE_STRING TempName, FileName, RegName;
1357 HANDLE Thread;
1359 ULONG i;
1360 USHORT RegStart;
1362 PAGED_CODE();
1363
1364 /* Allow writing for now */
1365 CmpNoWrite = FALSE;
1366
1367 /* Build the file name and registry name strings */
1368 RtlInitEmptyUnicodeString(&FileName, FileBuffer, sizeof(FileBuffer));
1369 RtlInitEmptyUnicodeString(&RegName, RegBuffer, sizeof(RegBuffer));
1370
1371 /* Now build the system root path */
1372 ConfigPath = CmpGetRegistryPath();
1373 RtlInitUnicodeString(&TempName, ConfigPath);
1375
1376 /* And build the registry root path */
1377 RtlInitUnicodeString(&TempName, L"\\REGISTRY\\");
1378 RtlAppendUnicodeStringToString(&RegName, &TempName);
1379 RegStart = RegName.Length;
1380
1381 /* Setup the event to synchronize workers */
1383
1384 /* Enter special boot condition */
1386
1387 /* Create the SD for the root hives */
1389
1390 /* Loop every hive we care about */
1391 for (i = 0; i < CM_NUMBER_OF_MACHINE_HIVES; i++)
1392 {
1393 /* Make sure the list is set up */
1395
1396 /* Load the hive as volatile, if in LiveCD mode */
1399
1400 /* Create a thread to handle this hive */
1403 NULL,
1404 0,
1405 NULL,
1406 CmpLoadHiveThread,
1407 UlongToPtr(i));
1408 if (NT_SUCCESS(Status))
1409 {
1410 /* We don't care about the handle -- the thread self-terminates */
1411 ZwClose(Thread);
1412 }
1413 else
1414 {
1415 /* Can't imagine this happening */
1416 KeBugCheckEx(BAD_SYSTEM_CONFIG_INFO, 9, 3, i, Status);
1417 }
1418 }
1419
1420 /* Make sure we've reached the end of the list */
1422
1423 /* Wait for hive loading to finish */
1425 Executive,
1426 KernelMode,
1427 FALSE,
1428 NULL);
1429
1430 /* Exit the special boot condition and make sure all workers completed */
1433
1434 /* Loop hives again */
1435 for (i = 0; i < CM_NUMBER_OF_MACHINE_HIVES; i++)
1436 {
1437 /* Make sure the thread ran and finished */
1438 ASSERT(CmpMachineHiveList[i].ThreadFinished == TRUE);
1439 ASSERT(CmpMachineHiveList[i].ThreadStarted == TRUE);
1440
1441 /* Check if this was a new hive */
1442 if (!CmpMachineHiveList[i].CmHive)
1443 {
1444 /* Make sure we allocated something */
1445 ASSERT(CmpMachineHiveList[i].CmHive2 != NULL);
1446
1447 /* Build the base name */
1448 RegName.Length = RegStart;
1449 RtlInitUnicodeString(&TempName, CmpMachineHiveList[i].BaseName);
1450 RtlAppendUnicodeStringToString(&RegName, &TempName);
1451
1452 /* Check if this is a child of the root */
1453 if (RegName.Buffer[RegName.Length / sizeof(WCHAR) - 1] == OBJ_NAME_PATH_SEPARATOR)
1454 {
1455 /* Then setup the whole name */
1457 RtlAppendUnicodeStringToString(&RegName, &TempName);
1458 }
1459
1460 /* Now link the hive to its master */
1461 Status = CmpLinkHiveToMaster(&RegName,
1462 NULL,
1463 CmpMachineHiveList[i].CmHive2,
1466 if (Status != STATUS_SUCCESS)
1467 {
1468 /* Linking needs to work */
1469 KeBugCheckEx(CONFIG_LIST_FAILED, 11, Status, i, (ULONG_PTR)&RegName);
1470 }
1471
1472 /* Check if we had to allocate a new hive */
1474 {
1475 /* Sync the new hive */
1476 //HvSyncHive((PHHIVE)(CmpMachineHiveList[i].CmHive2));
1477 }
1478 }
1479
1480 /* Check if we created a new hive */
1481 if (CmpMachineHiveList[i].CmHive2)
1482 {
1483 /* Add to HiveList key */
1485 }
1486 }
1487
1488 /* Get rid of the SD */
1490
1491 /* Link SECURITY to SAM */
1492 CmpLinkKeyToHive(L"\\Registry\\Machine\\Security\\SAM",
1493 L"\\Registry\\Machine\\SAM\\SAM");
1494
1495 /* Link S-1-5-18 to .Default */
1497 CmpLinkKeyToHive(L"\\Registry\\User\\S-1-5-18",
1498 L"\\Registry\\User\\.Default");
1500}
1501
1502CODE_SEG("INIT")
1503BOOLEAN
1504NTAPI
1506{
1511 PCMHIVE HardwareHive;
1513 PAGED_CODE();
1514
1515 /* Check if this is PE-boot */
1516 if (InitIsWinPEMode)
1517 {
1518 /* Set registry to PE mode */
1521 }
1522
1523 /* Initialize the hive list and lock */
1527
1528 /* Initialize registry lock */
1530
1531 /* Initialize the cache */
1533
1534 /* Initialize allocation and delayed dereferencing */
1538
1539 /* Initialize callbacks */
1541
1542 /* Initialize self healing */
1545
1546 /* Save the current process and lock the registry */
1548
1549 /* Create the key object types */
1551 if (!NT_SUCCESS(Status))
1552 {
1553 /* Bugcheck */
1554 KeBugCheckEx(CONFIG_INITIALIZATION_FAILED, 1, 1, Status, 0);
1555 }
1556
1557 /* Build the master hive */
1562 NULL,
1563 NULL,
1564 NULL,
1565 NULL,
1566 NULL,
1567 0);
1568 if (!NT_SUCCESS(Status))
1569 {
1570 /* Bugcheck */
1571 KeBugCheckEx(CONFIG_INITIALIZATION_FAILED, 1, 2, Status, 0);
1572 }
1573
1574 /* Create the \REGISTRY key node */
1575 if (!CmpCreateRegistryRoot())
1576 {
1577 /* Bugcheck */
1578 KeBugCheckEx(CONFIG_INITIALIZATION_FAILED, 1, 3, 0, 0);
1579 }
1580
1581 /* Create the default security descriptor */
1583
1584 /* Create '\Registry\Machine' key */
1585 RtlInitUnicodeString(&KeyName, L"\\REGISTRY\\MACHINE");
1587 &KeyName,
1589 NULL,
1594 0,
1595 NULL,
1596 0,
1597 NULL);
1598 if (!NT_SUCCESS(Status))
1599 {
1600 /* Bugcheck */
1601 KeBugCheckEx(CONFIG_INITIALIZATION_FAILED, 1, 5, Status, 0);
1602 }
1603
1604 /* Close the handle */
1606
1607 /* Create '\Registry\User' key */
1608 RtlInitUnicodeString(&KeyName, L"\\REGISTRY\\USER");
1610 &KeyName,
1612 NULL,
1617 0,
1618 NULL,
1619 0,
1620 NULL);
1621 if (!NT_SUCCESS(Status))
1622 {
1623 /* Bugcheck */
1624 KeBugCheckEx(CONFIG_INITIALIZATION_FAILED, 1, 6, Status, 0);
1625 }
1626
1627 /* Close the handle */
1629
1630 /* After this point, do not allow creating keys in the master hive */
1632
1633 /* Initialize the system hive */
1635 {
1636 /* Bugcheck */
1637 KeBugCheckEx(CONFIG_INITIALIZATION_FAILED, 1, 7, 0, 0);
1638 }
1639
1640 /* Create the 'CurrentControlSet' link */
1642 if (!NT_SUCCESS(Status))
1643 {
1644 /* Bugcheck */
1645 KeBugCheckEx(CONFIG_INITIALIZATION_FAILED, 1, 8, Status, 0);
1646 }
1647
1648 /* Create the hardware hive */
1649 Status = CmpInitializeHive(&HardwareHive,
1653 NULL,
1654 NULL,
1655 NULL,
1656 NULL,
1657 NULL,
1658 0);
1659 if (!NT_SUCCESS(Status))
1660 {
1661 /* Bugcheck */
1662 KeBugCheckEx(CONFIG_INITIALIZATION_FAILED, 1, 11, Status, 0);
1663 }
1664
1665 /* Add the hive to the hive list */
1666 CmpMachineHiveList[0].CmHive = HardwareHive;
1667
1668 /* Attach it to the machine key */
1669 RtlInitUnicodeString(&KeyName, L"\\Registry\\Machine\\HARDWARE");
1671 NULL,
1672 HardwareHive,
1673 TRUE,
1675 if (!NT_SUCCESS(Status))
1676 {
1677 /* Bugcheck */
1678 KeBugCheckEx(CONFIG_INITIALIZATION_FAILED, 1, 12, Status, 0);
1679 }
1680
1681 /* Add to HiveList key */
1682 CmpAddToHiveFileList(HardwareHive);
1683
1684 /* Free the security descriptor */
1686
1687 /* Fill out the Hardware key with the ARC Data from the Loader */
1689 if (!NT_SUCCESS(Status))
1690 {
1691 /* Bugcheck */
1692 KeBugCheckEx(CONFIG_INITIALIZATION_FAILED, 1, 13, Status, 0);
1693 }
1694
1695 /* Initialize machine-dependent information into the registry */
1697 if (!NT_SUCCESS(Status))
1698 {
1699 /* Bugcheck */
1700 KeBugCheckEx(CONFIG_INITIALIZATION_FAILED, 1, 14, Status, 0);
1701 }
1702
1703 /* Initialize volatile registry settings */
1705 if (!NT_SUCCESS(Status))
1706 {
1707 /* Bugcheck */
1708 KeBugCheckEx(CONFIG_INITIALIZATION_FAILED, 1, 15, Status, 0);
1709 }
1710
1711 /* Free the load options */
1713
1714 /* If we got here, all went well */
1715 return TRUE;
1716}
1717
1718CODE_SEG("INIT")
1720NTAPI
1722{
1723 LIST_ENTRY DriverList;
1726 PCM_KEY_BODY KeyBody;
1727 PHHIVE Hive;
1728 HCELL_INDEX RootCell, ControlCell;
1731 PLIST_ENTRY NextEntry;
1732 ULONG i;
1733 PUNICODE_STRING* ServicePath = NULL;
1734 BOOLEAN Success, AutoSelect;
1736 PAGED_CODE();
1737
1738 /* Initialize the driver list */
1739 InitializeListHead(&DriverList);
1740
1741 /* Open the system hive key */
1742 RtlInitUnicodeString(&KeyName, L"\\Registry\\Machine\\System");
1744 &KeyName,
1746 NULL,
1747 NULL);
1749 if (!NT_SUCCESS(Status)) return NULL;
1750
1751 /* Reference the key object to get the root hive/cell to access directly */
1755 KernelMode,
1756 (PVOID*)&KeyBody,
1757 NULL);
1758 if (!NT_SUCCESS(Status))
1759 {
1760 /* Fail */
1762 return NULL;
1763 }
1764
1765 /* Do all this under the registry lock */
1767
1768 /* Get the hive and key cell */
1769 Hive = KeyBody->KeyControlBlock->KeyHive;
1770 RootCell = KeyBody->KeyControlBlock->KeyCell;
1771
1772 /* Open the current control set key */
1773 RtlInitUnicodeString(&KeyName, L"Current");
1774 ControlCell = CmpFindControlSet(Hive, RootCell, &KeyName, &AutoSelect);
1775 if (ControlCell == HCELL_NIL) goto EndPath;
1776
1777 /* Find all system drivers */
1778 Success = CmpFindDrivers(Hive, ControlCell, SystemLoad, NULL, &DriverList);
1779 if (!Success) goto EndPath;
1780
1781 /* Sort by group/tag */
1782 if (!CmpSortDriverList(Hive, ControlCell, &DriverList)) goto EndPath;
1783
1784 /* Remove circular dependencies (cycles) and sort */
1785 if (!CmpResolveDriverDependencies(&DriverList)) goto EndPath;
1786
1787 /* Loop the list to count drivers */
1788 for (i = 0, NextEntry = DriverList.Flink;
1789 NextEntry != &DriverList;
1790 i++, NextEntry = NextEntry->Flink);
1791
1792 /* Allocate the array */
1793 ServicePath = ExAllocatePool(NonPagedPool, (i + 1) * sizeof(PUNICODE_STRING));
1794 if (!ServicePath) KeBugCheckEx(CONFIG_INITIALIZATION_FAILED, 2, 1, 0, 0);
1795
1796 /* Loop the driver list */
1797 for (i = 0, NextEntry = DriverList.Flink;
1798 NextEntry != &DriverList;
1799 i++, NextEntry = NextEntry->Flink)
1800 {
1801 /* Get the entry */
1803
1804 /* Allocate the path for the caller */
1805 ServicePath[i] = ExAllocatePool(NonPagedPool, sizeof(UNICODE_STRING));
1806 if (!ServicePath[i])
1807 {
1808 KeBugCheckEx(CONFIG_INITIALIZATION_FAILED, 2, 1, 0, 0);
1809 }
1810
1811 /* Duplicate the registry path */
1813 &DriverEntry->RegistryPath,
1814 ServicePath[i]);
1815 if (!NT_SUCCESS(Status))
1816 {
1817 KeBugCheckEx(CONFIG_INITIALIZATION_FAILED, 2, 1, 0, 0);
1818 }
1819 }
1820
1821 /* Terminate the list */
1822 ServicePath[i] = NULL;
1823
1824EndPath:
1825 /* Free the driver list if we had one */
1826 if (!IsListEmpty(&DriverList)) CmpFreeDriverList(Hive, &DriverList);
1827
1828 /* Unlock the registry */
1830
1831 /* Close the key handle and dereference the object, then return the path */
1832 ObDereferenceObject(KeyBody);
1834 return ServicePath;
1835}
1836
1837VOID
1838NTAPI
1840{
1841 /* Enter a critical region and lock the registry */
1844
1845 /* Sanity check */
1848}
1849
1850VOID
1851NTAPI
1853{
1854 /* Enter a critical region */
1856
1857 /* Check if we have to starve writers */
1859 {
1860 /* Starve exlusive waiters */
1862 }
1863 else
1864 {
1865 /* Just grab the lock */
1867 }
1868}
1869
1870BOOLEAN
1871NTAPI
1873{
1874 /* Test the lock */
1876}
1877
1878BOOLEAN
1879NTAPI
1881{
1882 /* Test the lock */
1884}
1885
1886VOID
1887NTAPI
1889{
1890 /* Lock the flusher. We should already be in a critical section */
1892 ASSERT((ExIsResourceAcquiredShared(Hive->FlusherLock) == 0) &&
1893 (ExIsResourceAcquiredExclusiveLite(Hive->FlusherLock) == 0));
1894 ExAcquireResourceExclusiveLite(Hive->FlusherLock, TRUE);
1895}
1896
1897VOID
1898NTAPI
1900{
1901 /* Lock the flusher. We should already be in a critical section */
1903 ASSERT((ExIsResourceAcquiredShared(Hive->FlusherLock) == 0) &&
1904 (ExIsResourceAcquiredExclusiveLite(Hive->FlusherLock) == 0));
1905 ExAcquireResourceSharedLite(Hive->FlusherLock, TRUE);
1906}
1907
1908VOID
1909NTAPI
1911{
1912 /* Sanity check */
1915
1916 /* Release the lock */
1917 ExReleaseResourceLite(Hive->FlusherLock);
1918}
1919
1920BOOLEAN
1921NTAPI
1923{
1924 /* Test the lock */
1925 return !ExIsResourceAcquiredSharedLite(Hive->FlusherLock) ? FALSE : TRUE;
1926}
1927
1928BOOLEAN
1929NTAPI
1931{
1932 /* Test the lock */
1933 return !ExIsResourceAcquiredExclusiveLite(Hive->FlusherLock) ? FALSE : TRUE;
1934}
1935
1936VOID
1937NTAPI
1939{
1940 /* Sanity check */
1942
1943 /* Check if we should flush the registry */
1945 {
1946 /* The registry should be exclusively locked for this */
1948
1949 /* Flush the registry */
1952 }
1953
1954 /* Release the lock and leave the critical region */
1957}
1958
1959VOID
1960NTAPI
1962 IN ULONG ConvKey2)
1963{
1964 ULONG Index1, Index2;
1965
1966 /* Sanity check */
1968
1969 /* Get hash indexes */
1970 Index1 = GET_HASH_INDEX(ConvKey1);
1971 Index2 = GET_HASH_INDEX(ConvKey2);
1972
1973 /* See which one is highest */
1974 if (Index1 < Index2)
1975 {
1976 /* Grab them in the proper order */
1979 }
1980 else
1981 {
1982 /* Grab the second one first, then the first */
1984 if (Index1 != Index2) CmpAcquireKcbLockExclusiveByKey(ConvKey1);
1985 }
1986}
1987
1988VOID
1989NTAPI
1991 IN ULONG ConvKey2)
1992{
1993 ULONG Index1, Index2;
1994
1995 /* Sanity check */
1997
1998 /* Get hash indexes */
1999 Index1 = GET_HASH_INDEX(ConvKey1);
2000 Index2 = GET_HASH_INDEX(ConvKey2);
2003
2004 /* See which one is highest */
2005 if (Index1 < Index2)
2006 {
2007 /* Grab them in the proper order */
2010 CmpReleaseKcbLockByKey(ConvKey2);
2011 CmpReleaseKcbLockByKey(ConvKey1);
2012 }
2013 else
2014 {
2015 /* Release the first one first, then the second */
2016 if (Index1 != Index2)
2017 {
2020 CmpReleaseKcbLockByKey(ConvKey1);
2021 }
2022 CmpReleaseKcbLockByKey(ConvKey2);
2023 }
2024}
2025
2026VOID
2027NTAPI
2029{
2030 PLIST_ENTRY ListEntry;
2031 PCMHIVE Hive;
2032
2033 /* Kill the workers */
2035
2036 /* Flush all hives */
2039
2040 /* Close all hive files */
2041 ListEntry = CmpHiveListHead.Flink;
2042 while (ListEntry != &CmpHiveListHead)
2043 {
2044 Hive = CONTAINING_RECORD(ListEntry, CMHIVE, HiveList);
2045
2046 CmpCloseHiveFiles(Hive);
2047
2048 ListEntry = ListEntry->Flink;
2049 }
2050
2052}
2053
2054VOID
2055NTAPI
2057{
2063 ANSI_STRING TempString;
2064 HANDLE SoftwareKeyHandle = NULL;
2065 HANDLE MicrosoftKeyHandle = NULL;
2066 HANDLE WindowsNtKeyHandle = NULL;
2067 HANDLE CurrentVersionKeyHandle = NULL;
2068 WCHAR Buffer[128]; // Buffer large enough to contain a full ULONG in decimal
2069 // representation, and the full 'CurrentType' string.
2070
2071 /*
2072 * Open the 'HKLM\Software\Microsoft\Windows NT\CurrentVersion' key
2073 * (create the intermediate subkeys if needed).
2074 */
2075
2076 RtlInitUnicodeString(&KeyName, L"\\REGISTRY\\MACHINE\\SOFTWARE");
2078 &KeyName,
2080 NULL,
2081 NULL);
2082 Status = NtCreateKey(&SoftwareKeyHandle,
2085 0,
2086 NULL,
2087 0,
2088 NULL);
2089 if (!NT_SUCCESS(Status))
2090 {
2091 DPRINT1("Failed to create key %wZ (Status: %08lx)\n", &KeyName, Status);
2092 return;
2093 }
2094
2095 RtlInitUnicodeString(&KeyName, L"Microsoft");
2097 &KeyName,
2099 SoftwareKeyHandle,
2100 NULL);
2101 Status = NtCreateKey(&MicrosoftKeyHandle,
2104 0,
2105 NULL,
2106 0,
2107 NULL);
2108 if (!NT_SUCCESS(Status))
2109 {
2110 DPRINT1("Failed to create key %wZ (Status: %08lx)\n", &KeyName, Status);
2111 goto Quit;
2112 }
2113
2114 RtlInitUnicodeString(&KeyName, L"Windows NT");
2116 &KeyName,
2118 MicrosoftKeyHandle,
2119 NULL);
2120 Status = NtCreateKey(&WindowsNtKeyHandle,
2123 0,
2124 NULL,
2125 0,
2126 NULL);
2127 if (!NT_SUCCESS(Status))
2128 {
2129 DPRINT1("Failed to create key %wZ (Status: %08lx)\n", &KeyName, Status);
2130 goto Quit;
2131 }
2132
2133 RtlInitUnicodeString(&KeyName, L"CurrentVersion");
2135 &KeyName,
2137 WindowsNtKeyHandle,
2138 NULL);
2139 Status = NtCreateKey(&CurrentVersionKeyHandle,
2142 0,
2143 NULL,
2144 0,
2145 NULL);
2146 if (!NT_SUCCESS(Status))
2147 {
2148 DPRINT1("Failed to create key %wZ (Status: %08lx)\n", &KeyName, Status);
2149 goto Quit;
2150 }
2151
2152 /* Set the 'CurrentVersion' value */
2153 RtlInitUnicodeString(&ValueName, L"CurrentVersion");
2154 NtSetValueKey(CurrentVersionKeyHandle,
2155 &ValueName,
2156 0,
2157 REG_SZ,
2159 CmVersionString.Length + sizeof(WCHAR));
2160
2161 /* Set the 'CurrentBuildNumber' value */
2162 RtlInitUnicodeString(&ValueName, L"CurrentBuildNumber");
2163 RtlInitEmptyUnicodeString(&ValueData, Buffer, sizeof(Buffer));
2165 NtSetValueKey(CurrentVersionKeyHandle,
2166 &ValueName,
2167 0,
2168 REG_SZ,
2169 ValueData.Buffer,
2170 ValueData.Length + sizeof(WCHAR));
2171
2172 /* Set the 'BuildLab' value */
2173 RtlInitUnicodeString(&ValueName, L"BuildLab");
2174 RtlInitAnsiString(&TempString, NtBuildLab);
2176 if (NT_SUCCESS(Status))
2177 {
2178 NtSetValueKey(CurrentVersionKeyHandle,
2179 &ValueName,
2180 0,
2181 REG_SZ,
2182 ValueData.Buffer,
2183 ValueData.Length + sizeof(WCHAR));
2184 }
2185
2186 /* Set the 'CurrentType' value */
2187 RtlInitUnicodeString(&ValueName, L"CurrentType");
2189 L"%s %s",
2190#ifdef CONFIG_SMP
2191 L"Multiprocessor"
2192#else
2193 L"Uniprocessor"
2194#endif
2195 ,
2196#if (DBG == 1)
2197 L"Checked"
2198#else
2199 L"Free"
2200#endif
2201 );
2203 NtSetValueKey(CurrentVersionKeyHandle,
2204 &ValueName,
2205 0,
2206 REG_SZ,
2207 ValueData.Buffer,
2208 ValueData.Length + sizeof(WCHAR));
2209
2210 /* Set the 'CSDVersion' value */
2211 RtlInitUnicodeString(&ValueName, L"CSDVersion");
2212 if (CmCSDVersionString.Length != 0)
2213 {
2214 NtSetValueKey(CurrentVersionKeyHandle,
2215 &ValueName,
2216 0,
2217 REG_SZ,
2219 CmCSDVersionString.Length + sizeof(WCHAR));
2220 }
2221 else
2222 {
2223 NtDeleteValueKey(CurrentVersionKeyHandle, &ValueName);
2224 }
2225
2226 /* Set the 'CSDBuildNumber' value */
2227 RtlInitUnicodeString(&ValueName, L"CSDBuildNumber");
2228 if (CmNtSpBuildNumber != 0)
2229 {
2230 RtlInitEmptyUnicodeString(&ValueData, Buffer, sizeof(Buffer));
2232 NtSetValueKey(CurrentVersionKeyHandle,
2233 &ValueName,
2234 0,
2235 REG_SZ,
2236 ValueData.Buffer,
2237 ValueData.Length + sizeof(WCHAR));
2238 }
2239 else
2240 {
2241 NtDeleteValueKey(CurrentVersionKeyHandle, &ValueName);
2242 }
2243
2244 /* Set the 'SystemRoot' value */
2245 RtlInitUnicodeString(&ValueName, L"SystemRoot");
2246 NtSetValueKey(CurrentVersionKeyHandle,
2247 &ValueName,
2248 0,
2249 REG_SZ,
2251 NtSystemRoot.Length + sizeof(WCHAR));
2252
2253Quit:
2254 /* Close the keys */
2255 if (CurrentVersionKeyHandle != NULL)
2256 NtClose(CurrentVersionKeyHandle);
2257
2258 if (WindowsNtKeyHandle != NULL)
2259 NtClose(WindowsNtKeyHandle);
2260
2261 if (MicrosoftKeyHandle != NULL)
2262 NtClose(MicrosoftKeyHandle);
2263
2264 if (SoftwareKeyHandle != NULL)
2265 NtClose(SoftwareKeyHandle);
2266}
2267
2268/* EOF */
#define PAGED_CODE()
unsigned char BOOLEAN
struct NameRec_ * Name
Definition: cdprocs.h:460
#define OBJ_NAME_PATH_SEPARATOR
Definition: arcname_tests.c:25
NTSTATUS NTAPI CmpInitializeMachineDependentConfiguration(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: cmhardwr.c:21
#define InterlockedIncrement
Definition: armddk.h:53
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
WCHAR RootDirectory[MAX_PATH]
Definition: format.c:74
DWORD ClusterSize
Definition: format.c:67
PHHIVE SystemHive
Definition: registry.c:32
Definition: bufpool.h:45
struct _CM_KEY_BODY * PCM_KEY_BODY
#define CM_KEY_BODY_TYPE
Definition: cm.h:64
#define CM_NUMBER_OF_MACHINE_HIVES
Definition: cm.h:112
struct _CM_KEY_BODY CM_KEY_BODY
#define CMP_ASSERT_EXCLUSIVE_REGISTRY_LOCK()
Definition: cm_x.h:61
FORCEINLINE VOID CmpAcquireKcbLockExclusiveByKey(IN ULONG ConvKey)
Definition: cm_x.h:112
#define CMP_ASSERT_FLUSH_LOCK(h)
Definition: cm_x.h:266
#define GET_HASH_ENTRY(Table, ConvKey)
Definition: cm_x.h:20
#define GET_HASH_INDEX(ConvKey)
Definition: cm_x.h:18
#define CmpAcquireKcbLockShared(k)
Definition: cm_x.h:121
#define CMP_ASSERT_REGISTRY_LOCK()
Definition: cm_x.h:46
FORCEINLINE VOID CmpReleaseKcbLockByKey(ULONG ConvKey)
Definition: cm_x.h:179
#define CMP_ASSERT_REGISTRY_LOCK_OR_LOADING(h)
Definition: cm_x.h:53
FORCEINLINE VOID CmpReleaseKcbLock(PCM_KEY_CONTROL_BLOCK Kcb)
Definition: cm_x.h:169
VOID NTAPI CmpInitCmPrivateAlloc(VOID)
Definition: cmalloc.c:29
VOID NTAPI CmpInitCmPrivateDelayAlloc(VOID)
Definition: cmalloc.c:44
BOOLEAN NTAPI CmpDoFlushAll(IN BOOLEAN ForceFlush)
Definition: cmapi.c:82
BOOLEAN NTAPI CmpFindDrivers(_In_ PHHIVE Hive, _In_ HCELL_INDEX ControlSet, _In_ SERVICE_LOAD_TYPE LoadType, _In_opt_ PCWSTR BootFileSystem, _Inout_ PLIST_ENTRY DriverListHead)
Enumerates all drivers within the given control set and load type, present in the "Services" sub-key,...
Definition: cmboot.c:679
BOOLEAN NTAPI CmpResolveDriverDependencies(_Inout_ PLIST_ENTRY DriverListHead)
Removes potential circular dependencies (cycles) and sorts the driver list.
Definition: cmboot.c:1030
HCELL_INDEX NTAPI CmpFindControlSet(_In_ PHHIVE SystemHive, _In_ HCELL_INDEX RootCell, _In_ PCUNICODE_STRING SelectKeyName, _Out_ PBOOLEAN AutoSelect)
Finds the corresponding "HKLM\SYSTEM\ControlSetXXX" system control set registry key,...
Definition: cmboot.c:84
BOOLEAN NTAPI CmpSortDriverList(_In_ PHHIVE Hive, _In_ HCELL_INDEX ControlSet, _Inout_ PLIST_ENTRY DriverListHead)
Sorts the driver list, according to the drivers' group load ordering.
Definition: cmboot.c:902
VOID NTAPI CmpFreeDriverList(_In_ PHHIVE Hive, _Inout_ PLIST_ENTRY DriverListHead)
Empties the driver list and frees all allocated driver nodes in it.
Definition: cmboot.c:1224
NTSTATUS NTAPI CmpInitializeHardwareConfiguration(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: cmconfig.c:329
EX_PUSH_LOCK CmpHiveListHeadLock
Definition: cmdata.c:39
EX_PUSH_LOCK CmpLoadHiveLock
Definition: cmdata.c:39
HIVE_LIST_ENTRY CmpMachineHiveList[]
Definition: cmdata.c:41
UNICODE_STRING CmSymbolicLinkValueName
Definition: cmdata.c:52
ULONG CmpBootType
Definition: cmdata.c:61
BOOLEAN CmpMiniNTBoot
Definition: cmdata.c:60
BOOLEAN CmpSelfHeal
Definition: cmdata.c:59
HANDLE CmpRegistryRootHandle
Definition: cmdata.c:66
BOOLEAN CmSelfHeal
Definition: cmdata.c:58
BOOLEAN CmpShareSystemHives
Definition: cmdata.c:57
UNICODE_STRING CmpLoadOptions
Definition: cmdata.c:55
struct _CM_KEY_NODE * PCM_KEY_NODE
#define KEY_COMP_NAME
Definition: cmdata.h:35
#define KEY_NO_DELETE
Definition: cmdata.h:33
#define CM_KEY_NODE_SIGNATURE
Definition: cmdata.h:21
#define KEY_HIVE_ENTRY
Definition: cmdata.h:32
VOID NTAPI CmpDelayDerefKeyControlBlock(IN PCM_KEY_CONTROL_BLOCK Kcb)
Definition: cmdelay.c:286
VOID NTAPI CmpInitDelayDerefKCBEngine(VOID)
Definition: cmdelay.c:268
VOID NTAPI CmpInitCallback(VOID)
Definition: cmhook.c:38
NTSTATUS CmiCallRegisteredCallbacks(IN REG_NOTIFY_CLASS Argument1, IN PVOID Argument2)
Definition: cmhook.c:59
NTSTATUS NTAPI CmpAddToHiveFileList(IN PCMHIVE Hive)
Definition: cmhvlist.c:130
VOID NTAPI CmpInitializeCache(VOID)
Definition: cmkcbncb.c:26
VOID NTAPI DelistKeyBodyFromKCB(IN PCM_KEY_BODY KeyBody, IN BOOLEAN LockHeld)
Definition: cmkcbncb.c:1100
PCM_KEY_HASH_TABLE_ENTRY CmpCacheTable
Definition: cmkcbncb.c:18
PCM_KEY_CONTROL_BLOCK NTAPI CmpCreateKeyControlBlock(IN PHHIVE Hive, IN HCELL_INDEX Index, IN PCM_KEY_NODE Node, IN PCM_KEY_CONTROL_BLOCK Parent, IN ULONG Flags, IN PUNICODE_STRING KeyName)
Definition: cmkcbncb.c:655
PUNICODE_STRING NTAPI CmpConstructName(IN PCM_KEY_CONTROL_BLOCK Kcb)
Definition: cmkcbncb.c:897
VOID NTAPI EnlistKeyBodyWithKCB(IN PCM_KEY_BODY KeyBody, IN ULONG Flags)
Definition: cmkcbncb.c:1042
VOID NTAPI CmpShutdownWorkers(VOID)
Definition: cmlazy.c:432
#define HvReleaseCell(Hive, Cell)
Definition: cmlib.h:384
USHORT NTAPI CmpCopyName(IN PHHIVE Hive, OUT PWCHAR Destination, IN PCUNICODE_STRING Source)
Definition: cmname.c:21
USHORT NTAPI CmpNameSize(IN PHHIVE Hive, IN PCUNICODE_STRING Name)
Definition: cmname.c:74
#define HvGetCell(Hive, Cell)
Definition: cmlib.h:381
HCELL_INDEX CMAPI HvAllocateCell(PHHIVE RegistryHive, ULONG Size, HSTORAGE_TYPE Storage, IN HCELL_INDEX Vicinity)
#define TAG_CM
Definition: cmlib.h:205
#define TAG_CMSD
Definition: cmlib.h:208
NTSTATUS NTAPI CmpParseKey(IN PVOID ParseObject, IN PVOID ObjectType, IN OUT PACCESS_STATE AccessState, IN KPROCESSOR_MODE AccessMode, IN ULONG Attributes, IN OUT PUNICODE_STRING CompleteName, IN OUT PUNICODE_STRING RemainingName, IN OUT PVOID Context OPTIONAL, IN PSECURITY_QUALITY_OF_SERVICE SecurityQos OPTIONAL, OUT PVOID *Object)
Definition: cmparse.c:1030
VOID NTAPI CmpDeleteKeyObject(PVOID DeletedObject)
Definition: cmsysini.c:108
BOOLEAN NTAPI CmpLinkKeyToHive(_In_z_ PCWSTR LinkKeyName, _In_z_ PCWSTR TargetKeyName)
Definition: cmsysini.c:41
VOID NTAPI CmpSetVersionData(VOID)
Definition: cmsysini.c:2056
BOOLEAN NTAPI CmpCreateRegistryRoot(VOID)
Definition: cmsysini.c:1066
VOID NTAPI CmpLockRegistryExclusive(VOID)
Definition: cmsysini.c:1839
BOOLEAN NTAPI CmpTestHiveFlusherLockShared(IN PCMHIVE Hive)
Definition: cmsysini.c:1922
VOID NTAPI CmpUnlockRegistry(VOID)
Definition: cmsysini.c:1938
ERESOURCE CmpRegistryLock
Definition: cmsysini.c:18
LONG CmpFlushStarveWriters
Definition: cmlazy.c:27
KEVENT CmpLoadWorkerEvent
Definition: cmsysini.c:21
NTSTATUS NTAPI CmpLinkHiveToMaster(IN PUNICODE_STRING LinkName, IN HANDLE RootDirectory, IN PCMHIVE RegistryHive, IN BOOLEAN Allocate, IN PSECURITY_DESCRIPTOR SecurityDescriptor)
Definition: cmsysini.c:797
POBJECT_TYPE CmpKeyObjectType
Definition: cmsysini.c:15
VOID NTAPI CmpLockHiveFlusherExclusive(IN PCMHIVE Hive)
Definition: cmsysini.c:1888
BOOLEAN NTAPI CmpTestHiveFlusherLockExclusive(IN PCMHIVE Hive)
Definition: cmsysini.c:1930
VOID NTAPI CmpAcquireTwoKcbLocksExclusiveByKey(IN ULONG ConvKey1, IN ULONG ConvKey2)
Definition: cmsysini.c:1961
PEPROCESS CmpSystemProcess
Definition: cmsysini.c:23
VOID NTAPI CmpReleaseTwoKcbLockByKey(IN ULONG ConvKey1, IN ULONG ConvKey2)
Definition: cmsysini.c:1990
BOOLEAN NTAPI CmInitSystem1(VOID)
Definition: cmsysini.c:1505
VOID NTAPI CmpLockRegistry(VOID)
Definition: cmsysini.c:1852
VOID NTAPI CmpLockHiveFlusherShared(IN PCMHIVE Hive)
Definition: cmsysini.c:1899
NTSTATUS NTAPI CmpCreateObjectTypes(VOID)
Definition: cmsysini.c:976
NTSTATUS NTAPI CmpCreateControlSet(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: cmsysini.c:523
VOID NTAPI CmpInitializeHiveList(VOID)
Definition: cmsysini.c:1352
BOOLEAN CmpSpecialBootCondition
Definition: cmsysini.c:27
VOID NTAPI CmpCloseKeyObject(IN PEPROCESS Process OPTIONAL, IN PVOID Object, IN ACCESS_MASK GrantedAccess, IN ULONG ProcessHandleCount, IN ULONG SystemHandleCount)
Definition: cmsysini.c:158
BOOLEAN NTAPI CmpInitializeSystemHive(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: cmsysini.c:864
static PCWSTR CmpGetRegistryPath(VOID)
Definition: cmsysini.c:1164
BOOLEAN HvShutdownComplete
Definition: cmsysini.c:24
BOOLEAN CmpNoVolatileCreates
Definition: cmsysini.c:31
PCMHIVE CmiVolatileHive
Definition: cmsysini.c:16
BOOLEAN CmpProfileLoaded
Definition: cmsysini.c:30
BOOLEAN NTAPI CmpTestRegistryLockExclusive(VOID)
Definition: cmsysini.c:1880
LIST_ENTRY CmpHiveListHead
Definition: cmsysini.c:17
BOOLEAN CmpWasSetupBoot
Definition: cmsysini.c:29
BOOLEAN CmpNoWrite
Definition: cmsysini.c:28
BOOLEAN CmFirstTime
Definition: ntapi.c:17
NTSTATUS NTAPI CmpInitHiveFromFile(IN PCUNICODE_STRING HiveName, IN ULONG HiveFlags, OUT PCMHIVE *Hive, IN OUT PBOOLEAN New, IN ULONG CheckFlags)
Definition: cmsysini.c:285
ULONG CmpTraceLevel
Definition: cmsysini.c:32
BOOLEAN NTAPI CmpCreateRootNode(IN PHHIVE Hive, IN PCWSTR Name, OUT PHCELL_INDEX Index)
Definition: cmsysini.c:1010
VOID NTAPI CmpUnlockHiveFlusher(IN PCMHIVE Hive)
Definition: cmsysini.c:1910
PVOID CmpRegistryLockCallerCaller
Definition: cmsysini.c:25
BOOLEAN CmpFlushOnLockRelease
Definition: cmsysini.c:26
LIST_ENTRY CmpSelfHealQueueListHead
Definition: cmsysini.c:20
PVOID CmpRegistryLockCaller
Definition: cmsysini.c:25
NTSTATUS NTAPI CmpQueryKeyName(IN PVOID ObjectBody, IN BOOLEAN HasName, IN OUT POBJECT_NAME_INFORMATION ObjectNameInfo, IN ULONG Length, OUT PULONG ReturnLength, IN KPROCESSOR_MODE PreviousMode)
Definition: cmsysini.c:183
VOID NTAPI CmShutdownSystem(VOID)
Definition: cmsysini.c:2028
PUNICODE_STRING *NTAPI CmGetSystemDriverList(VOID)
Definition: cmsysini.c:1721
BOOLEAN NTAPI CmpTestRegistryLock(VOID)
Definition: cmsysini.c:1872
LONG CmpLoadWorkerIncrement
Definition: cmsysini.c:22
KGUARDED_MUTEX CmpSelfHealQueueLock
Definition: cmsysini.c:19
static NTSTATUS CmpCreateHardwareProfile(HANDLE ControlSetHandle)
Definition: cmsysini.c:451
NTSTATUS NTAPI CmpSetSystemValues(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: cmsysini.c:396
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:36
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
static const WCHAR Cleanup[]
Definition: register.c:80
DRIVER_INITIALIZE DriverEntry
Definition: condrv.c:21
#define UlongToPtr(u)
Definition: config.h:106
#define PtrToUlong(u)
Definition: config.h:107
IN CINT OUT PVOID IN ULONG OUT PULONG ReturnLength
Definition: dumpinfo.c:43
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define IsListEmpty(ListHead)
Definition: env_spec_w32.h:954
NTSTATUS ExInitializeResourceLite(PULONG res)
Definition: env_spec_w32.h:641
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
Definition: env_spec_w32.h:478
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
#define KeSetEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:476
#define KeQuerySystemTime(t)
Definition: env_spec_w32.h:570
#define ExAcquireResourceExclusiveLite(res, wait)
Definition: env_spec_w32.h:615
#define NonPagedPool
Definition: env_spec_w32.h:307
ULONG ERESOURCE
Definition: env_spec_w32.h:594
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define ExAcquireResourceSharedLite(res, wait)
Definition: env_spec_w32.h:621
#define PagedPool
Definition: env_spec_w32.h:308
@ Success
Definition: eventcreate.c:712
#define ExInitializePushLock
Definition: ex.h:1013
#define ExAllocatePool(type, size)
Definition: fbtusb.h:44
struct _FileName FileName
Definition: fatprocs.h:896
#define _SEH2_END
Definition: filesup.c:22
#define _SEH2_TRY
Definition: filesup.c:19
_Must_inspect_result_ _In_opt_ PFLT_INSTANCE _Out_ PHANDLE FileHandle
Definition: fltkernel.h:1231
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
FP_OP Operation
Definition: fpcontrol.c:150
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:223
Status
Definition: gdiplustypes.h:25
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
VOID FASTCALL KeInitializeGuardedMutex(OUT PKGUARDED_MUTEX GuardedMutex)
Definition: gmutex.c:31
#define RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE
Definition: green.h:15
#define KeGetCurrentThread
Definition: hal.h:55
NTSTATUS NTAPI NtRaiseHardError(IN NTSTATUS ErrorStatus, IN ULONG NumberOfParameters, IN ULONG UnicodeStringParameterMask, IN PULONG_PTR Parameters, IN ULONG ValidResponseOptions, OUT PULONG Response)
Definition: harderr.c:551
#define HINIT_CREATE
Definition: hivedata.h:13
ULONG * PHCELL_INDEX
Definition: hivedata.h:80
@ Volatile
Definition: hivedata.h:103
@ Stable
Definition: hivedata.h:102
#define HBLOCK_SIZE
Definition: hivedata.h:41
#define HINIT_FILE
Definition: hivedata.h:15
#define HINIT_MEMORY
Definition: hivedata.h:14
#define HFILE_TYPE_LOG
Definition: hivedata.h:34
#define HIVE_VOLATILE
Definition: hivedata.h:23
#define HFILE_TYPE_PRIMARY
Definition: hivedata.h:33
#define HCELL_NIL
Definition: hivedata.h:85
ULONG HCELL_INDEX
Definition: hivedata.h:80
#define HIVE_NOLAZYFLUSH
Definition: hivedata.h:24
_In_ GUID _In_ PVOID ValueData
Definition: hubbusif.h:312
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define OBJ_EXCLUSIVE
Definition: winternl.h:227
#define OBJ_PERMANENT
Definition: winternl.h:226
@ ProcessHandleCount
Definition: winternl.h:876
NTSYSAPI NTSTATUS WINAPI RtlDuplicateUnicodeString(int, const UNICODE_STRING *, UNICODE_STRING *)
static CODE_SEG("PAGE")
Definition: isapnp.c:1482
#define KeLeaveCriticalRegion()
Definition: ke_x.h:119
#define KeEnterCriticalRegion()
Definition: ke_x.h:88
PLOADER_PARAMETER_BLOCK KeLoaderBlock
Definition: krnlinit.c:29
#define REG_SZ
Definition: layer.c:22
#define ASSERT(a)
Definition: mode.c:44
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define DBG(x)
Definition: moztest.c:12
#define _Function_class_(x)
Definition: ms_sal.h:2946
#define _In_z_
Definition: ms_sal.h:313
_In_ UINT _Out_ PNDIS_HANDLE LogHandle
Definition: ndis.h:5382
_In_ UINT _In_ UINT BytesToCopy
Definition: ndis.h:3168
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4715
#define KernelMode
Definition: asm.h:34
_In_ ACCESS_MASK _In_ POBJECT_ATTRIBUTES _Reserved_ ULONG _In_opt_ PUNICODE_STRING _In_ ULONG _Out_opt_ PULONG Disposition
Definition: cmfuncs.h:56
@ OptionOk
Definition: extypes.h:187
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
_Out_writes_bytes_to_opt_ AbsoluteSecurityDescriptorSize PSECURITY_DESCRIPTOR _Inout_ PULONG _Out_writes_bytes_to_opt_ DaclSize PACL _Inout_ PULONG _Out_writes_bytes_to_opt_ SaclSize PACL _Inout_ PULONG _Out_writes_bytes_to_opt_ OwnerSize PSID Owner
Definition: rtlfuncs.h:1597
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeStringFromAsciiz(_Out_ PUNICODE_STRING Destination, _In_ PCSZ Source)
#define THREAD_ALL_ACCESS
Definition: nt_native.h:1339
NTSYSAPI NTSTATUS NTAPI NtOpenKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
Definition: ntapi.c:336
NTSYSAPI NTSTATUS NTAPI NtSetValueKey(IN HANDLE KeyHandle, IN PUNICODE_STRING ValueName, IN ULONG TitleIndex OPTIONAL, IN ULONG Type, IN PVOID Data, IN ULONG DataSize)
Definition: ntapi.c:859
@ KeyValueFullInformation
Definition: nt_native.h:1181
NTSYSAPI NTSTATUS NTAPI RtlAppendUnicodeStringToString(PUNICODE_STRING Destination, PUNICODE_STRING Source)
ULONG ACCESS_MASK
Definition: nt_native.h:40
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
#define KEY_READ
Definition: nt_native.h:1023
NTSYSAPI NTSTATUS NTAPI NtDeleteValueKey(IN HANDLE KeyHandle, IN PUNICODE_STRING ValueName)
Definition: ntapi.c:1014
#define REG_OPTION_CREATE_LINK
Definition: nt_native.h:1063
NTSYSAPI NTSTATUS NTAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString, PANSI_STRING SourceString, BOOLEAN AllocateDestinationString)
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define KEY_CREATE_SUB_KEY
Definition: nt_native.h:1018
#define FILE_CREATED
Definition: nt_native.h:770
NTSYSAPI NTSTATUS NTAPI NtQueryValueKey(IN HANDLE KeyHandle, IN PUNICODE_STRING ValueName, IN KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass, IN PVOID KeyValueInformation, IN ULONG Length, IN PULONG ResultLength)
#define REG_CREATED_NEW_KEY
Definition: nt_native.h:1084
struct _OBJECT_NAME_INFORMATION OBJECT_NAME_INFORMATION
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define KEY_EXECUTE
Definition: nt_native.h:1037
NTSYSAPI NTSTATUS NTAPI RtlIntegerToUnicodeString(ULONG Value, ULONG Base, PUNICODE_STRING String)
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3402
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define KEY_WRITE
Definition: nt_native.h:1031
#define REG_LINK
Definition: nt_native.h:1500
#define KEY_CREATE_LINK
Definition: nt_native.h:1021
#define REG_OPTION_VOLATILE
Definition: nt_native.h:1060
NTSYSAPI VOID NTAPI RtlInitAnsiString(PANSI_STRING DestinationString, PCSZ SourceString)
struct _KEY_VALUE_FULL_INFORMATION * PKEY_VALUE_FULL_INFORMATION
#define KEY_SET_VALUE
Definition: nt_native.h:1017
NTSTATUS NTAPI NtCreateKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, IN ULONG TitleIndex, IN PUNICODE_STRING Class OPTIONAL, IN ULONG CreateOptions, OUT PULONG Disposition OPTIONAL)
Definition: ntapi.c:240
#define UNICODE_NULL
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
@ SynchronizationEvent
NTSTATUS NTAPI CmpInitializeHive(OUT PCMHIVE *CmHive, IN ULONG OperationType, IN ULONG HiveFlags, IN ULONG FileType, IN PVOID HiveData OPTIONAL, IN HANDLE Primary, IN HANDLE Log, IN HANDLE External, IN PCUNICODE_STRING FileName OPTIONAL, IN ULONG CheckFlags)
Definition: cminit.c:19
VOID NTAPI CmpCloseHiveFiles(IN PCMHIVE Hive)
Definition: cminit.c:637
NTSTATUS NTAPI CmpOpenHiveFiles(IN PCUNICODE_STRING BaseName, IN PCWSTR Extension OPTIONAL, OUT PHANDLE Primary, OUT PHANDLE Log, OUT PULONG PrimaryDisposition, OUT PULONG LogDisposition, IN BOOLEAN CreateAllowed, IN BOOLEAN MarkAsSystemHive, IN BOOLEAN NoBuffering, OUT PULONG ClusterSize OPTIONAL)
Definition: cminit.c:266
PSECURITY_DESCRIPTOR NTAPI CmpHiveRootSecurityDescriptor(VOID)
Definition: cmse.c:21
NTSTATUS NTAPI CmpSecurityMethod(IN PVOID ObjectBody, IN SECURITY_OPERATION_CODE OperationCode, IN PSECURITY_INFORMATION SecurityInformation, IN OUT PSECURITY_DESCRIPTOR SecurityDescriptor, IN OUT PULONG BufferLength, IN OUT PSECURITY_DESCRIPTOR *OldSecurityDescriptor, IN POOL_TYPE PoolType, IN PGENERIC_MAPPING GenericMapping)
Definition: cmse.c:261
UNICODE_STRING NtSystemRoot
Definition: init.c:75
CHAR NtBuildLab[]
Definition: init.c:64
UNICODE_STRING CmVersionString
Definition: init.c:61
ULONG CmNtSpBuildNumber
Definition: init.c:58
BOOLEAN ExpInTextModeSetup
Definition: init.c:69
UNICODE_STRING CmCSDVersionString
Definition: init.c:62
BOOLEAN InitIsWinPEMode
Definition: init.c:72
BOOLEAN NTAPI ExAcquireSharedStarveExclusive(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:1068
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
Definition: resource.c:1822
BOOLEAN NTAPI ExIsResourceAcquiredExclusiveLite(IN PERESOURCE Resource)
Definition: resource.c:1624
ULONG NTAPI ExIsResourceAcquiredSharedLite(IN PERESOURCE Resource)
Definition: resource.c:1663
NTSTATUS NTAPI PsTerminateSystemThread(IN NTSTATUS ExitStatus)
Definition: kill.c:1145
HANDLE NTAPI PsGetCurrentProcessId(VOID)
Definition: process.c:1123
NTSTATUS NTAPI PsCreateSystemThread(OUT PHANDLE ThreadHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, IN HANDLE ProcessHandle, IN PCLIENT_ID ClientId, IN PKSTART_ROUTINE StartRoutine, IN PVOID StartContext)
Definition: thread.c:602
#define STATUS_TOO_LATE
Definition: ntstatus.h:626
#define STATUS_KEY_DELETED
Definition: ntstatus.h:613
#define STATUS_CANNOT_LOAD_REGISTRY_FILE
Definition: ntstatus.h:668
NTSTRSAFEVAPI RtlStringCbPrintfW(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PWSTR pszDest, _In_ size_t cbDest, _In_ _Printf_format_string_ NTSTRSAFE_PCWSTR pszFormat,...)
Definition: ntstrsafe.h:1173
#define L(x)
Definition: ntvdm.h:50
NTSTATUS NTAPI ObCloseHandle(IN HANDLE Handle, IN KPROCESSOR_MODE AccessMode)
Definition: obhandle.c:3379
NTSTATUS NTAPI ObInsertObject(IN PVOID Object, IN PACCESS_STATE AccessState OPTIONAL, IN ACCESS_MASK DesiredAccess, IN ULONG ObjectPointerBias, OUT PVOID *NewObject OPTIONAL, OUT PHANDLE Handle)
Definition: obhandle.c:2935
NTSTATUS NTAPI ObOpenObjectByName(IN POBJECT_ATTRIBUTES ObjectAttributes, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, IN PACCESS_STATE PassedAccessState, IN ACCESS_MASK DesiredAccess, IN OUT PVOID ParseContext, OUT PHANDLE Handle)
Definition: obhandle.c:2532
NTSTATUS NTAPI ObCreateObject(IN KPROCESSOR_MODE ProbeMode OPTIONAL, IN POBJECT_TYPE Type, IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, IN KPROCESSOR_MODE AccessMode, IN OUT PVOID ParseContext OPTIONAL, IN ULONG ObjectSize, IN ULONG PagedPoolCharge OPTIONAL, IN ULONG NonPagedPoolCharge OPTIONAL, OUT PVOID *Object)
Definition: oblife.c:1039
NTSTATUS NTAPI ObCreateObjectType(IN PUNICODE_STRING TypeName, IN POBJECT_TYPE_INITIALIZER ObjectTypeInitializer, IN PVOID Reserved, OUT POBJECT_TYPE *ObjectType)
Definition: oblife.c:1136
NTSTATUS NTAPI ObReferenceObjectByHandle(IN HANDLE Handle, IN ACCESS_MASK DesiredAccess, IN POBJECT_TYPE ObjectType, IN KPROCESSOR_MODE AccessMode, OUT PVOID *Object, OUT POBJECT_HANDLE_INFORMATION HandleInformation OPTIONAL)
Definition: obref.c:494
long LONG
Definition: pedump.c:60
unsigned short USHORT
Definition: pedump.c:61
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:159
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:34
#define New(t)
Definition: rtf.h:1086
VOID NTAPI KeBugCheckEx(_In_ ULONG BugCheckCode, _In_ ULONG_PTR BugCheckParameter1, _In_ ULONG_PTR BugCheckParameter2, _In_ ULONG_PTR BugCheckParameter3, _In_ ULONG_PTR BugCheckParameter4)
Definition: rtlcompat.c:108
#define REG_DWORD
Definition: sdbapi.c:596
static PMEMKEY RootKey
Definition: registry.c:55
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:71
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
ULONG NtBuildNumber
Definition: init.c:50
Definition: arc.h:246
HCELL_INDEX List
Definition: cmdata.h:75
ULONG Count
Definition: cmdata.h:74
Definition: cmlib.h:245
HHIVE Hive
Definition: cmlib.h:246
ULONG Flags
Definition: cmlib.h:283
HANDLE FileHandles[HFILE_TYPE_MAX]
Definition: cmlib.h:247
UNICODE_STRING FileFullPath
Definition: cmlib.h:262
ULONG Type
Definition: cm.h:221
struct _CM_NOTIFY_BLOCK * NotifyBlock
Definition: cm.h:223
struct _CM_KEY_CONTROL_BLOCK * KeyControlBlock
Definition: cm.h:222
USHORT Signature
Definition: cmdata.h:92
HCELL_INDEX Parent
Definition: cmdata.h:96
WCHAR Name[ANYSIZE_ARRAY]
Definition: cmdata.h:116
HCELL_INDEX SubKeyLists[HTYPE_COUNT]
Definition: cmdata.h:102
ULONG MaxValueNameLen
Definition: cmdata.h:111
ULONG MaxNameLen
Definition: cmdata.h:109
ULONG SubKeyCounts[HTYPE_COUNT]
Definition: cmdata.h:97
HCELL_INDEX Security
Definition: cmdata.h:107
USHORT NameLength
Definition: cmdata.h:114
USHORT ClassLength
Definition: cmdata.h:115
ULONG MaxClassLen
Definition: cmdata.h:110
HCELL_INDEX Class
Definition: cmdata.h:108
ULONG MaxValueDataLen
Definition: cmdata.h:112
CHILD_LIST ValueList
Definition: cmdata.h:103
USHORT Flags
Definition: cmdata.h:93
LARGE_INTEGER LastWriteTime
Definition: cmdata.h:94
PHHIVE KeyHive
Definition: cmdata.h:84
HCELL_INDEX KeyCell
Definition: cmdata.h:83
CM_KEY_REFERENCE ChildHive
Definition: cm.h:414
BOOLEAN CreateLink
Definition: cm.h:416
BOOLEAN CreateOperation
Definition: cm.h:417
ULONG Length
Definition: hivedata.h:276
ULONG BootType
Definition: hivedata.h:161
ULONG BootRecover
Definition: hivedata.h:162
ULONG HiveFlags
Definition: hivedata.h:321
ULONG Cluster
Definition: hivedata.h:308
DUAL Storage[HTYPE_COUNT]
Definition: hivedata.h:331
PHBASE_BLOCK BaseBlock
Definition: hivedata.h:303
BOOLEAN ThreadStarted
Definition: cm.h:401
PCMHIVE CmHive
Definition: cm.h:396
PCMHIVE CmHive2
Definition: cm.h:399
BOOLEAN Allocate
Definition: cm.h:402
BOOLEAN ThreadFinished
Definition: cm.h:400
ULONG HHiveFlags
Definition: cm.h:397
ULONG CmHiveFlags
Definition: cm.h:398
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
OB_CLOSE_METHOD CloseProcedure
Definition: obtypes.h:368
OB_SECURITY_METHOD SecurityProcedure
Definition: obtypes.h:371
GENERIC_MAPPING GenericMapping
Definition: obtypes.h:358
OB_DELETE_METHOD DeleteProcedure
Definition: obtypes.h:369
OB_QUERYNAME_METHOD QueryNameProcedure
Definition: obtypes.h:372
OB_PARSE_METHOD ParseProcedure
Definition: obtypes.h:370
Definition: cmtypes.h:858
PVOID Object
Definition: cmtypes.h:859
NTSTATUS Status
Definition: cmtypes.h:860
USHORT MaximumLength
Definition: env_spec_w32.h:370
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
uint32_t * PULONG_PTR
Definition: typedefs.h:65
uint32_t * PULONG
Definition: typedefs.h:59
const uint16_t * PCWSTR
Definition: typedefs.h:57
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
unsigned char * PBOOLEAN
Definition: typedefs.h:53
#define NTAPI
Definition: typedefs.h:36
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define IN
Definition: typedefs.h:39
uint16_t * PWCHAR
Definition: typedefs.h:56
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
unsigned char * PUCHAR
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
static int Link(const char **args)
Definition: vfdcmd.c:2414
_Must_inspect_result_ _In_ WDFCOLLECTION _In_ WDFOBJECT Object
_In_ WDFCOLLECTION _In_ ULONG Index
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG _Out_ PULONG ResultLength
Definition: wdfdevice.h:3776
_In_ WDFDEVICE _In_ WDF_SPECIAL_FILE_TYPE FileType
Definition: wdfdevice.h:2741
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
Definition: wdfdevice.h:2699
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING ValueName
Definition: wdfregistry.h:243
BOOL WINAPI EndPath(_In_ HDC)
#define LoadString
Definition: winuser.h:5809
_In_ USHORT _In_ ULONG _In_ PSOCKADDR _In_ PSOCKADDR _Reserved_ ULONG _In_opt_ PVOID _In_opt_ const WSK_CLIENT_CONNECTION_DISPATCH _In_opt_ PEPROCESS _In_opt_ PETHREAD _In_opt_ PSECURITY_DESCRIPTOR SecurityDescriptor
Definition: wsk.h:191
@ RegNtPreKeyHandleClose
Definition: cmtypes.h:655
@ RegNtPostKeyHandleClose
Definition: cmtypes.h:666
@ SystemLoad
Definition: cmtypes.h:997
#define ExIsResourceAcquiredShared
Definition: exfuncs.h:348
_In_opt_ PALLOCATE_FUNCTION Allocate
Definition: exfuncs.h:814
@ Executive
Definition: ketypes.h:403
CCHAR KPROCESSOR_MODE
Definition: ketypes.h:7
#define ObDereferenceObject
Definition: obfuncs.h:203
#define PsGetCurrentProcess
Definition: psfuncs.h:17
NTSYSAPI VOID NTAPI RtlGetCallersAddress(_Out_ PVOID *CallersAddress, _Out_ PVOID *CallersCaller)
Definition: except.c:22
_In_ KPROCESSOR_MODE PreviousMode
Definition: sefuncs.h:103
_In_ PSECURITY_SUBJECT_CONTEXT _In_ BOOLEAN _In_ ACCESS_MASK _In_ ACCESS_MASK _Outptr_opt_ PPRIVILEGE_SET _In_ PGENERIC_MAPPING _In_ KPROCESSOR_MODE _Out_ PACCESS_MASK GrantedAccess
Definition: sefuncs.h:20
__wchar_t WCHAR
Definition: xmlstorage.h:180
char CHAR
Definition: xmlstorage.h:175