From 76daa6b70cf9e34e187736ecb08ebeedb5922dfb Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Thu, 11 Feb 2021 18:56:47 -0600 Subject: [PATCH] hidclass.sys: Do not manually clean up devices on unload. We can rely on ntoskrnl to do this for us. Signed-off-by: Zebediah Figura Signed-off-by: Alexandre Julliard --- dlls/hidclass.sys/hid.h | 1 - dlls/hidclass.sys/main.c | 6 ------ dlls/hidclass.sys/pnp.c | 4 ++-- 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/dlls/hidclass.sys/hid.h b/dlls/hidclass.sys/hid.h index 36d13c009d7..8ffd489a0ee 100644 --- a/dlls/hidclass.sys/hid.h +++ b/dlls/hidclass.sys/hid.h @@ -109,7 +109,6 @@ NTSTATUS WINAPI HID_PNP_Dispatch(DEVICE_OBJECT *device, IRP *irp) DECLSPEC_HIDDE /* Pseudo-Plug and Play support*/ NTSTATUS WINAPI PNP_AddDevice(DRIVER_OBJECT *driver, DEVICE_OBJECT* PDO) DECLSPEC_HIDDEN; -NTSTATUS PNP_RemoveDevice(minidriver *minidriver, DEVICE_OBJECT* device, IRP* irp) DECLSPEC_HIDDEN; /* Parsing HID Report Descriptors into preparsed data */ WINE_HIDP_PREPARSED_DATA* ParseDescriptor(BYTE *descriptor, unsigned int length) DECLSPEC_HIDDEN; diff --git a/dlls/hidclass.sys/main.c b/dlls/hidclass.sys/main.c index e169c429efb..cef58217f5e 100644 --- a/dlls/hidclass.sys/main.c +++ b/dlls/hidclass.sys/main.c @@ -48,12 +48,6 @@ static VOID WINAPI UnloadDriver(DRIVER_OBJECT *driver) md = find_minidriver(driver); if (md) { - hid_device *device, *next; - TRACE("%i devices to unload\n", list_count(&md->device_list)); - LIST_FOR_EACH_ENTRY_SAFE(device, next, &md->device_list, hid_device, entry) - { - PNP_RemoveDevice(md, device->device, NULL); - } if (md->DriverUnload) md->DriverUnload(md->minidriver.DriverObject); list_remove(&md->entry); diff --git a/dlls/hidclass.sys/pnp.c b/dlls/hidclass.sys/pnp.c index 27de1e1b04b..13b07e4e379 100644 --- a/dlls/hidclass.sys/pnp.c +++ b/dlls/hidclass.sys/pnp.c @@ -205,7 +205,7 @@ NTSTATUS WINAPI PNP_AddDevice(DRIVER_OBJECT *driver, DEVICE_OBJECT *PDO) return STATUS_SUCCESS; } -NTSTATUS PNP_RemoveDevice(minidriver *minidriver, DEVICE_OBJECT *device, IRP *irp) +static NTSTATUS remove_device(minidriver *minidriver, DEVICE_OBJECT *device, IRP *irp) { BASE_DEVICE_EXTENSION *ext = device->DeviceExtension; hid_device *hiddev; @@ -306,7 +306,7 @@ NTSTATUS WINAPI HID_PNP_Dispatch(DEVICE_OBJECT *device, IRP *irp) } case IRP_MN_REMOVE_DEVICE: { - return PNP_RemoveDevice(minidriver, device, irp); + return remove_device(minidriver, device, irp); } default: {