Author: cgutman
Date: Thu Aug 18 00:33:19 2011
New Revision: 53292
URL:
http://svn.reactos.org/svn/reactos?rev=53292&view=rev
Log:
[NTOSKRNL]
- Handle NULL device relations better
Modified:
trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c
Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.…
==============================================================================
--- trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c [iso-8859-1] Thu Aug 18 00:33:19 2011
@@ -1773,7 +1773,7 @@
NextChild = Child->Sibling;
Found = FALSE;
- for (i = 0; i < DeviceRelations->Count; i++)
+ for (i = 0; DeviceRelations && i < DeviceRelations->Count; i++)
{
if (IopGetDeviceNode(DeviceRelations->Objects[i]) == Child)
{
@@ -1839,18 +1839,21 @@
DeviceRelations = (PDEVICE_RELATIONS)IoStatusBlock.Information;
- if (!DeviceRelations)
- {
- DPRINT("No PDOs\n");
- return STATUS_UNSUCCESSFUL;
- }
-
- DPRINT("Got %u PDOs\n", DeviceRelations->Count);
-
/*
* Send removal IRPs for devices that have disappeared
+ * NOTE: This code handles the case where no relations are specified
*/
IopHandleDeviceRemoval(DeviceNode, DeviceRelations);
+
+ /* Now we bail if nothing was returned */
+ if (!DeviceRelations)
+ {
+ /* We're all done */
+ DPRINT("No PDOs\n");
+ return STATUS_SUCCESS;
+ }
+
+ DPRINT("Got %u PDOs\n", DeviceRelations->Count);
/*
* Create device nodes for all discovered devices