- 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.

svn path=/trunk/; revision=42473
This commit is contained in:
Michael Martin 2009-08-07 18:27:31 +00:00
parent 90ae79bfc0
commit 8b8078a0da

View file

@ -1776,6 +1776,16 @@ IopLoadUnloadDriver(PLOAD_UNLOAD_PARAMS LoadParams)
/* 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);