Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/winebus.sys/main.c | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-)
diff --git a/dlls/winebus.sys/main.c b/dlls/winebus.sys/main.c index 8d3dec4779a..7d3f5064f84 100644 --- a/dlls/winebus.sys/main.c +++ b/dlls/winebus.sys/main.c @@ -112,6 +112,8 @@ struct pnp_device
struct device_extension { + CRITICAL_SECTION cs; + struct pnp_device *pnp_device;
WORD vid, pid, input; @@ -127,7 +129,6 @@ struct device_extension BOOL last_report_read; DWORD buffer_size; LIST_ENTRY irp_queue; - CRITICAL_SECTION report_cs;
BYTE platform_private[1]; }; @@ -285,8 +286,8 @@ DEVICE_OBJECT *bus_create_hid_device(const WCHAR *busidW, WORD vid, WORD pid, memset(ext->platform_private, 0, platform_data_size);
InitializeListHead(&ext->irp_queue); - InitializeCriticalSection(&ext->report_cs); - ext->report_cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": report_cs"); + InitializeCriticalSection(&ext->cs); + ext->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": cs");
/* add to list of pnp devices */ pnp_dev->device = device; @@ -366,7 +367,7 @@ void bus_remove_hid_device(DEVICE_OBJECT *device) TRACE("(%p)\n", device);
/* Cancel pending IRPs */ - EnterCriticalSection(&ext->report_cs); + EnterCriticalSection(&ext->cs); while ((entry = RemoveHeadList(&ext->irp_queue)) != &ext->irp_queue) { irp = CONTAINING_RECORD(entry, IRP, Tail.Overlay.s.ListEntry); @@ -374,10 +375,10 @@ void bus_remove_hid_device(DEVICE_OBJECT *device) irp->IoStatus.Information = 0; IoCompleteRequest(irp, IO_NO_INCREMENT); } - LeaveCriticalSection(&ext->report_cs); + LeaveCriticalSection(&ext->cs);
- ext->report_cs.DebugInfo->Spare[0] = 0; - DeleteCriticalSection(&ext->report_cs); + ext->cs.DebugInfo->Spare[0] = 0; + DeleteCriticalSection(&ext->cs);
HeapFree(GetProcessHeap(), 0, ext->serial); HeapFree(GetProcessHeap(), 0, ext->last_report); @@ -783,12 +784,12 @@ static NTSTATUS WINAPI hid_internal_dispatch(DEVICE_OBJECT *device, IRP *irp) { HID_XFER_PACKET *packet = (HID_XFER_PACKET*)(irp->UserBuffer); TRACE_(hid_report)("IOCTL_HID_GET_INPUT_REPORT\n"); - EnterCriticalSection(&ext->report_cs); + EnterCriticalSection(&ext->cs); status = ext->vtbl->begin_report_processing(device); if (status != STATUS_SUCCESS) { irp->IoStatus.u.Status = status; - LeaveCriticalSection(&ext->report_cs); + LeaveCriticalSection(&ext->cs); break; }
@@ -798,18 +799,18 @@ static NTSTATUS WINAPI hid_internal_dispatch(DEVICE_OBJECT *device, IRP *irp)
if (status == STATUS_SUCCESS) packet->reportBufferLen = irp->IoStatus.Information; - LeaveCriticalSection(&ext->report_cs); + LeaveCriticalSection(&ext->cs); break; } case IOCTL_HID_READ_REPORT: { TRACE_(hid_report)("IOCTL_HID_READ_REPORT\n"); - EnterCriticalSection(&ext->report_cs); + EnterCriticalSection(&ext->cs); status = ext->vtbl->begin_report_processing(device); if (status != STATUS_SUCCESS) { irp->IoStatus.u.Status = status; - LeaveCriticalSection(&ext->report_cs); + LeaveCriticalSection(&ext->cs); break; } if (!ext->last_report_read) @@ -824,7 +825,7 @@ static NTSTATUS WINAPI hid_internal_dispatch(DEVICE_OBJECT *device, IRP *irp) InsertTailList(&ext->irp_queue, &irp->Tail.Overlay.s.ListEntry); status = STATUS_PENDING; } - LeaveCriticalSection(&ext->report_cs); + LeaveCriticalSection(&ext->cs); break; } case IOCTL_HID_SET_OUTPUT_REPORT: @@ -880,7 +881,7 @@ void process_hid_report(DEVICE_OBJECT *device, BYTE *report, DWORD length) if (!length || !report) return;
- EnterCriticalSection(&ext->report_cs); + EnterCriticalSection(&ext->cs); if (length > ext->buffer_size) { HeapFree(GetProcessHeap(), 0, ext->last_report); @@ -891,7 +892,7 @@ void process_hid_report(DEVICE_OBJECT *device, BYTE *report, DWORD length) ext->buffer_size = 0; ext->last_report_size = 0; ext->last_report_read = TRUE; - LeaveCriticalSection(&ext->report_cs); + LeaveCriticalSection(&ext->cs); return; } else @@ -914,7 +915,7 @@ void process_hid_report(DEVICE_OBJECT *device, BYTE *report, DWORD length) ext->last_report_read = TRUE; IoCompleteRequest(irp, IO_NO_INCREMENT); } - LeaveCriticalSection(&ext->report_cs); + LeaveCriticalSection(&ext->cs); }
DWORD check_bus_option(const UNICODE_STRING *option, DWORD default_value)