mirror of
https://github.com/reactos/reactos.git
synced 2026-05-30 23:33:24 +08:00
[NTOS:PNP] HACK: release resources when device is removed
CORE-17789
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user