https://git.reactos.org/?p=reactos.git;a=commitdiff;h=27917c14ed31ea24cf0a02...
commit 27917c14ed31ea24cf0a022200d9afd4e665009b Author: George Bișoc george.bisoc@reactos.org AuthorDate: Sun Oct 29 20:34:54 2023 +0100 Commit: George Bișoc george.bisoc@reactos.org CommitDate: Sun Nov 19 20:44:29 2023 +0100
[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. --- ntoskrnl/config/cmsysini.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/ntoskrnl/config/cmsysini.c b/ntoskrnl/config/cmsysini.c index f65449d1962..d74fffe07da 100644 --- a/ntoskrnl/config/cmsysini.c +++ b/ntoskrnl/config/cmsysini.c @@ -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;