[NTOS:CM] Flush the dirty data to disk if the SYSTEM hive has been recovered by FreeLdr

If FreeLdr performed recovery against the SYSTEM hive with a log, all of its data is only present in volatile memory thus dirty. So the kernel is responsible to flush all the data that's been recovered within the SYSTEM hive into the backing storage.
This commit is contained in:
George Bișoc 2023-10-29 20:34:54 +01:00
parent fa80176a62
commit 27917c14ed
No known key found for this signature in database
GPG key ID: 688C4FBE25D7DEF6

View file

@ -1324,8 +1324,14 @@ CmpLoadHiveThread(IN PVOID StartContext)
//ASSERT(FALSE);
//}
/* Another thing we don't support is NTLDR-recovery */
if (CmHive->Hive.BaseBlock->BootRecover) ASSERT(FALSE);
/* FreeLdr has recovered the hive with a log, we must do a flush */
if (CmHive->Hive.BaseBlock->BootRecover == HBOOT_BOOT_RECOVERED_BY_HIVE_LOG)
{
DPRINT1("FreeLdr recovered the hive (hive 0x%p)\n", CmHive);
RtlSetAllBits(&CmHive->Hive.DirtyVector);
CmHive->Hive.DirtyCount = CmHive->Hive.DirtyVector.SizeOfBitMap;
HvSyncHive((PHHIVE)CmHive);
}
/* Finally, set our allocated hive to the same hive we've had */
CmpMachineHiveList[i].CmHive2 = CmHive;