https://git.reactos.org/?p=reactos.git;a=commitdiff;h=4bdfee8e8bec17c37b7b5…
commit 4bdfee8e8bec17c37b7b57720f460fe3bded2e6a
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Sun Nov 7 01:17:32 2021 +0100
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Thu Sep 21 13:33:28 2023 +0200
[NTOS:EX] Initialize ExpResourceTimeoutCount also via the "Session
Manager/ResourceTimeoutCount" registry value (#4089)
For more details, see
http://systemmanager.ru/win2k_regestry.en/29859.htm
https://www.betaarchive.com/wiki/index.php/Microsoft_KB_Archive/102985#Reso…
---
ntoskrnl/config/cmdata.c | 2 +-
ntoskrnl/ex/resource.c | 15 ++++++++++-----
ntoskrnl/include/internal/ex.h | 1 +
3 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/ntoskrnl/config/cmdata.c b/ntoskrnl/config/cmdata.c
index 28ac7041793..80c91534b44 100644
--- a/ntoskrnl/config/cmdata.c
+++ b/ntoskrnl/config/cmdata.c
@@ -561,7 +561,7 @@ DATA_SEG("INITDATA") CM_SYSTEM_CONTROL_VECTOR
CmControlVector[] =
{
L"Session Manager",
L"ResourceTimeoutCount",
- &DummyData,
+ &ExpResourceTimeoutCount,
NULL,
NULL
},
diff --git a/ntoskrnl/ex/resource.c b/ntoskrnl/ex/resource.c
index 5b90c89813c..2ea09a92053 100644
--- a/ntoskrnl/ex/resource.c
+++ b/ntoskrnl/ex/resource.c
@@ -18,7 +18,7 @@
#define IsOwnedExclusive(r) (r->Flag & ResourceOwnedExclusive)
#define IsBoostAllowed(r) (!(r->Flag & ResourceHasDisabledPriorityBoost))
-#if (!(defined(CONFIG_SMP)) && !(DBG))
+#if !defined(CONFIG_SMP) && !DBG
FORCEINLINE
VOID
@@ -65,13 +65,17 @@ ExReleaseResourceLock(IN PERESOURCE Resource,
/* Release the lock */
KeReleaseInStackQueuedSpinLock(LockHandle);
}
-#endif
+
+#endif // !defined(CONFIG_SMP) && !DBG
/* DATA***********************************************************************/
LARGE_INTEGER ExShortTime = {{-100000, -1}};
LARGE_INTEGER ExpTimeout;
-ULONG ExpResourceTimeoutCount = 90 * 3600 / 2;
+
+/* Timeout value for resources in 4-second units (7 days) */
+ULONG ExpResourceTimeoutCount = 90 * 3600 / 2; // NT value: 648000 (30 days)
+
KSPIN_LOCK ExpResourceSpinLock;
LIST_ENTRY ExpSystemResourcesList;
BOOLEAN ExResourceStrict = TRUE;
@@ -631,7 +635,7 @@ ExpWaitForResource(IN PERESOURCE Resource,
/* Increase contention count and use a 5 second timeout */
Resource->ContentionCount++;
- Timeout.QuadPart = 500 * -10000;
+ Timeout.QuadPart = 500 * -10000LL;
for (;;)
{
/* Wait for ownership */
@@ -640,7 +644,8 @@ ExpWaitForResource(IN PERESOURCE Resource,
KernelMode,
FALSE,
&Timeout);
- if (Status != STATUS_TIMEOUT) break;
+ if (Status != STATUS_TIMEOUT)
+ break;
/* Increase wait count */
WaitCount++;
diff --git a/ntoskrnl/include/internal/ex.h b/ntoskrnl/include/internal/ex.h
index 03d9d29a8b5..f80cc7f8efd 100644
--- a/ntoskrnl/include/internal/ex.h
+++ b/ntoskrnl/include/internal/ex.h
@@ -19,6 +19,7 @@ extern ERESOURCE ExpFirmwareTableResource;
extern ERESOURCE ExpTimeRefreshLock;
extern LIST_ENTRY ExpFirmwareTableProviderListHead;
extern BOOLEAN ExpIsWinPEMode;
+extern ULONG ExpResourceTimeoutCount;
extern LIST_ENTRY ExpSystemResourcesList;
extern ULONG ExpAnsiCodePageDataOffset, ExpOemCodePageDataOffset;
extern ULONG ExpUnicodeCaseTableDataOffset;