[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#ResourceTimeoutCount_REG_DWORD
This commit is contained in:
Hermès Bélusca-Maïto 2021-11-07 01:17:32 +01:00
parent 56417bfb93
commit 4bdfee8e8b
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
3 changed files with 12 additions and 6 deletions

View file

@ -561,7 +561,7 @@ DATA_SEG("INITDATA") CM_SYSTEM_CONTROL_VECTOR CmControlVector[] =
{ {
L"Session Manager", L"Session Manager",
L"ResourceTimeoutCount", L"ResourceTimeoutCount",
&DummyData, &ExpResourceTimeoutCount,
NULL, NULL,
NULL NULL
}, },

View file

@ -18,7 +18,7 @@
#define IsOwnedExclusive(r) (r->Flag & ResourceOwnedExclusive) #define IsOwnedExclusive(r) (r->Flag & ResourceOwnedExclusive)
#define IsBoostAllowed(r) (!(r->Flag & ResourceHasDisabledPriorityBoost)) #define IsBoostAllowed(r) (!(r->Flag & ResourceHasDisabledPriorityBoost))
#if (!(defined(CONFIG_SMP)) && !(DBG)) #if !defined(CONFIG_SMP) && !DBG
FORCEINLINE FORCEINLINE
VOID VOID
@ -65,13 +65,17 @@ ExReleaseResourceLock(IN PERESOURCE Resource,
/* Release the lock */ /* Release the lock */
KeReleaseInStackQueuedSpinLock(LockHandle); KeReleaseInStackQueuedSpinLock(LockHandle);
} }
#endif
#endif // !defined(CONFIG_SMP) && !DBG
/* DATA***********************************************************************/ /* DATA***********************************************************************/
LARGE_INTEGER ExShortTime = {{-100000, -1}}; LARGE_INTEGER ExShortTime = {{-100000, -1}};
LARGE_INTEGER ExpTimeout; 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; KSPIN_LOCK ExpResourceSpinLock;
LIST_ENTRY ExpSystemResourcesList; LIST_ENTRY ExpSystemResourcesList;
BOOLEAN ExResourceStrict = TRUE; BOOLEAN ExResourceStrict = TRUE;
@ -631,7 +635,7 @@ ExpWaitForResource(IN PERESOURCE Resource,
/* Increase contention count and use a 5 second timeout */ /* Increase contention count and use a 5 second timeout */
Resource->ContentionCount++; Resource->ContentionCount++;
Timeout.QuadPart = 500 * -10000; Timeout.QuadPart = 500 * -10000LL;
for (;;) for (;;)
{ {
/* Wait for ownership */ /* Wait for ownership */
@ -640,7 +644,8 @@ ExpWaitForResource(IN PERESOURCE Resource,
KernelMode, KernelMode,
FALSE, FALSE,
&Timeout); &Timeout);
if (Status != STATUS_TIMEOUT) break; if (Status != STATUS_TIMEOUT)
break;
/* Increase wait count */ /* Increase wait count */
WaitCount++; WaitCount++;

View file

@ -19,6 +19,7 @@ extern ERESOURCE ExpFirmwareTableResource;
extern ERESOURCE ExpTimeRefreshLock; extern ERESOURCE ExpTimeRefreshLock;
extern LIST_ENTRY ExpFirmwareTableProviderListHead; extern LIST_ENTRY ExpFirmwareTableProviderListHead;
extern BOOLEAN ExpIsWinPEMode; extern BOOLEAN ExpIsWinPEMode;
extern ULONG ExpResourceTimeoutCount;
extern LIST_ENTRY ExpSystemResourcesList; extern LIST_ENTRY ExpSystemResourcesList;
extern ULONG ExpAnsiCodePageDataOffset, ExpOemCodePageDataOffset; extern ULONG ExpAnsiCodePageDataOffset, ExpOemCodePageDataOffset;
extern ULONG ExpUnicodeCaseTableDataOffset; extern ULONG ExpUnicodeCaseTableDataOffset;