From d4956b9c39a616637bb90fe76373115f37c59eb9 Mon Sep 17 00:00:00 2001 From: Thomas Faber Date: Thu, 26 Mar 2015 17:02:31 +0000 Subject: [PATCH] [NTOS:CM] - Do not allow the creation of keys in the master hive. Fixes boot with the VMware sound driver from rapps installed (and it works, too). CORE-5381 #resolve svn path=/trunk/; revision=66905 --- reactos/ntoskrnl/config/cmparse.c | 5 +++++ reactos/ntoskrnl/config/cmsysini.c | 8 +++++++- reactos/ntoskrnl/include/internal/cm.h | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/reactos/ntoskrnl/config/cmparse.c b/reactos/ntoskrnl/config/cmparse.c index c964437dc06..0bacbf19686 100644 --- a/reactos/ntoskrnl/config/cmparse.c +++ b/reactos/ntoskrnl/config/cmparse.c @@ -1266,6 +1266,11 @@ CmpParseKey(IN PVOID ParseObject, ParentKcb, Object); } + else if (Hive == &CmiVolatileHive->Hive && CmpNoVolatileCreates) + { + /* Creating keys in the master hive is not allowed */ + Status = STATUS_INVALID_PARAMETER; + } else { /* Do the create */ diff --git a/reactos/ntoskrnl/config/cmsysini.c b/reactos/ntoskrnl/config/cmsysini.c index 446045e1832..77d53928d9d 100644 --- a/reactos/ntoskrnl/config/cmsysini.c +++ b/reactos/ntoskrnl/config/cmsysini.c @@ -29,6 +29,7 @@ BOOLEAN CmpSpecialBootCondition; BOOLEAN CmpNoWrite; BOOLEAN CmpWasSetupBoot; BOOLEAN CmpProfileLoaded; +BOOLEAN CmpNoVolatileCreates; ULONG CmpTraceLevel = 0; extern LONG CmpFlushStarveWriters; @@ -1470,8 +1471,10 @@ CmpInitializeHiveList(IN USHORT Flag) L"\\Registry\\Machine\\SAM\\SAM"); /* Link S-1-5-18 to .Default */ + CmpNoVolatileCreates = FALSE; CmpLinkKeyToHive(L"\\Registry\\User\\S-1-5-18", L"\\Registry\\User\\.Default"); + CmpNoVolatileCreates = TRUE; } BOOLEAN @@ -1530,7 +1533,7 @@ CmInitSystem1(VOID) } /* Build the master hive */ - Status = CmpInitializeHive((PCMHIVE*)&CmiVolatileHive, + Status = CmpInitializeHive(&CmiVolatileHive, HINIT_CREATE, HIVE_VOLATILE, HFILE_TYPE_PRIMARY, @@ -1602,6 +1605,9 @@ CmInitSystem1(VOID) /* Close the handle */ NtClose(KeyHandle); + /* After this point, do not allow creating keys in the master hive */ + CmpNoVolatileCreates = TRUE; + /* Initialize the system hive */ if (!CmpInitializeSystemHive(KeLoaderBlock)) { diff --git a/reactos/ntoskrnl/include/internal/cm.h b/reactos/ntoskrnl/include/internal/cm.h index 1cc4ae77f66..1881476ec0f 100644 --- a/reactos/ntoskrnl/include/internal/cm.h +++ b/reactos/ntoskrnl/include/internal/cm.h @@ -1659,6 +1659,7 @@ extern BOOLEAN CmpSpecialBootCondition; extern BOOLEAN CmpFlushOnLockRelease; extern BOOLEAN CmpShareSystemHives; extern BOOLEAN CmpMiniNTBoot; +extern BOOLEAN CmpNoVolatileCreates; extern EX_PUSH_LOCK CmpHiveListHeadLock, CmpLoadHiveLock; extern LIST_ENTRY CmpHiveListHead; extern POBJECT_TYPE CmpKeyObjectType;