Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/winebus.sys/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/dlls/winebus.sys/main.c b/dlls/winebus.sys/main.c index 2388033ceda..396a9d07123 100644 --- a/dlls/winebus.sys/main.c +++ b/dlls/winebus.sys/main.c @@ -600,16 +600,17 @@ static NTSTATUS pdo_pnp_dispatch(DEVICE_OBJECT *device, IRP *irp) case IRP_MN_QUERY_ID: TRACE("IRP_MN_QUERY_ID\n"); status = handle_IRP_MN_QUERY_ID(device, irp); - irp->IoStatus.u.Status = status; break; case IRP_MN_QUERY_CAPABILITIES: TRACE("IRP_MN_QUERY_CAPABILITIES\n"); + status = STATUS_SUCCESS; break; default: FIXME("Unhandled function %08x\n", irpsp->MinorFunction); break; }
+ irp->IoStatus.u.Status = status; IoCompleteRequest(irp, IO_NO_INCREMENT); return status; }
We can rely on ntoskrnl to do this for us.
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- 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: {
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/hidclass.sys/hid.h | 7 ------- dlls/hidclass.sys/main.c | 2 -- dlls/hidclass.sys/pnp.c | 27 +-------------------------- 3 files changed, 1 insertion(+), 35 deletions(-)
diff --git a/dlls/hidclass.sys/hid.h b/dlls/hidclass.sys/hid.h index 8ffd489a0ee..889b8c625c0 100644 --- a/dlls/hidclass.sys/hid.h +++ b/dlls/hidclass.sys/hid.h @@ -72,12 +72,6 @@ void RingBuffer_Destroy(struct ReportRingBuffer *buffer) DECLSPEC_HIDDEN; struct ReportRingBuffer* RingBuffer_Create(UINT buffer_size) DECLSPEC_HIDDEN; NTSTATUS RingBuffer_SetSize(struct ReportRingBuffer *buffer, UINT size) DECLSPEC_HIDDEN;
-typedef struct _hiddevice -{ - struct list entry; - DEVICE_OBJECT *device; -} hid_device; - typedef struct _minidriver { struct list entry; @@ -88,7 +82,6 @@ typedef struct _minidriver
PDRIVER_ADD_DEVICE AddDevice; PDRIVER_DISPATCH PNPDispatch; - struct list device_list; } minidriver;
NTSTATUS call_minidriver(ULONG code, DEVICE_OBJECT *device, void *in_buff, ULONG in_size, void *out_buff, ULONG out_size) DECLSPEC_HIDDEN; diff --git a/dlls/hidclass.sys/main.c b/dlls/hidclass.sys/main.c index cef58217f5e..50657b80f5e 100644 --- a/dlls/hidclass.sys/main.c +++ b/dlls/hidclass.sys/main.c @@ -81,8 +81,6 @@ NTSTATUS WINAPI HidRegisterMinidriver(HID_MINIDRIVER_REGISTRATION *registration) driver->minidriver = *registration; list_add_tail(&minidriver_list, &driver->entry);
- list_init(&driver->device_list); - return STATUS_SUCCESS; }
diff --git a/dlls/hidclass.sys/pnp.c b/dlls/hidclass.sys/pnp.c index 13b07e4e379..a50e7382466 100644 --- a/dlls/hidclass.sys/pnp.c +++ b/dlls/hidclass.sys/pnp.c @@ -72,7 +72,6 @@ static NTSTATUS get_device_id(DEVICE_OBJECT *device, BUS_QUERY_ID_TYPE type, WCH NTSTATUS WINAPI PNP_AddDevice(DRIVER_OBJECT *driver, DEVICE_OBJECT *PDO) { WCHAR device_id[MAX_DEVICE_ID_LEN], instance_id[MAX_DEVICE_ID_LEN]; - hid_device *hiddev; DEVICE_OBJECT *device = NULL; NTSTATUS status; minidriver *minidriver; @@ -97,18 +96,12 @@ NTSTATUS WINAPI PNP_AddDevice(DRIVER_OBJECT *driver, DEVICE_OBJECT *PDO) TRACE("Adding device to PDO %p, id %s\%s.\n", PDO, debugstr_w(device_id), debugstr_w(instance_id)); minidriver = find_minidriver(driver);
- hiddev = HeapAlloc(GetProcessHeap(), 0, sizeof(*hiddev)); - if (!hiddev) - return STATUS_NO_MEMORY; - - status = HID_CreateDevice(PDO, &minidriver->minidriver, &hiddev->device); + status = HID_CreateDevice(PDO, &minidriver->minidriver, &device); if (status != STATUS_SUCCESS) { ERR("Failed to create HID object (%x)\n",status); - HeapFree(GetProcessHeap(), 0, hiddev); return status; } - device = hiddev->device;
ext = device->DeviceExtension; InitializeListHead(&ext->irp_queue); @@ -120,7 +113,6 @@ NTSTATUS WINAPI PNP_AddDevice(DRIVER_OBJECT *driver, DEVICE_OBJECT *PDO) { ERR("Minidriver AddDevice failed (%x)\n",status); HID_DeleteDevice(device); - HeapFree(GetProcessHeap(), 0, hiddev); return status; }
@@ -131,7 +123,6 @@ NTSTATUS WINAPI PNP_AddDevice(DRIVER_OBJECT *driver, DEVICE_OBJECT *PDO) { ERR("Minidriver failed to get Attributes(%x)\n",status); HID_DeleteDevice(device); - HeapFree(GetProcessHeap(), 0, hiddev); return status; }
@@ -146,7 +137,6 @@ NTSTATUS WINAPI PNP_AddDevice(DRIVER_OBJECT *driver, DEVICE_OBJECT *PDO) { ERR("Cannot get Device Descriptor(%x)\n",status); HID_DeleteDevice(device); - HeapFree(GetProcessHeap(), 0, hiddev); return status; } for (i = 0; i < descriptor.bNumDescriptors; i++) @@ -157,7 +147,6 @@ NTSTATUS WINAPI PNP_AddDevice(DRIVER_OBJECT *driver, DEVICE_OBJECT *PDO) { ERR("No Report Descriptor found in reply\n"); HID_DeleteDevice(device); - HeapFree(GetProcessHeap(), 0, hiddev); return status; }
@@ -169,7 +158,6 @@ NTSTATUS WINAPI PNP_AddDevice(DRIVER_OBJECT *driver, DEVICE_OBJECT *PDO) ERR("Cannot get Report Descriptor(%x)\n",status); HID_DeleteDevice(device); HeapFree(GetProcessHeap(), 0, reportDescriptor); - HeapFree(GetProcessHeap(), 0, hiddev); return status; }
@@ -180,12 +168,9 @@ NTSTATUS WINAPI PNP_AddDevice(DRIVER_OBJECT *driver, DEVICE_OBJECT *PDO) { ERR("Cannot parse Report Descriptor\n"); HID_DeleteDevice(device); - HeapFree(GetProcessHeap(), 0, hiddev); return STATUS_NOT_SUPPORTED; }
- list_add_tail(&(minidriver->device_list), &hiddev->entry); - ext->information.DescriptorSize = ext->preparseData->dwSize;
lstrcpyW(ext->instance_id, instance_id); @@ -208,7 +193,6 @@ NTSTATUS WINAPI PNP_AddDevice(DRIVER_OBJECT *driver, DEVICE_OBJECT *PDO) static NTSTATUS remove_device(minidriver *minidriver, DEVICE_OBJECT *device, IRP *irp) { BASE_DEVICE_EXTENSION *ext = device->DeviceExtension; - hid_device *hiddev; NTSTATUS rc = STATUS_NOT_SUPPORTED;
rc = IoSetDeviceInterfaceState(&ext->link_name, FALSE); @@ -224,15 +208,6 @@ static NTSTATUS remove_device(minidriver *minidriver, DEVICE_OBJECT *device, IRP if (irp) rc = minidriver->PNPDispatch(device, irp); HID_DeleteDevice(device); - LIST_FOR_EACH_ENTRY(hiddev, &minidriver->device_list, hid_device, entry) - { - if (hiddev->device == device) - { - list_remove(&hiddev->entry); - HeapFree(GetProcessHeap(), 0, hiddev); - break; - } - } return rc; }
Microsoft doesn't really clearly document this, but their driver samples return it here, and so do remove locks.
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/wineusb.sys/wineusb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/wineusb.sys/wineusb.c b/dlls/wineusb.sys/wineusb.c index ded01aad435..c3479a84d09 100644 --- a/dlls/wineusb.sys/wineusb.c +++ b/dlls/wineusb.sys/wineusb.c @@ -462,7 +462,7 @@ static NTSTATUS pdo_pnp(DEVICE_OBJECT *device_obj, IRP *irp) while ((entry = RemoveHeadList(&parent->irp_list)) != &parent->irp_list) { irp = CONTAINING_RECORD(entry, IRP, Tail.Overlay.ListEntry); - irp->IoStatus.Status = STATUS_CANCELLED; + irp->IoStatus.Status = STATUS_DELETE_PENDING; irp->IoStatus.Information = 0; IoCompleteRequest(irp, IO_NO_INCREMENT); }
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=85479
Your paranoid android.
=== debiant2 (build log) ===
error: patch failed: dlls/wineusb.sys/wineusb.c:462 Task: Patch failed to apply
=== debiant2 (build log) ===
error: patch failed: dlls/wineusb.sys/wineusb.c:462 Task: Patch failed to apply
Microsoft doesn't really clearly document this, but their driver samples return it here, and so do remove locks.
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/winebus.sys/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/winebus.sys/main.c b/dlls/winebus.sys/main.c index 396a9d07123..8d3dec4779a 100644 --- a/dlls/winebus.sys/main.c +++ b/dlls/winebus.sys/main.c @@ -370,7 +370,7 @@ void bus_remove_hid_device(DEVICE_OBJECT *device) while ((entry = RemoveHeadList(&ext->irp_queue)) != &ext->irp_queue) { irp = CONTAINING_RECORD(entry, IRP, Tail.Overlay.s.ListEntry); - irp->IoStatus.u.Status = STATUS_CANCELLED; + irp->IoStatus.u.Status = STATUS_DELETE_PENDING; irp->IoStatus.Information = 0; IoCompleteRequest(irp, IO_NO_INCREMENT); }
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=85480
Your paranoid android.
=== debiant2 (build log) ===
error: patch failed: dlls/wineusb.sys/wineusb.c:462 Task: Patch failed to apply
=== debiant2 (build log) ===
error: patch failed: dlls/wineusb.sys/wineusb.c:462 Task: Patch failed to apply