[NTOS] Addendum to da81345: Fix checks when a hive is opened in shared mode.

This commit is contained in:
Hermès Bélusca-Maïto 2017-11-13 00:27:41 +01:00
parent 3ad5c7fd84
commit 0b2bbd1125
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
2 changed files with 13 additions and 8 deletions

View file

@ -38,15 +38,17 @@ CmpInitializeHive(OUT PCMHIVE *CmHive,
/* /*
* The following are invalid: * The following are invalid:
* An external hive that is also internal. * - An external hive that is also internal.
* A log hive that's not a primary hive too. * - A log hive that is not a primary hive too.
* A volatile hive that's linked to permanent storage. * - A volatile hive that is linked to permanent storage,
* An in-memory initialization without hive data. * unless this hive is a shared system hive.
* A log hive that's not linked to a correct file type. * - An in-memory initialization without hive data.
* - A log hive that is not linked to a correct file type.
*/ */
if (((External) && ((Primary) || (Log))) || if (((External) && ((Primary) || (Log))) ||
((Log) && !(Primary)) || ((Log) && !(Primary)) ||
((HiveFlags & HIVE_VOLATILE) && ((Primary) || (External) || (Log))) || (!(CmpShareSystemHives) && (HiveFlags & HIVE_VOLATILE) &&
((Primary) || (External) || (Log))) ||
((OperationType == HINIT_MEMORY) && (!HiveData)) || ((OperationType == HINIT_MEMORY) && (!HiveData)) ||
((Log) && (FileType != HFILE_TYPE_LOG))) ((Log) && (FileType != HFILE_TYPE_LOG)))
{ {

View file

@ -1297,9 +1297,12 @@ CmpLoadHiveThread(IN PVOID StartContext)
&CmpMachineHiveList[i].Allocate, &CmpMachineHiveList[i].Allocate,
0); 0);
if (!(NT_SUCCESS(Status)) || 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; ErrorParameters = &FileName;
NtRaiseHardError(STATUS_CANNOT_LOAD_REGISTRY_FILE, NtRaiseHardError(STATUS_CANNOT_LOAD_REGISTRY_FILE,
1, 1,