Commit 5294ebc9 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

hidclass.sys: No longer track devices in a list.

parent 76daa6b7
...@@ -72,12 +72,6 @@ void RingBuffer_Destroy(struct ReportRingBuffer *buffer) DECLSPEC_HIDDEN; ...@@ -72,12 +72,6 @@ void RingBuffer_Destroy(struct ReportRingBuffer *buffer) DECLSPEC_HIDDEN;
struct ReportRingBuffer* RingBuffer_Create(UINT buffer_size) DECLSPEC_HIDDEN; struct ReportRingBuffer* RingBuffer_Create(UINT buffer_size) DECLSPEC_HIDDEN;
NTSTATUS RingBuffer_SetSize(struct ReportRingBuffer *buffer, UINT 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 typedef struct _minidriver
{ {
struct list entry; struct list entry;
...@@ -88,7 +82,6 @@ typedef struct _minidriver ...@@ -88,7 +82,6 @@ typedef struct _minidriver
PDRIVER_ADD_DEVICE AddDevice; PDRIVER_ADD_DEVICE AddDevice;
PDRIVER_DISPATCH PNPDispatch; PDRIVER_DISPATCH PNPDispatch;
struct list device_list;
} minidriver; } minidriver;
NTSTATUS call_minidriver(ULONG code, DEVICE_OBJECT *device, void *in_buff, ULONG in_size, void *out_buff, ULONG out_size) DECLSPEC_HIDDEN; NTSTATUS call_minidriver(ULONG code, DEVICE_OBJECT *device, void *in_buff, ULONG in_size, void *out_buff, ULONG out_size) DECLSPEC_HIDDEN;
......
...@@ -81,8 +81,6 @@ NTSTATUS WINAPI HidRegisterMinidriver(HID_MINIDRIVER_REGISTRATION *registration) ...@@ -81,8 +81,6 @@ NTSTATUS WINAPI HidRegisterMinidriver(HID_MINIDRIVER_REGISTRATION *registration)
driver->minidriver = *registration; driver->minidriver = *registration;
list_add_tail(&minidriver_list, &driver->entry); list_add_tail(&minidriver_list, &driver->entry);
list_init(&driver->device_list);
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
......
...@@ -72,7 +72,6 @@ static NTSTATUS get_device_id(DEVICE_OBJECT *device, BUS_QUERY_ID_TYPE type, WCH ...@@ -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) NTSTATUS WINAPI PNP_AddDevice(DRIVER_OBJECT *driver, DEVICE_OBJECT *PDO)
{ {
WCHAR device_id[MAX_DEVICE_ID_LEN], instance_id[MAX_DEVICE_ID_LEN]; WCHAR device_id[MAX_DEVICE_ID_LEN], instance_id[MAX_DEVICE_ID_LEN];
hid_device *hiddev;
DEVICE_OBJECT *device = NULL; DEVICE_OBJECT *device = NULL;
NTSTATUS status; NTSTATUS status;
minidriver *minidriver; minidriver *minidriver;
...@@ -97,18 +96,12 @@ NTSTATUS WINAPI PNP_AddDevice(DRIVER_OBJECT *driver, DEVICE_OBJECT *PDO) ...@@ -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)); TRACE("Adding device to PDO %p, id %s\\%s.\n", PDO, debugstr_w(device_id), debugstr_w(instance_id));
minidriver = find_minidriver(driver); minidriver = find_minidriver(driver);
hiddev = HeapAlloc(GetProcessHeap(), 0, sizeof(*hiddev)); status = HID_CreateDevice(PDO, &minidriver->minidriver, &device);
if (!hiddev)
return STATUS_NO_MEMORY;
status = HID_CreateDevice(PDO, &minidriver->minidriver, &hiddev->device);
if (status != STATUS_SUCCESS) if (status != STATUS_SUCCESS)
{ {
ERR("Failed to create HID object (%x)\n",status); ERR("Failed to create HID object (%x)\n",status);
HeapFree(GetProcessHeap(), 0, hiddev);
return status; return status;
} }
device = hiddev->device;
ext = device->DeviceExtension; ext = device->DeviceExtension;
InitializeListHead(&ext->irp_queue); InitializeListHead(&ext->irp_queue);
...@@ -120,7 +113,6 @@ NTSTATUS WINAPI PNP_AddDevice(DRIVER_OBJECT *driver, DEVICE_OBJECT *PDO) ...@@ -120,7 +113,6 @@ NTSTATUS WINAPI PNP_AddDevice(DRIVER_OBJECT *driver, DEVICE_OBJECT *PDO)
{ {
ERR("Minidriver AddDevice failed (%x)\n",status); ERR("Minidriver AddDevice failed (%x)\n",status);
HID_DeleteDevice(device); HID_DeleteDevice(device);
HeapFree(GetProcessHeap(), 0, hiddev);
return status; return status;
} }
...@@ -131,7 +123,6 @@ NTSTATUS WINAPI PNP_AddDevice(DRIVER_OBJECT *driver, DEVICE_OBJECT *PDO) ...@@ -131,7 +123,6 @@ NTSTATUS WINAPI PNP_AddDevice(DRIVER_OBJECT *driver, DEVICE_OBJECT *PDO)
{ {
ERR("Minidriver failed to get Attributes(%x)\n",status); ERR("Minidriver failed to get Attributes(%x)\n",status);
HID_DeleteDevice(device); HID_DeleteDevice(device);
HeapFree(GetProcessHeap(), 0, hiddev);
return status; return status;
} }
...@@ -146,7 +137,6 @@ NTSTATUS WINAPI PNP_AddDevice(DRIVER_OBJECT *driver, DEVICE_OBJECT *PDO) ...@@ -146,7 +137,6 @@ NTSTATUS WINAPI PNP_AddDevice(DRIVER_OBJECT *driver, DEVICE_OBJECT *PDO)
{ {
ERR("Cannot get Device Descriptor(%x)\n",status); ERR("Cannot get Device Descriptor(%x)\n",status);
HID_DeleteDevice(device); HID_DeleteDevice(device);
HeapFree(GetProcessHeap(), 0, hiddev);
return status; return status;
} }
for (i = 0; i < descriptor.bNumDescriptors; i++) for (i = 0; i < descriptor.bNumDescriptors; i++)
...@@ -157,7 +147,6 @@ NTSTATUS WINAPI PNP_AddDevice(DRIVER_OBJECT *driver, DEVICE_OBJECT *PDO) ...@@ -157,7 +147,6 @@ NTSTATUS WINAPI PNP_AddDevice(DRIVER_OBJECT *driver, DEVICE_OBJECT *PDO)
{ {
ERR("No Report Descriptor found in reply\n"); ERR("No Report Descriptor found in reply\n");
HID_DeleteDevice(device); HID_DeleteDevice(device);
HeapFree(GetProcessHeap(), 0, hiddev);
return status; return status;
} }
...@@ -169,7 +158,6 @@ NTSTATUS WINAPI PNP_AddDevice(DRIVER_OBJECT *driver, DEVICE_OBJECT *PDO) ...@@ -169,7 +158,6 @@ NTSTATUS WINAPI PNP_AddDevice(DRIVER_OBJECT *driver, DEVICE_OBJECT *PDO)
ERR("Cannot get Report Descriptor(%x)\n",status); ERR("Cannot get Report Descriptor(%x)\n",status);
HID_DeleteDevice(device); HID_DeleteDevice(device);
HeapFree(GetProcessHeap(), 0, reportDescriptor); HeapFree(GetProcessHeap(), 0, reportDescriptor);
HeapFree(GetProcessHeap(), 0, hiddev);
return status; return status;
} }
...@@ -180,12 +168,9 @@ NTSTATUS WINAPI PNP_AddDevice(DRIVER_OBJECT *driver, DEVICE_OBJECT *PDO) ...@@ -180,12 +168,9 @@ NTSTATUS WINAPI PNP_AddDevice(DRIVER_OBJECT *driver, DEVICE_OBJECT *PDO)
{ {
ERR("Cannot parse Report Descriptor\n"); ERR("Cannot parse Report Descriptor\n");
HID_DeleteDevice(device); HID_DeleteDevice(device);
HeapFree(GetProcessHeap(), 0, hiddev);
return STATUS_NOT_SUPPORTED; return STATUS_NOT_SUPPORTED;
} }
list_add_tail(&(minidriver->device_list), &hiddev->entry);
ext->information.DescriptorSize = ext->preparseData->dwSize; ext->information.DescriptorSize = ext->preparseData->dwSize;
lstrcpyW(ext->instance_id, instance_id); lstrcpyW(ext->instance_id, instance_id);
...@@ -208,7 +193,6 @@ NTSTATUS WINAPI PNP_AddDevice(DRIVER_OBJECT *driver, DEVICE_OBJECT *PDO) ...@@ -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) static NTSTATUS remove_device(minidriver *minidriver, DEVICE_OBJECT *device, IRP *irp)
{ {
BASE_DEVICE_EXTENSION *ext = device->DeviceExtension; BASE_DEVICE_EXTENSION *ext = device->DeviceExtension;
hid_device *hiddev;
NTSTATUS rc = STATUS_NOT_SUPPORTED; NTSTATUS rc = STATUS_NOT_SUPPORTED;
rc = IoSetDeviceInterfaceState(&ext->link_name, FALSE); rc = IoSetDeviceInterfaceState(&ext->link_name, FALSE);
...@@ -224,15 +208,6 @@ static NTSTATUS remove_device(minidriver *minidriver, DEVICE_OBJECT *device, IRP ...@@ -224,15 +208,6 @@ static NTSTATUS remove_device(minidriver *minidriver, DEVICE_OBJECT *device, IRP
if (irp) if (irp)
rc = minidriver->PNPDispatch(device, irp); rc = minidriver->PNPDispatch(device, irp);
HID_DeleteDevice(device); 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; return rc;
} }
......
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