Author: mjmartin
Date: Fri Aug 7 20:27:31 2009
New Revision: 42473
URL:
http://svn.reactos.org/svn/reactos?rev=42473&view=rev
Log:
- Calling NtLoadDriver on an already loaded driver should fail with
STATUS_IMAGE_ALREADY_LOADED. Fixes one test for kmtest driver tests and a bugcheck when
loading the driver a second time.
Modified:
trunk/reactos/ntoskrnl/io/iomgr/driver.c
Modified: trunk/reactos/ntoskrnl/io/iomgr/driver.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/driver.c…
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/driver.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/driver.c [iso-8859-1] Fri Aug 7 20:27:31 2009
@@ -1776,6 +1776,16 @@
/* Store its DriverSection, so that it could be unloaded */
DriverObject->DriverSection = ModuleObject;
}
+ else
+ {
+ DPRINT("DriverObject already exist in ObjectManager\n");
+ /* IopGetDriverObject references the DriverObject, so dereference it. */
+ ObDereferenceObject(DriverObject);
+ IopFreeDeviceNode(DeviceNode);
+ LoadParams->Status = STATUS_IMAGE_ALREADY_LOADED;
+ (VOID)KeSetEvent(&LoadParams->Event, 0, FALSE);
+ return;
+ }
IopInitializeDevice(DeviceNode, DriverObject);
LoadParams->Status = IopStartDevice(DeviceNode);