- Rewrite failure branch of IopLoadUnloadDriver to return a real status code instead of always hardcoding it to STATUS_IMAGE_ALREADY_LOADED (r42473) and remove unneeded code duplication.

svn path=/trunk/; revision=42592
This commit is contained in:
Aleksey Bragin 2009-08-10 14:03:01 +00:00
parent 158a642e6b
commit df38911464

View file

@ -1775,20 +1775,24 @@ IopLoadUnloadDriver(PLOAD_UNLOAD_PARAMS LoadParams)
/* Store its DriverSection, so that it could be unloaded */
DriverObject->DriverSection = ModuleObject;
/* Initialize and start device */
IopInitializeDevice(DeviceNode, DriverObject);
Status = IopStartDevice(DeviceNode);
}
else
{
DPRINT("DriverObject already exist in ObjectManager\n");
/* IopGetDriverObject references the DriverObject, so dereference it. */
/* IopGetDriverObject references the DriverObject, so dereference it */
ObDereferenceObject(DriverObject);
/* Free device node since driver loading failed */
IopFreeDeviceNode(DeviceNode);
LoadParams->Status = STATUS_IMAGE_ALREADY_LOADED;
(VOID)KeSetEvent(&LoadParams->Event, 0, FALSE);
return;
}
IopInitializeDevice(DeviceNode, DriverObject);
LoadParams->Status = IopStartDevice(DeviceNode);
/* Pass status to the caller and signal the event */
LoadParams->Status = Status;
(VOID)KeSetEvent(&LoadParams->Event, 0, FALSE);
}