Author: fireball
Date: Sat Jun 9 17:10:02 2007
New Revision: 27086
URL: http://svn.reactos.org/svn/reactos?rev=27086&view=rev
Log:
- If the module failed to load (e.g. fixup couldn't be done), then don't include it in the list of loaded modules.
Modified:
trunk/reactos/boot/freeldr/freeldr/arch/i386/loader.c
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/loader.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/i386/loader.c (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/i386/loader.c Sat Jun 9 17:10:02 2007
@@ -655,7 +655,13 @@
if (ImageType == 1) FrLdrLoadImage("hal.dll", 10, FALSE);
/* Perform import fixups */
- LdrPEFixupImports(LoadBase, Name);
+ if (!NT_SUCCESS(LdrPEFixupImports(LoadBase, Name)))
+ {
+ /* Fixup failed, just don't include it in the list */
+ // NextModuleBase = OldNextModuleBase;
+ LoaderBlock.ModsCount = ImageId;
+ return NULL;
+ }
/* Return the final mapped address */
return LoadBase;
Author: fireball
Date: Sat Jun 9 14:03:33 2007
New Revision: 27083
URL: http://svn.reactos.org/svn/reactos?rev=27083&view=rev
Log:
- Don't load a module with the same name more than once.
Modified:
trunk/reactos/boot/freeldr/freeldr/arch/i386/loader.c
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/loader.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/i386/loader.c (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/i386/loader.c Sat Jun 9 14:03:33 2007
@@ -596,6 +596,14 @@
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);