From a3bc4d9c07c7be94072375a89725d41ecc7893fd Mon Sep 17 00:00:00 2001 From: Hartmut Birr Date: Mon, 8 Aug 2005 01:47:52 +0000 Subject: [PATCH] Fixed the load count in LdrpDetachProcess. That made it again possible to call the dll entry with DLL_PROCESS_DETACH. svn path=/trunk/; revision=17193 --- reactos/lib/ntdll/ldr/utils.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reactos/lib/ntdll/ldr/utils.c b/reactos/lib/ntdll/ldr/utils.c index 178f25ef4c4..dce31704212 100644 --- a/reactos/lib/ntdll/ldr/utils.c +++ b/reactos/lib/ntdll/ldr/utils.c @@ -104,7 +104,7 @@ static __inline LONG LdrpDecrementLoadCount(PLDR_DATA_TABLE_ENTRY Module, BOOLEA RtlEnterCriticalSection (NtCurrentPeb()->LoaderLock); } LoadCount = Module->LoadCount; - if (Module->LoadCount > 0) + if (Module->LoadCount > 0 && Module->LoadCount != 0xFFFF) { Module->LoadCount--; } @@ -2397,7 +2397,7 @@ LdrpDetachProcess(BOOLEAN UnloadAll) while (Entry != ModuleListHead) { Module = CONTAINING_RECORD(Entry, LDR_DATA_TABLE_ENTRY, InInitializationOrderModuleList); - if (((UnloadAll && Module->LoadCount <= 0) || Module->LoadCount == 0) && + if (((UnloadAll && Module->LoadCount == 0xFFFF) || Module->LoadCount == 0) && Module->Flags & LDRP_ENTRY_PROCESSED && !(Module->Flags & LDRP_UNLOAD_IN_PROGRESS)) {