https://git.reactos.org/?p=reactos.git;a=commitdiff;h=cc40a5870a67a2eaefa03e1931408996621c5ffa

commit cc40a5870a67a2eaefa03e1931408996621c5ffa
Author:     Hermès Bélusca-Maïto <hermes.belusca-ma...@reactos.org>
AuthorDate: Sat Aug 10 21:22:11 2024 +0200
Commit:     Hermès Bélusca-Maïto <hermes.belusca-ma...@reactos.org>
CommitDate: Sun Dec 15 22:15:13 2024 +0100

    [NTOS:CM] Implement Win7+ VolatileBoot support.
    
    Its support is controlled with a REG_DWORD value named
    `VolatileBoot` inside the registry key
    `HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Configuration 
Manager` .
    
    Its implementation is very trivial: when enabled, CmpShareSystemHives
    is set to TRUE and doesn't change state during runtime.
    In a sense this is similar to what happens in WinPE-boot, except that
    ALL hives without exception (system hives and others) will be loaded
    in shared mode.
---
 ntoskrnl/config/cmdata.c       | 9 +++++++++
 ntoskrnl/config/cmsysini.c     | 6 +++++-
 ntoskrnl/include/internal/cm.h | 1 +
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/ntoskrnl/config/cmdata.c b/ntoskrnl/config/cmdata.c
index aa9b1f010be..e428377a6fc 100644
--- a/ntoskrnl/config/cmdata.c
+++ b/ntoskrnl/config/cmdata.c
@@ -54,6 +54,8 @@ UNICODE_STRING CmSymbolicLinkValueName =
 
 UNICODE_STRING CmpLoadOptions;
 
+/* TRUE if all hives must be loaded in shared mode */
+ULONG CmpVolatileBoot;
 /* TRUE if the system hives must be loaded in shared mode */
 BOOLEAN CmpShareSystemHives;
 /* TRUE when the registry is in PE mode */
@@ -673,6 +675,13 @@ DATA_SEG("INITDATA") CM_SYSTEM_CONTROL_VECTOR 
CmControlVector[] =
         NULL,
         NULL
     },
+    {
+        L"Session Manager\\Configuration Manager",
+        L"VolatileBoot",
+        &CmpVolatileBoot,
+        NULL,
+        NULL
+    },
     {
         L"Session Manager",
         L"ForceNpxEmulation",
diff --git a/ntoskrnl/config/cmsysini.c b/ntoskrnl/config/cmsysini.c
index a8ddc104073..df1de46a210 100644
--- a/ntoskrnl/config/cmsysini.c
+++ b/ntoskrnl/config/cmsysini.c
@@ -1164,7 +1164,7 @@ CmpCreateRegistryRoot(VOID)
         return FALSE;
     }
 
-    /* Completely sucessful */
+    /* Completely successful */
     return TRUE;
 }
 
@@ -1635,6 +1635,10 @@ CmInitSystem1(VOID)
         CmpMiniNTBoot = TRUE;
         CmpShareSystemHives = TRUE;
     }
+    /* If we are in volatile boot mode, ALL hives without exception
+     * (system hives and others) will be loaded in shared mode */
+    if (CmpVolatileBoot)
+        CmpShareSystemHives = TRUE;
 
     /* Initialize the hive list and lock */
     InitializeListHead(&CmpHiveListHead);
diff --git a/ntoskrnl/include/internal/cm.h b/ntoskrnl/include/internal/cm.h
index 8d33736c482..02d8b9e177c 100644
--- a/ntoskrnl/include/internal/cm.h
+++ b/ntoskrnl/include/internal/cm.h
@@ -1420,6 +1420,7 @@ CmGetSystemDriverList(
 extern ULONG CmpTraceLevel;
 extern BOOLEAN CmpSpecialBootCondition;
 extern BOOLEAN CmpFlushOnLockRelease;
+extern ULONG CmpVolatileBoot;
 extern BOOLEAN CmpShareSystemHives;
 extern BOOLEAN CmpMiniNTBoot;
 extern BOOLEAN CmpNoVolatileCreates;

Reply via email to