Rémi Bernon : hidclass.sys: Fix nary usage collections index ordering.

Alexandre Julliard julliard at winehq.org
Thu Aug 26 15:22:32 CDT 2021


Module: wine
Branch: master
Commit: b117f6548a3f3734b23f865f2e9aeceed27062ed
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=b117f6548a3f3734b23f865f2e9aeceed27062ed

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Wed Aug 25 18:08:31 2021 +0200

hidclass.sys: Fix nary usage collections index ordering.

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/hidparse.sys/main.c           | 4 ++--
 dlls/ntoskrnl.exe/tests/ntoskrnl.c | 3 ---
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/dlls/hidparse.sys/main.c b/dlls/hidparse.sys/main.c
index 185cefbb3e5..3a57c338165 100644
--- a/dlls/hidparse.sys/main.c
+++ b/dlls/hidparse.sys/main.c
@@ -354,14 +354,13 @@ static BOOL parse_new_value_caps( struct hid_parser_state *state, HIDP_REPORT_TY
     }
     value = state->values[type] + *value_idx;
 
-    state->items.start_index = 0;
+    state->items.start_index = usages_size;
     if (!(is_array = HID_VALUE_CAPS_IS_ARRAY( &state->items ))) state->items.report_count -= usages_size - 1;
     else state->items.start_bit -= state->items.report_count * state->items.bit_size;
 
     while (usages_size--)
     {
         if (!is_array) state->items.start_bit -= state->items.report_count * state->items.bit_size;
-        else state->items.start_index += 1;
         state->items.usage_page = state->usages_page[usages_size];
         state->items.usage_min = state->usages_min[usages_size];
         state->items.usage_max = state->usages_max[usages_size];
@@ -371,6 +370,7 @@ static BOOL parse_new_value_caps( struct hid_parser_state *state, HIDP_REPORT_TY
         *value++ = state->items;
         *value_idx += 1;
         if (!is_array) state->items.report_count = 1;
+        else state->items.start_index -= 1;
     }
 
     state->items.usage_page = usage_page;
diff --git a/dlls/ntoskrnl.exe/tests/ntoskrnl.c b/dlls/ntoskrnl.exe/tests/ntoskrnl.c
index 85380cd9df2..2f5c2cd81cc 100644
--- a/dlls/ntoskrnl.exe/tests/ntoskrnl.c
+++ b/dlls/ntoskrnl.exe/tests/ntoskrnl.c
@@ -2340,10 +2340,8 @@ static void test_hidp(HANDLE file, HANDLE async_file, int report_id, BOOL polled
     status = HidP_SetUsages(HidP_Input, HID_USAGE_PAGE_KEYBOARD, 0, usages, &value, preparsed_data,
                             report, caps.InputReportByteLength);
     ok(status == HIDP_STATUS_SUCCESS, "HidP_SetUsages returned %#x\n", status);
-    todo_wine
     ok(report[caps.InputReportByteLength - 2] == 3, "unexpected usage index %d, expected 3\n",
        report[caps.InputReportByteLength - 2]);
-    todo_wine
     ok(report[caps.InputReportByteLength - 1] == 4, "unexpected usage index %d, expected 4\n",
        report[caps.InputReportByteLength - 1]);
     report[caps.InputReportByteLength - 2] = 0;
@@ -2353,7 +2351,6 @@ static void test_hidp(HANDLE file, HANDLE async_file, int report_id, BOOL polled
     status = HidP_SetUsages(HidP_Input, HID_USAGE_PAGE_KEYBOARD, 0, usages, &value, preparsed_data,
                             report, caps.InputReportByteLength);
     ok(status == HIDP_STATUS_SUCCESS, "HidP_SetUsages returned %#x\n", status);
-    todo_wine
     ok(report[caps.InputReportByteLength - 2] == 1, "unexpected usage index %d, expected 1\n",
        report[caps.InputReportByteLength - 2]);
 




More information about the wine-cvs mailing list