https://git.reactos.org/?p=reactos.git;a=commitdiff;h=0b2bbd1125a935fb50e979...
commit 0b2bbd1125a935fb50e979812d3a34cfde500882 Author: Hermès Bélusca-Maïto hermes.belusca-maito@reactos.org AuthorDate: Mon Nov 13 00:27:41 2017 +0100
[NTOS] Addendum to da81345: Fix checks when a hive is opened in shared mode. --- ntoskrnl/config/cminit.c | 14 ++++++++------ ntoskrnl/config/cmsysini.c | 7 +++++-- 2 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/ntoskrnl/config/cminit.c b/ntoskrnl/config/cminit.c index 46ab61e4b3..bf055fd914 100644 --- a/ntoskrnl/config/cminit.c +++ b/ntoskrnl/config/cminit.c @@ -38,15 +38,17 @@ CmpInitializeHive(OUT PCMHIVE *CmHive,
/* * The following are invalid: - * An external hive that is also internal. - * A log hive that's not a primary hive too. - * A volatile hive that's linked to permanent storage. - * An in-memory initialization without hive data. - * A log hive that's not linked to a correct file type. + * - An external hive that is also internal. + * - A log hive that is not a primary hive too. + * - A volatile hive that is linked to permanent storage, + * unless this hive is a shared system hive. + * - An in-memory initialization without hive data. + * - A log hive that is not linked to a correct file type. */ if (((External) && ((Primary) || (Log))) || ((Log) && !(Primary)) || - ((HiveFlags & HIVE_VOLATILE) && ((Primary) || (External) || (Log))) || + (!(CmpShareSystemHives) && (HiveFlags & HIVE_VOLATILE) && + ((Primary) || (External) || (Log))) || ((OperationType == HINIT_MEMORY) && (!HiveData)) || ((Log) && (FileType != HFILE_TYPE_LOG))) { diff --git a/ntoskrnl/config/cmsysini.c b/ntoskrnl/config/cmsysini.c index 112543fac7..a433485eb2 100644 --- a/ntoskrnl/config/cmsysini.c +++ b/ntoskrnl/config/cmsysini.c @@ -1297,9 +1297,12 @@ CmpLoadHiveThread(IN PVOID StartContext) &CmpMachineHiveList[i].Allocate, 0); if (!(NT_SUCCESS(Status)) || - (!(CmHive->FileHandles[HFILE_TYPE_LOG]) && !(CmpMiniNTBoot))) // HACK + (!(CmpShareSystemHives) && !(CmHive->FileHandles[HFILE_TYPE_LOG]))) { - /* We failed or couldn't get a log file, raise a hard error */ + /* + * We failed, or could not get a log file (unless + * the hive is shared), raise a hard error. + */ ErrorParameters = &FileName; NtRaiseHardError(STATUS_CANNOT_LOAD_REGISTRY_FILE, 1,