From 8dacbd3ab0d1ccef69d0b5fc3a22cdf4523ffd67 Mon Sep 17 00:00:00 2001 From: Phillip Susi Date: Mon, 2 Jul 2001 20:27:41 +0000 Subject: [PATCH] Fixed LdrShutdownProcess() to only detach static dlls, any dynamically loaded ones should be FreeLibrary()d from the static dlls and then they will be detached svn path=/trunk/; revision=2026 --- reactos/lib/ntdll/ldr/utils.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/reactos/lib/ntdll/ldr/utils.c b/reactos/lib/ntdll/ldr/utils.c index 8e256b15c75..2abe85f33dc 100644 --- a/reactos/lib/ntdll/ldr/utils.c +++ b/reactos/lib/ntdll/ldr/utils.c @@ -1,4 +1,4 @@ -/* $Id: utils.c,v 1.44 2001/06/04 11:26:10 chorns Exp $ +/* $Id: utils.c,v 1.45 2001/07/02 20:27:41 phreak Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -1590,10 +1590,12 @@ LdrShutdownProcess (VOID) { Module = CONTAINING_RECORD(Entry, LDR_MODULE, InInitializationOrderModuleList); - DPRINT(" Unloading %wZ\n", + DPRINT(" Unloading %S\n", &Module->BaseDllName); - - if (Module->EntryPoint != 0) + // PJS: only detach from static dlls, they should FreeLibrary() any dlls that + // they loaded dynamically, and when the last reference is gone, that lib will + // be detached. + if (Module->EntryPoint != 0 && Module->LoadCount == -1) { PDLLMAIN_FUNC Entrypoint = (PDLLMAIN_FUNC)Module->EntryPoint;