Author: fireball
Date: Wed Oct 17 14:01:03 2007
New Revision: 29636
URL: http://svn.reactos.org/svn/reactos?rev=29636&view=rev
Log:
- LdrpAttachToProcess() should be called only once per process, so added the check. This fixes a crash when trying to start any app using MFC42.DLL, including 1C.
See issue #2730 for more details.
Modified:
trunk/reactos/dll/ntdll/ldr/utils.c
Modified: trunk/reactos/dll/ntdll/ldr/utils.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/ntdll/ldr/utils.c?rev=…
==============================================================================
--- trunk/reactos/dll/ntdll/ldr/utils.c (original)
+++ trunk/reactos/dll/ntdll/ldr/utils.c Wed Oct 17 14:01:03 2007
@@ -748,9 +748,12 @@
if (NT_SUCCESS(Status) &&
(!LoadFlags || 0 == (*LoadFlags & LOAD_LIBRARY_AS_DATAFILE)))
{
- RtlEnterCriticalSection(Peb->LoaderLock);
- Status = LdrpAttachProcess();
- RtlLeaveCriticalSection(Peb->LoaderLock);
+ if (!(Module->Flags & LDRP_PROCESS_ATTACH_CALLED))
+ {
+ RtlEnterCriticalSection(Peb->LoaderLock);
+ Status = LdrpAttachProcess();
+ RtlLeaveCriticalSection(Peb->LoaderLock);
+ }
}
if ((!Module) && (NT_SUCCESS(Status)))