From: Rémi Bernon rbernon@codeweavers.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=57524 --- dlls/winebus.sys/main.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/dlls/winebus.sys/main.c b/dlls/winebus.sys/main.c index 5b971473bb7..f0003d0774d 100644 --- a/dlls/winebus.sys/main.c +++ b/dlls/winebus.sys/main.c @@ -537,15 +537,6 @@ static void process_hid_report(DEVICE_OBJECT *device, BYTE *report_buf, DWORD re
TRACE("device %p report_buf %p (%#x), report_len %#lx\n", device, report_buf, *report_buf, report_len);
- if (!ext->collection_desc.ReportIDs[0].ReportID) last_report = ext->last_reports[0]; - else last_report = ext->last_reports[report_buf[0]]; - - if (!last_report) - { - WARN("Ingoring report with unexpected id %#x\n", *report_buf); - return; - } - if (!(report = RtlAllocateHeap(GetProcessHeap(), 0, size))) return; memcpy(report->buffer, report_buf, report_len); report->length = report_len; @@ -604,6 +595,22 @@ static void process_hid_report(DEVICE_OBJECT *device, BYTE *report_buf, DWORD re }
RtlEnterCriticalSection(&ext->cs); + + if (ext->state != DEVICE_STATE_STARTED) + { + RtlLeaveCriticalSection(&ext->cs); + return; + } + + if (!ext->collection_desc.ReportIDs[0].ReportID) last_report = ext->last_reports[0]; + else last_report = ext->last_reports[report_buf[0]]; + if (!last_report) + { + WARN("Ignoring report with unexpected id %#x\n", *report_buf); + RtlLeaveCriticalSection(&ext->cs); + return; + } + list_add_tail(&ext->reports, &report->entry);
memcpy(last_report->buffer, report_buf, report_len);