diff --git a/dlls/hid/hidp.c b/dlls/hid/hidp.c index 56bb91aaa06..b94e7b0c33d 100644 --- a/dlls/hid/hidp.c +++ b/dlls/hid/hidp.c @@ -510,7 +510,8 @@ ULONG WINAPI HidP_MaxUsageListLength(HIDP_REPORT_TYPE ReportType, USAGE UsagePag int j; for (j = 0; j < report->elementCount; j++) { - if (report->Elements[j].caps.button.UsagePage == UsagePage) + if (report->Elements[j].ElementType == ButtonElement && + (UsagePage == 0 || report->Elements[j].caps.button.UsagePage == UsagePage)) { if (report->Elements[j].caps.button.IsRange) count += (report->Elements[j].caps.button.u.Range.UsageMax -