https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a18424267bf35061809d1…
commit a18424267bf35061809d1198f0616e280504fd91
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Sun Aug 11 16:39:28 2024 +0200
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Thu Dec 19 11:52:13 2024 +0100
[NTOS:CM] Add some more configuration options.
Add support for configuring the CM lazy-flush and delay-close variables:
`CmpLazyFlushIntervalInSeconds`, `CmpLazyFlushHiveCount`,
and `CmpDelayedCloseSize`,
using REG_DWORD values named respectively:
`RegistryLazyFlushInterval`, `RegistryLazyFlushHiveCount`,
and `DelayCloseSize`,
in the registry key
`HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Configuration Manager` .
Extra observations:
- While delay-close support exists in Windows 2003, configuring
the delay-close size is possible only in Windows Vista and later.
- The possibility of configuring the lazy-flush hive count has been
removed in Windows 8+.
See the comparison tables at:
https://redplait.blogspot.com/2011/07/cmcontrolvector.html
https://redplait.blogspot.com/2012/06/cmcontrolvector-for-w8.html
https://redplait.blogspot.com/2016/03/cmcontrolvector-from-windows-10-build…
In addition:
Remove `CmpDelayedCloseIndex` from cm.h as it is not used anymore in our code.
---
ntoskrnl/config/cmdata.c | 21 +++++++++++++++++++++
ntoskrnl/config/cmlazy.c | 6 +++---
ntoskrnl/include/internal/cm.h | 4 +++-
3 files changed, 27 insertions(+), 4 deletions(-)
diff --git a/ntoskrnl/config/cmdata.c b/ntoskrnl/config/cmdata.c
index e428377a6fc..47f166f56c2 100644
--- a/ntoskrnl/config/cmdata.c
+++ b/ntoskrnl/config/cmdata.c
@@ -675,6 +675,27 @@ DATA_SEG("INITDATA") CM_SYSTEM_CONTROL_VECTOR
CmControlVector[] =
NULL,
NULL
},
+ {
+ L"Session Manager\\Configuration Manager",
+ L"RegistryLazyFlushInterval",
+ &CmpLazyFlushIntervalInSeconds,
+ NULL,
+ NULL
+ },
+ {
+ L"Session Manager\\Configuration Manager",
+ L"RegistryLazyFlushHiveCount",
+ &CmpLazyFlushHiveCount,
+ NULL,
+ NULL
+ },
+ {
+ L"Session Manager\\Configuration Manager",
+ L"DelayCloseSize",
+ &CmpDelayedCloseSize,
+ NULL,
+ NULL
+ },
{
L"Session Manager\\Configuration Manager",
L"VolatileBoot",
diff --git a/ntoskrnl/config/cmlazy.c b/ntoskrnl/config/cmlazy.c
index ebac8a20532..201f719a3a4 100644
--- a/ntoskrnl/config/cmlazy.c
+++ b/ntoskrnl/config/cmlazy.c
@@ -22,7 +22,7 @@ BOOLEAN CmpLazyFlushPending;
BOOLEAN CmpForceForceFlush;
BOOLEAN CmpHoldLazyFlush = TRUE;
ULONG CmpLazyFlushIntervalInSeconds = 5;
-static ULONG CmpLazyFlushHiveCount = 7;
+ULONG CmpLazyFlushHiveCount = 7;
ULONG CmpLazyFlushCount = 1;
LONG CmpFlushStarveWriters;
@@ -60,7 +60,7 @@ CmpDoFlushNextHive(_In_ BOOLEAN ForceFlush,
if (!(CmHive->Hive.HiveFlags & HIVE_NOLAZYFLUSH) &&
(CmHive->FlushCount != CmpLazyFlushCount))
{
- /* Great sucess! */
+ /* Great success! */
Result = TRUE;
/* One less to flush */
@@ -80,7 +80,7 @@ CmpDoFlushNextHive(_In_ BOOLEAN ForceFlush,
DPRINT("Flushing: %wZ\n", &CmHive->FileFullPath);
DPRINT("Handle: %p\n",
CmHive->FileHandles[HFILE_TYPE_PRIMARY]);
Status = HvSyncHive(&CmHive->Hive);
- if(!NT_SUCCESS(Status))
+ if (!NT_SUCCESS(Status))
{
/* Let them know we failed */
DPRINT1("Failed to flush %wZ on handle %p (status
0x%08lx)\n",
diff --git a/ntoskrnl/include/internal/cm.h b/ntoskrnl/include/internal/cm.h
index 02d8b9e177c..7aed5fef6e4 100644
--- a/ntoskrnl/include/internal/cm.h
+++ b/ntoskrnl/include/internal/cm.h
@@ -1460,7 +1460,7 @@ extern HANDLE CmpRegistryRootHandle;
extern BOOLEAN ExpInTextModeSetup;
extern BOOLEAN InitIsWinPEMode;
extern ULONG CmpHashTableSize;
-extern ULONG CmpDelayedCloseSize, CmpDelayedCloseIndex;
+extern ULONG CmpDelayedCloseSize;
extern BOOLEAN CmpNoWrite;
extern BOOLEAN CmpForceForceFlush;
extern BOOLEAN CmpWasSetupBoot;
@@ -1468,6 +1468,8 @@ extern BOOLEAN CmpProfileLoaded;
extern PCMHIVE CmiVolatileHive;
extern LIST_ENTRY CmiKeyObjectListHead;
extern BOOLEAN CmpHoldLazyFlush;
+extern ULONG CmpLazyFlushIntervalInSeconds;
+extern ULONG CmpLazyFlushHiveCount;
extern BOOLEAN HvShutdownComplete;
//