From 8ef4afc835385d65f89629c132a2f8aba3041ed7 Mon Sep 17 00:00:00 2001 From: Aleksey Bragin Date: Sat, 9 Jun 2007 10:03:33 +0000 Subject: [PATCH] - Don't load a module with the same name more than once. svn path=/trunk/; revision=27083 --- reactos/boot/freeldr/freeldr/arch/i386/loader.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/reactos/boot/freeldr/freeldr/arch/i386/loader.c b/reactos/boot/freeldr/freeldr/arch/i386/loader.c index 9fd6a57487d..b2a43d39b99 100644 --- a/reactos/boot/freeldr/freeldr/arch/i386/loader.c +++ b/reactos/boot/freeldr/freeldr/arch/i386/loader.c @@ -596,6 +596,14 @@ FrLdrMapImage(IN FILE *Image, ULONG ImageSize; NTSTATUS Status = STATUS_SUCCESS; + /* Try to see, maybe it's loaded already */ + if (LdrGetModuleObject(Name) != NULL) + { + /* It's loaded, return NULL. It would be wise to return + correct LoadBase, but it seems to be ignored almost everywhere */ + return NULL; + } + /* Set the virtual (image) and physical (load) addresses */ LoadBase = (PVOID)NextModuleBase; ImageBase = RVA(LoadBase , -KERNEL_BASE_PHYS + KSEG0_BASE);