hid: Fix HidP_MaxUsageListLength to handle UsagePage == 0 properly.

Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Aric Stewart 2016-11-03 10:42:59 -05:00 committed by Alexandre Julliard
parent 20a4842a89
commit 86f4aa1993

View File

@ -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 -