Skip to content

Commit e1776e9

Browse files
committed
[NTOSKRNL]
- Handle NULL device relations better svn path=/trunk/; revision=53292
1 parent 1434574 commit e1776e9

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

reactos/ntoskrnl/io/pnpmgr/pnpmgr.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1773,7 +1773,7 @@ IopHandleDeviceRemoval(
17731773
NextChild = Child->Sibling;
17741774
Found = FALSE;
17751775

1776-
for (i = 0; i < DeviceRelations->Count; i++)
1776+
for (i = 0; DeviceRelations && i < DeviceRelations->Count; i++)
17771777
{
17781778
if (IopGetDeviceNode(DeviceRelations->Objects[i]) == Child)
17791779
{
@@ -1839,18 +1839,21 @@ IopEnumerateDevice(
18391839

18401840
DeviceRelations = (PDEVICE_RELATIONS)IoStatusBlock.Information;
18411841

1842+
/*
1843+
* Send removal IRPs for devices that have disappeared
1844+
* NOTE: This code handles the case where no relations are specified
1845+
*/
1846+
IopHandleDeviceRemoval(DeviceNode, DeviceRelations);
1847+
1848+
/* Now we bail if nothing was returned */
18421849
if (!DeviceRelations)
18431850
{
1851+
/* We're all done */
18441852
DPRINT("No PDOs\n");
1845-
return STATUS_UNSUCCESSFUL;
1853+
return STATUS_SUCCESS;
18461854
}
18471855

18481856
DPRINT("Got %u PDOs\n", DeviceRelations->Count);
1849-
1850-
/*
1851-
* Send removal IRPs for devices that have disappeared
1852-
*/
1853-
IopHandleDeviceRemoval(DeviceNode, DeviceRelations);
18541857

18551858
/*
18561859
* Create device nodes for all discovered devices

0 commit comments

Comments
 (0)