Commit 81cda52d authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

ntoskrnl.exe: BusRelations is also used when devices are removed.

parent ca683dca
...@@ -435,6 +435,21 @@ static void handle_bus_relations( DEVICE_OBJECT *parent ) ...@@ -435,6 +435,21 @@ static void handle_bus_relations( DEVICE_OBJECT *parent )
} }
} }
if (wine_parent->children)
{
for (i = 0; i < wine_parent->children->Count; ++i)
{
DEVICE_OBJECT *child = wine_parent->children->Objects[i];
if (!device_in_list( relations, child ))
{
TRACE("Removing device %p.\n", child);
remove_device( child );
}
ObDereferenceObject( child );
}
}
ExFreePool( wine_parent->children ); ExFreePool( wine_parent->children );
wine_parent->children = relations; wine_parent->children = relations;
...@@ -453,9 +468,6 @@ void WINAPI IoInvalidateDeviceRelations( DEVICE_OBJECT *device_object, DEVICE_RE ...@@ -453,9 +468,6 @@ void WINAPI IoInvalidateDeviceRelations( DEVICE_OBJECT *device_object, DEVICE_RE
case BusRelations: case BusRelations:
handle_bus_relations( device_object ); handle_bus_relations( device_object );
break; break;
case RemovalRelations:
remove_device( device_object );
break;
default: default:
FIXME("Unhandled relation %#x.\n", type); FIXME("Unhandled relation %#x.\n", type);
break; break;
......
...@@ -371,7 +371,7 @@ static void handle_RemovalCallback(void *context, IOReturn result, void *sender, ...@@ -371,7 +371,7 @@ static void handle_RemovalCallback(void *context, IOReturn result, void *sender,
device = bus_find_hid_device(&iohid_vtbl, IOHIDDevice); device = bus_find_hid_device(&iohid_vtbl, IOHIDDevice);
if (device) if (device)
{ {
IoInvalidateDeviceRelations(device, RemovalRelations); IoInvalidateDeviceRelations(bus_pdo, BusRelations);
bus_remove_hid_device(device); bus_remove_hid_device(device);
} }
} }
......
...@@ -902,7 +902,7 @@ static void try_remove_device(SDL_JoystickID id) ...@@ -902,7 +902,7 @@ static void try_remove_device(SDL_JoystickID id)
sdl_controller = private->sdl_controller; sdl_controller = private->sdl_controller;
sdl_haptic = private->sdl_haptic; sdl_haptic = private->sdl_haptic;
IoInvalidateDeviceRelations(device, RemovalRelations); IoInvalidateDeviceRelations(bus_pdo, BusRelations);
bus_remove_hid_device(device); bus_remove_hid_device(device);
......
...@@ -1297,7 +1297,7 @@ static void try_remove_device(struct udev_device *dev) ...@@ -1297,7 +1297,7 @@ static void try_remove_device(struct udev_device *dev)
#endif #endif
if (!device) return; if (!device) return;
IoInvalidateDeviceRelations(device, RemovalRelations); IoInvalidateDeviceRelations(bus_pdo, BusRelations);
private = impl_from_DEVICE_OBJECT(device); private = impl_from_DEVICE_OBJECT(device);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment