Author: fireball Date: Mon Aug 10 16:03:01 2009 New Revision: 42592
URL: http://svn.reactos.org/svn/reactos?rev=42592&view=rev Log: - 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.
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] Mon Aug 10 16:03:01 2009 @@ -1775,20 +1775,24 @@
/* 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); }