[NTOS:CM] Implement support for alternate registry hives

Sometimes repairing a broken hive with a hive log does not always guarantee the hive
in question has fully recovered. In worst cases it could happen the LOG itself is even
corrupt too and that would certainly lead to a total unbootable system. This is most likely
if the victim hive is the SYSTEM hive.

This can be anyhow solved by the help of a mirror hive, or also called an "alternate hive".
Alternate hives serve the purpose as backup hives for primary hives of which there is still
a risk that is not worth taking. For now only the SYSTEM hive is granted the right to have
a backup alternate hive.

=== NOTE ===

Currently the SYSTEM hive can only base upon the alternate SYSTEM.ALT hive, which means the
corresponding LOG file never gets updated. When time comes the existing code must be adapted
to allow the possibility to use .ALT and .LOG hives simultaneously.
This commit is contained in:
George Bișoc 2023-10-30 18:07:21 +01:00
parent 279f8f8864
commit f3141fb29e
No known key found for this signature in database
GPG key ID: 688C4FBE25D7DEF6
8 changed files with 239 additions and 39 deletions

View file

@ -120,6 +120,10 @@
IN ULONG StartingIndex,
IN ULONG NumberToSet);
VOID NTAPI
RtlSetAllBits(
IN PRTL_BITMAP BitMapHeader);
VOID NTAPI
RtlClearAllBits(
IN PRTL_BITMAP BitMapHeader);
@ -509,6 +513,11 @@ BOOLEAN CMAPI
HvWriteHive(
PHHIVE RegistryHive);
BOOLEAN
CMAPI
HvWriteAlternateHive(
_In_ PHHIVE RegistryHive);
BOOLEAN
CMAPI
HvSyncHiveFromRecover(