diff --git a/ntoskrnl/io/pnpmgr/devaction.c b/ntoskrnl/io/pnpmgr/devaction.c index 18a435f3a38..e9caa760bb5 100644 --- a/ntoskrnl/io/pnpmgr/devaction.c +++ b/ntoskrnl/io/pnpmgr/devaction.c @@ -1635,6 +1635,10 @@ PiIrpSendRemoveCheckVpb( return IopSynchronousCall(targetDevice, &stack, &info); } +NTSTATUS +IopUpdateResourceMapForPnPDevice( + IN PDEVICE_NODE DeviceNode); + static VOID NTAPI @@ -1647,6 +1651,12 @@ IopSendRemoveDevice(IN PDEVICE_OBJECT DeviceObject) /* Drivers should never fail a IRP_MN_REMOVE_DEVICE request */ PiIrpSendRemoveCheckVpb(DeviceObject, IRP_MN_REMOVE_DEVICE); + /* Start of HACK: update resources stored in registry, so IopDetectResourceConflict works */ + DeviceNode->ResourceList->Count = 0; + DeviceNode->ResourceListTranslated->Count = 0; + IopUpdateResourceMapForPnPDevice(DeviceNode); + /* End of HACK */ + PiSetDevNodeState(DeviceNode, DeviceNodeRemoved); PiNotifyTargetDeviceChange(&GUID_TARGET_DEVICE_REMOVE_COMPLETE, DeviceObject, NULL); LONG_PTR refCount = ObDereferenceObject(DeviceObject);