https://git.reactos.org/?p=reactos.git;a=commitdiff;h=4db1b0fb6289f79de4499…
commit 4db1b0fb6289f79de44991d44e9b772798fa98f1
Author: George Bișoc <george.bisoc(a)reactos.org>
AuthorDate: Wed Oct 26 21:29:03 2022 +0200
Commit: George Bișoc <george.bisoc(a)reactos.org>
CommitDate: Sun Nov 19 20:44:28 2023 +0100
[SDK][CMLIB] Purge volatile data of registry in a proper way with CmCheckRegistry
Thanks to CmCheckRegistry, the function can perform volatile data purging upon boot
which this removes old hacky CmPrepareHive code. This also slightly refactors HvInitialize
making it more proper.
---
sdk/lib/cmlib/cminit.c | 71 ------------------------------------------------
sdk/lib/cmlib/cmlib.h | 5 ----
sdk/lib/cmlib/hiveinit.c | 7 -----
3 files changed, 83 deletions(-)
diff --git a/sdk/lib/cmlib/cminit.c b/sdk/lib/cmlib/cminit.c
index d7c7d208797..f7c5a2f122a 100644
--- a/sdk/lib/cmlib/cminit.c
+++ b/sdk/lib/cmlib/cminit.c
@@ -69,74 +69,3 @@ CmCreateRootNode(
HvReleaseCell(Hive, RootCellIndex);
return TRUE;
}
-
-static VOID CMAPI
-CmpPrepareKey(
- PHHIVE RegistryHive,
- PCM_KEY_NODE KeyCell);
-
-static VOID CMAPI
-CmpPrepareIndexOfKeys(
- PHHIVE RegistryHive,
- PCM_KEY_INDEX IndexCell)
-{
- ULONG i;
-
- if (IndexCell->Signature == CM_KEY_INDEX_ROOT ||
- IndexCell->Signature == CM_KEY_INDEX_LEAF)
- {
- for (i = 0; i < IndexCell->Count; i++)
- {
- PCM_KEY_INDEX SubIndexCell = (PCM_KEY_INDEX)HvGetCell(RegistryHive,
IndexCell->List[i]);
- if (SubIndexCell->Signature == CM_KEY_NODE_SIGNATURE)
- CmpPrepareKey(RegistryHive, (PCM_KEY_NODE)SubIndexCell);
- else
- CmpPrepareIndexOfKeys(RegistryHive, SubIndexCell);
- }
- }
- else if (IndexCell->Signature == CM_KEY_FAST_LEAF ||
- IndexCell->Signature == CM_KEY_HASH_LEAF)
- {
- PCM_KEY_FAST_INDEX HashCell = (PCM_KEY_FAST_INDEX)IndexCell;
- for (i = 0; i < HashCell->Count; i++)
- {
- PCM_KEY_NODE SubKeyCell = (PCM_KEY_NODE)HvGetCell(RegistryHive,
HashCell->List[i].Cell);
- CmpPrepareKey(RegistryHive, SubKeyCell);
- }
- }
- else
- {
- DPRINT1("IndexCell->Signature %x\n", IndexCell->Signature);
- ASSERT(FALSE);
- }
-}
-
-static VOID CMAPI
-CmpPrepareKey(
- PHHIVE RegistryHive,
- PCM_KEY_NODE KeyCell)
-{
- PCM_KEY_INDEX IndexCell;
-
- ASSERT(KeyCell->Signature == CM_KEY_NODE_SIGNATURE);
-
- KeyCell->SubKeyCounts[Volatile] = 0;
- // KeyCell->SubKeyLists[Volatile] = HCELL_NIL; // FIXME! Done only on Windows <
XP.
-
- /* Enumerate and add subkeys */
- if (KeyCell->SubKeyCounts[Stable] > 0)
- {
- IndexCell = (PCM_KEY_INDEX)HvGetCell(RegistryHive,
KeyCell->SubKeyLists[Stable]);
- CmpPrepareIndexOfKeys(RegistryHive, IndexCell);
- }
-}
-
-VOID CMAPI
-CmPrepareHive(
- PHHIVE RegistryHive)
-{
- PCM_KEY_NODE RootCell;
-
- RootCell = (PCM_KEY_NODE)HvGetCell(RegistryHive,
RegistryHive->BaseBlock->RootCell);
- CmpPrepareKey(RegistryHive, RootCell);
-}
diff --git a/sdk/lib/cmlib/cmlib.h b/sdk/lib/cmlib/cmlib.h
index 8a7c13c6f15..fc73e5a58ac 100644
--- a/sdk/lib/cmlib/cmlib.h
+++ b/sdk/lib/cmlib/cmlib.h
@@ -637,11 +637,6 @@ CmCreateRootNode(
PHHIVE Hive,
PCWSTR Name);
-VOID CMAPI
-CmPrepareHive(
- PHHIVE RegistryHive);
-
-
/* NT-style Public Cm functions */
//
diff --git a/sdk/lib/cmlib/hiveinit.c b/sdk/lib/cmlib/hiveinit.c
index 3ec381695ed..d4adeb99518 100644
--- a/sdk/lib/cmlib/hiveinit.c
+++ b/sdk/lib/cmlib/hiveinit.c
@@ -1443,13 +1443,6 @@ HvInitialize(
}
}
- if (!NT_SUCCESS(Status)) return Status;
-
- /* HACK: ROS: Init root key cell and prepare the hive */
- // r31253
- // if (OperationType == HINIT_CREATE) CmCreateRootNode(Hive, L"");
- if (OperationType != HINIT_CREATE) CmPrepareHive(Hive);
-
return Status;
}