Author: arty Date: Tue Nov 20 13:22:52 2007 New Revision: 30591
URL: http://svn.reactos.org/svn/reactos?rev=30591&view=rev Log: We need to separate the idea of 'fully initialized' from 'ldr data structures are present' so we can deal with early thread creation. This fixes cygwin.
Modified: trunk/reactos/dll/ntdll/ldr/startup.c
Modified: trunk/reactos/dll/ntdll/ldr/startup.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/ntdll/ldr/startup.c?rev... ============================================================================== --- trunk/reactos/dll/ntdll/ldr/startup.c (original) +++ trunk/reactos/dll/ntdll/ldr/startup.c Tue Nov 20 13:22:52 2007 @@ -249,7 +249,7 @@ PEPFUNC EntryPoint; PIMAGE_DOS_HEADER PEDosHeader; PVOID ImageBase; - PPEB Peb; + PPEB Peb = NtCurrentPeb(); PLDR_DATA_TABLE_ENTRY NtModule; // ntdll NLSTABLEINFO NlsTable; WCHAR FullNtDllPath[MAX_PATH]; @@ -257,12 +257,12 @@ NTSTATUS Status;
DPRINT("LdrpInit()\n"); - if (NtCurrentPeb()->Ldr == NULL || NtCurrentPeb()->Ldr->Initialized == FALSE) + DPRINT("Peb %p\n", Peb); + ImageBase = Peb->ImageBaseAddress; + DPRINT("ImageBase %p\n", ImageBase); + + if (NtCurrentPeb()->Ldr == NULL) { - Peb = NtCurrentPeb(); - DPRINT("Peb %p\n", Peb); - ImageBase = Peb->ImageBaseAddress; - DPRINT("ImageBase %p\n", ImageBase); if (ImageBase <= (PVOID)0x1000) { DPRINT("ImageBase is null\n"); @@ -419,7 +419,10 @@ 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, 0,