mirror of
https://github.com/reactos/reactos.git
synced 2025-07-31 06:21:42 +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 */
|
/* Check if there's a TLD DLL being loaded */
|
||||||
OldTldDll = LdrpTopLevelDllBeingLoaded;
|
OldTldDll = LdrpTopLevelDllBeingLoaded;
|
||||||
|
_SEH2_TRY
|
||||||
|
{
|
||||||
|
|
||||||
if (OldTldDll)
|
if (OldTldDll)
|
||||||
{
|
{
|
||||||
/* This is a recursive load, do something about it? */
|
/* This is a recursive load, do something about it? */
|
||||||
|
@ -414,12 +417,16 @@ LdrLoadDll(IN PWSTR SearchPath OPTIONAL,
|
||||||
DllName,
|
DllName,
|
||||||
Status);
|
Status);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
_SEH2_FINALLY
|
||||||
|
{
|
||||||
/* Restore the old TLD DLL */
|
/* Restore the old TLD DLL */
|
||||||
LdrpTopLevelDllBeingLoaded = OldTldDll;
|
LdrpTopLevelDllBeingLoaded = OldTldDll;
|
||||||
|
|
||||||
/* Release the lock */
|
/* Release the lock */
|
||||||
LdrUnlockLoaderLock(LDR_LOCK_LOADER_LOCK_FLAG_RAISE_ON_ERRORS, Cookie);
|
LdrUnlockLoaderLock(LDR_LOCK_LOADER_LOCK_FLAG_RAISE_ON_ERRORS, Cookie);
|
||||||
|
}
|
||||||
|
_SEH2_END;
|
||||||
|
|
||||||
/* Do we have a redirect string? */
|
/* Do we have a redirect string? */
|
||||||
if (DllString2.Buffer) RtlFreeUnicodeString(&DllString2);
|
if (DllString2.Buffer) RtlFreeUnicodeString(&DllString2);
|
||||||
|
|
|
@ -2488,6 +2488,8 @@ LdrpLoadDll(IN BOOLEAN Redirected,
|
||||||
/* Check for init flag and acquire lock */
|
/* Check for init flag and acquire lock */
|
||||||
if (!InInit) RtlEnterCriticalSection(&LdrpLoaderLock);
|
if (!InInit) RtlEnterCriticalSection(&LdrpLoaderLock);
|
||||||
|
|
||||||
|
_SEH2_TRY
|
||||||
|
{
|
||||||
/* Show debug message */
|
/* Show debug message */
|
||||||
if (ShowSnaps)
|
if (ShowSnaps)
|
||||||
{
|
{
|
||||||
|
@ -2511,7 +2513,8 @@ LdrpLoadDll(IN BOOLEAN Redirected,
|
||||||
FALSE,
|
FALSE,
|
||||||
Redirected,
|
Redirected,
|
||||||
&LdrEntry);
|
&LdrEntry);
|
||||||
if (!NT_SUCCESS(Status)) goto Quickie;
|
if (!NT_SUCCESS(Status))
|
||||||
|
_SEH2_LEAVE;
|
||||||
|
|
||||||
/* FIXME: Need to mark the DLL range for the stack DB */
|
/* FIXME: Need to mark the DLL range for the stack DB */
|
||||||
//RtlpStkMarkDllRange(LdrEntry);
|
//RtlpStkMarkDllRange(LdrEntry);
|
||||||
|
@ -2561,7 +2564,7 @@ LdrpLoadDll(IN BOOLEAN Redirected,
|
||||||
LdrUnloadDll(LdrEntry->DllBase);
|
LdrUnloadDll(LdrEntry->DllBase);
|
||||||
|
|
||||||
/* Return the error */
|
/* Return the error */
|
||||||
goto Quickie;
|
_SEH2_LEAVE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (LdrEntry->LoadCount != 0xFFFF)
|
else if (LdrEntry->LoadCount != 0xFFFF)
|
||||||
|
@ -2625,9 +2628,13 @@ LdrpLoadDll(IN BOOLEAN Redirected,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Quickie:
|
}
|
||||||
|
_SEH2_FINALLY
|
||||||
|
{
|
||||||
/* Release the lock */
|
/* Release the lock */
|
||||||
if (!InInit) RtlLeaveCriticalSection(&LdrpLoaderLock);
|
if (!InInit) RtlLeaveCriticalSection(&LdrpLoaderLock);
|
||||||
|
}
|
||||||
|
_SEH2_END;
|
||||||
|
|
||||||
/* Check for success */
|
/* Check for success */
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue