From db0466d5e325cce042c60669b196f2cc1178305d Mon Sep 17 00:00:00 2001 From: Aleksey Bragin Date: Wed, 17 Oct 2007 10:01:03 +0000 Subject: [PATCH] - 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. svn path=/trunk/; revision=29636 --- reactos/dll/ntdll/ldr/utils.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/reactos/dll/ntdll/ldr/utils.c b/reactos/dll/ntdll/ldr/utils.c index 2eda7ad6ff7..e4ab1a67df5 100644 --- a/reactos/dll/ntdll/ldr/utils.c +++ b/reactos/dll/ntdll/ldr/utils.c @@ -748,9 +748,12 @@ LdrLoadDll (IN PWSTR SearchPath OPTIONAL, 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)))