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

Alexandre Julliard julliard at winehq.org
Mon Nov 14 17:07:08 CST 2016


Module: wine
Branch: master
Commit: 86f4aa1993e35f71bc937a5a8f5aa8d8bcfe125c
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=86f4aa1993e35f71bc937a5a8f5aa8d8bcfe125c

Author: Aric Stewart <aric at codeweavers.com>
Date:   Thu Nov  3 10:42:59 2016 -0500

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

Signed-off-by: Aric Stewart <aric at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/hid/hidp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/dlls/hid/hidp.c b/dlls/hid/hidp.c
index 56bb91a..b94e7b0 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 -




More information about the wine-cvs mailing list