mirror of
https://github.com/reactos/reactos.git
synced 2025-04-25 16:10:29 +00:00
parent
97d06533f8
commit
5ee921c371
1 changed files with 32 additions and 10 deletions
|
@ -27,6 +27,8 @@ static RTL_CRITICAL_SECTION PebLock;
|
|||
static RTL_CRITICAL_SECTION LoaderLock;
|
||||
static RTL_BITMAP TlsBitMap;
|
||||
static RTL_BITMAP TlsExpansionBitMap;
|
||||
static volatile BOOLEAN LdrpInitialized = FALSE;
|
||||
static LONG LdrpInitLock = 0;
|
||||
|
||||
#define VALUE_BUFFER_SIZE 256
|
||||
|
||||
|
@ -250,9 +252,9 @@ finish:
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
static
|
||||
VOID
|
||||
NTAPI
|
||||
LdrpInit(PCONTEXT Context,
|
||||
LdrpInit2(PCONTEXT Context,
|
||||
PVOID SystemArgument1,
|
||||
PVOID SystemArgument2)
|
||||
{
|
||||
|
@ -273,8 +275,6 @@ LdrpInit(PCONTEXT Context,
|
|||
ImageBase = Peb->ImageBaseAddress;
|
||||
DPRINT("ImageBase %p\n", ImageBase);
|
||||
|
||||
if (NtCurrentPeb()->Ldr == NULL)
|
||||
{
|
||||
if (ImageBase <= (PVOID) 0x1000)
|
||||
{
|
||||
DPRINT("ImageBase is null\n");
|
||||
|
@ -432,10 +432,7 @@ LdrpInit(PCONTEXT Context,
|
|||
LdrpLoadUserModuleSymbols(NtModule);
|
||||
|
||||
#endif /* DBG || KDBG */
|
||||
}
|
||||
|
||||
if (NtCurrentPeb()->Ldr->Initialized == FALSE)
|
||||
{
|
||||
/* add entry for executable (becomes first list entry) */
|
||||
ExeModule = (PLDR_DATA_TABLE_ENTRY)
|
||||
RtlAllocateHeap(Peb->ProcessHeap,
|
||||
|
@ -500,6 +497,31 @@ LdrpInit(PCONTEXT Context,
|
|||
/* Break into debugger */
|
||||
if (Peb->BeingDebugged)
|
||||
DbgBreakPoint();
|
||||
}
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
LdrpInit(PCONTEXT Context,
|
||||
PVOID SystemArgument1,
|
||||
PVOID SystemArgument2)
|
||||
{
|
||||
if (!LdrpInitialized)
|
||||
{
|
||||
if (!_InterlockedExchange(&LdrpInitLock, 1))
|
||||
{
|
||||
LdrpInit2(Context, SystemArgument1, SystemArgument2);
|
||||
LdrpInitialized = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
LARGE_INTEGER Interval = {{-200000, -1}};
|
||||
|
||||
do
|
||||
{
|
||||
NtDelayExecution(FALSE, &Interval);
|
||||
}
|
||||
while (!LdrpInitialized);
|
||||
}
|
||||
}
|
||||
|
||||
/* attach the thread */
|
||||
|
|
Loading…
Reference in a new issue