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
This commit is contained in:
Hartmut Birr 2005-08-08 01:47:52 +00:00
parent e41e25c1e1
commit a3bc4d9c07

View file

@ -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))
{