mirror of
https://github.com/reactos/reactos.git
synced 2025-06-06 01:40:36 +00:00
[LDR] Guard some sections where we grab a lock.
CORE-14532
This commit is contained in:
parent
86fe412d5c
commit
ad08c6631b
2 changed files with 194 additions and 180 deletions
|
@ -353,6 +353,9 @@ LdrLoadDll(IN PWSTR SearchPath OPTIONAL,
|
|||
|
||||
/* Check if there's a TLD DLL being loaded */
|
||||
OldTldDll = LdrpTopLevelDllBeingLoaded;
|
||||
_SEH2_TRY
|
||||
{
|
||||
|
||||
if (OldTldDll)
|
||||
{
|
||||
/* This is a recursive load, do something about it? */
|
||||
|
@ -414,12 +417,16 @@ LdrLoadDll(IN PWSTR SearchPath OPTIONAL,
|
|||
DllName,
|
||||
Status);
|
||||
}
|
||||
|
||||
}
|
||||
_SEH2_FINALLY
|
||||
{
|
||||
/* Restore the old TLD DLL */
|
||||
LdrpTopLevelDllBeingLoaded = OldTldDll;
|
||||
|
||||
/* Release the lock */
|
||||
LdrUnlockLoaderLock(LDR_LOCK_LOADER_LOCK_FLAG_RAISE_ON_ERRORS, Cookie);
|
||||
}
|
||||
_SEH2_END;
|
||||
|
||||
/* Do we have a redirect string? */
|
||||
if (DllString2.Buffer) RtlFreeUnicodeString(&DllString2);
|
||||
|
|
|
@ -2488,6 +2488,8 @@ LdrpLoadDll(IN BOOLEAN Redirected,
|
|||
/* Check for init flag and acquire lock */
|
||||
if (!InInit) RtlEnterCriticalSection(&LdrpLoaderLock);
|
||||
|
||||
_SEH2_TRY
|
||||
{
|
||||
/* Show debug message */
|
||||
if (ShowSnaps)
|
||||
{
|
||||
|
@ -2511,7 +2513,8 @@ LdrpLoadDll(IN BOOLEAN Redirected,
|
|||
FALSE,
|
||||
Redirected,
|
||||
&LdrEntry);
|
||||
if (!NT_SUCCESS(Status)) goto Quickie;
|
||||
if (!NT_SUCCESS(Status))
|
||||
_SEH2_LEAVE;
|
||||
|
||||
/* FIXME: Need to mark the DLL range for the stack DB */
|
||||
//RtlpStkMarkDllRange(LdrEntry);
|
||||
|
@ -2561,7 +2564,7 @@ LdrpLoadDll(IN BOOLEAN Redirected,
|
|||
LdrUnloadDll(LdrEntry->DllBase);
|
||||
|
||||
/* Return the error */
|
||||
goto Quickie;
|
||||
_SEH2_LEAVE;
|
||||
}
|
||||
}
|
||||
else if (LdrEntry->LoadCount != 0xFFFF)
|
||||
|
@ -2625,9 +2628,13 @@ LdrpLoadDll(IN BOOLEAN Redirected,
|
|||
}
|
||||
}
|
||||
|
||||
Quickie:
|
||||
}
|
||||
_SEH2_FINALLY
|
||||
{
|
||||
/* Release the lock */
|
||||
if (!InInit) RtlLeaveCriticalSection(&LdrpLoaderLock);
|
||||
}
|
||||
_SEH2_END;
|
||||
|
||||
/* Check for success */
|
||||
if (NT_SUCCESS(Status))
|
||||
|
|
Loading…
Reference in a new issue