mirror of
https://github.com/reactos/reactos.git
synced 2025-01-05 22:12:46 +00:00
- 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:
parent
158a642e6b
commit
df38911464
1 changed files with 10 additions and 6 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue