mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 14:43:02 +00:00
[NTDLL:LDR] Fix process LoadConfig CS timeout conversion from ms to 100ns units (#4089)
For more details, see https://forums.codeguru.com/showthread.php?370731-EnterCriticalSection-locking&p=1302399#post1302399
This commit is contained in:
parent
b5c75ce506
commit
6f89a48349
1 changed files with 4 additions and 6 deletions
|
@ -1839,7 +1839,7 @@ LdrpInitializeProcess(IN PCONTEXT Context,
|
||||||
/* ReactOS specific: do not clear it. (Windows starts doing the same in later versions) */
|
/* ReactOS specific: do not clear it. (Windows starts doing the same in later versions) */
|
||||||
//Peb->pShimData = NULL;
|
//Peb->pShimData = NULL;
|
||||||
|
|
||||||
/* Save the number of processors and CS Timeout */
|
/* Save the number of processors and CS timeout */
|
||||||
LdrpNumberOfProcessors = Peb->NumberOfProcessors;
|
LdrpNumberOfProcessors = Peb->NumberOfProcessors;
|
||||||
RtlpTimeout = Peb->CriticalSectionTimeout;
|
RtlpTimeout = Peb->CriticalSectionTimeout;
|
||||||
|
|
||||||
|
@ -1894,8 +1894,9 @@ LdrpInitializeProcess(IN PCONTEXT Context,
|
||||||
if (VALID_CONFIG_FIELD(GlobalFlagsClear) && LoadConfig->GlobalFlagsClear)
|
if (VALID_CONFIG_FIELD(GlobalFlagsClear) && LoadConfig->GlobalFlagsClear)
|
||||||
Peb->NtGlobalFlag &= ~LoadConfig->GlobalFlagsClear;
|
Peb->NtGlobalFlag &= ~LoadConfig->GlobalFlagsClear;
|
||||||
|
|
||||||
|
/* Convert the default CS timeout from milliseconds to 100ns units */
|
||||||
if (VALID_CONFIG_FIELD(CriticalSectionDefaultTimeout) && LoadConfig->CriticalSectionDefaultTimeout)
|
if (VALID_CONFIG_FIELD(CriticalSectionDefaultTimeout) && LoadConfig->CriticalSectionDefaultTimeout)
|
||||||
RtlpTimeout.QuadPart = Int32x32To64(LoadConfig->CriticalSectionDefaultTimeout, -10000000);
|
RtlpTimeout.QuadPart = Int32x32To64(LoadConfig->CriticalSectionDefaultTimeout, -10000);
|
||||||
|
|
||||||
if (VALID_CONFIG_FIELD(DeCommitFreeBlockThreshold) && LoadConfig->DeCommitFreeBlockThreshold)
|
if (VALID_CONFIG_FIELD(DeCommitFreeBlockThreshold) && LoadConfig->DeCommitFreeBlockThreshold)
|
||||||
HeapParameters.DeCommitFreeBlockThreshold = LoadConfig->DeCommitFreeBlockThreshold;
|
HeapParameters.DeCommitFreeBlockThreshold = LoadConfig->DeCommitFreeBlockThreshold;
|
||||||
|
@ -1935,12 +1936,9 @@ LdrpInitializeProcess(IN PCONTEXT Context,
|
||||||
&CommandLine);
|
&CommandLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the timeout is too long */
|
/* If the CS timeout is longer than 1 hour, disable it */
|
||||||
if (RtlpTimeout.QuadPart < Int32x32To64(3600, -10000000))
|
if (RtlpTimeout.QuadPart < Int32x32To64(3600, -10000000))
|
||||||
{
|
|
||||||
/* Then disable CS Timeout */
|
|
||||||
RtlpTimeoutDisable = TRUE;
|
RtlpTimeoutDisable = TRUE;
|
||||||
}
|
|
||||||
|
|
||||||
/* Initialize Critical Section Data */
|
/* Initialize Critical Section Data */
|
||||||
RtlpInitDeferredCriticalSection();
|
RtlpInitDeferredCriticalSection();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue