https://git.reactos.org/?p=reactos.git;a=commitdiff;h=99fab7b90513392dd6ae4…
commit 99fab7b90513392dd6ae442812439c334dc5c215
Author: George Bișoc <george.bisoc(a)reactos.org>
AuthorDate: Wed Oct 26 18:20:03 2022 +0200
Commit: George Bișoc <george.bisoc(a)reactos.org>
CommitDate: Sun Nov 19 20:44:23 2023 +0100
[SDK][CMLIB] Declare some BootType and BootRecover identifiers & Miscellaneous
Stuff
=== DOCUMENTATION REMARKS ===
HBOOT_TYPE_REGULAR and HBOOT_TYPE_SELF_HEAL are boot type values set up by the CMLIB
library (for the BootType field respectively). HBOOT_TYPE_REGULAR indicates a normal
system boot whereas HBOOT_TYPE_SELF_HEAL indicates the system boot is assisted within self
healing mode.
Whether the former or the latter value is set it's governed by both the kernel and
the bootloader. The bootloader and the kernel negotiate together to determine if any of
the registry properties (the hive, the base block, the registry base, etc) are so severed
from corruption or not. In extreme cases where
registry healing is possible, the specific base block of the damaged hive will have
its flags marked with HBOOT_TYPE_SELF_HEAL. At this point the boot phase procedure is
orchestrated since the boot phase no longer goes on the default path but it's
assisted, as I have already said above.
HBOOT_NO_BOOT_RECOVER, HBOOT_BOOT_RECOVERED_BY_HIVE_LOG and
HBOOT_BOOT_RECOVERED_BY_ALTERNATE_HIVE on the other hand are identifiers for the
BootRecover field of the BASE_BLOCK header structure. These are used exclusively by
FreeLdr to tell the kernel if the bootloader recovered the SYSTEM hive or not. In case
where the bootloader did recover the SYSTEM hive,
the kernel will perform a flush request on the dirty data down to disk. The (almost)
worse case FreeLdr could not repair the main hive by applying log data, it will load the
alternate mirror version of the hive.
In addition to that, declare other miscellaneous CMLIB identifiers for log transaction
writes purposes.
---
sdk/lib/cmlib/hivedata.h | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/sdk/lib/cmlib/hivedata.h b/sdk/lib/cmlib/hivedata.h
index 39d617ccbd5..16f96de6b4f 100644
--- a/sdk/lib/cmlib/hivedata.h
+++ b/sdk/lib/cmlib/hivedata.h
@@ -44,6 +44,17 @@
#define HV_LOG_HEADER_SIZE FIELD_OFFSET(HBASE_BLOCK, Reserved2)
+//
+// Clean Block identifier
+//
+#define HV_CLEAN_BLOCK 0U
+
+//
+// Hive Log identifiers
+//
+#define HV_LOG_DIRTY_BLOCK 0xFF
+#define HV_LOG_DIRTY_SIGNATURE 0x54524944 // "DIRT"
+
//
// Hive structure identifiers
//
@@ -70,6 +81,19 @@
//
#define HTYPE_COUNT 2
+//
+// Hive boot types
+//
+#define HBOOT_TYPE_REGULAR 0
+#define HBOOT_TYPE_SELF_HEAL 4
+
+//
+// Hive boot recover types
+//
+#define HBOOT_NO_BOOT_RECOVER 0
+#define HBOOT_BOOT_RECOVERED_BY_HIVE_LOG 1
+#define HBOOT_BOOT_RECOVERED_BY_ALTERNATE_HIVE 2
+
/**
* @name HCELL_INDEX
*