[PATCH] hidparse.sys: Preserve the original report_count in parse_new_value_caps.

Rémi Bernon rbernon at codeweavers.com
Fri Oct 1 02:51:04 CDT 2021


From: Ivo Ivanov <logos128 at gmail.com>

We force state->items.report_count to 1 while building the alternate
value array, but the item is global and should be preserved across caps.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51822
Signed-off-by: Ivo Ivanov <logos128 at gmail.com>
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
 dlls/dinput8/tests/hid.c | 9 ++++-----
 dlls/hidparse.sys/main.c | 2 ++
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c
index 71989ef1b3c..0cfcfedc6cf 100644
--- a/dlls/dinput8/tests/hid.c
+++ b/dlls/dinput8/tests/hid.c
@@ -1784,8 +1784,8 @@ static void test_hidp( HANDLE file, HANDLE async_file, int report_id, BOOL polle
     status = HidP_SetUsages( HidP_Input, HID_USAGE_PAGE_KEYBOARD, 0, usages, &value, preparsed_data,
                              report, caps.InputReportByteLength );
     ok( status == HIDP_STATUS_BUFFER_TOO_SMALL, "HidP_SetUsages returned %#x\n", status );
-    buffer[6] = 2;
-    buffer[7] = 4;
+    buffer[13] = 2;
+    buffer[14] = 4;
     ok( !memcmp( buffer, report, caps.InputReportByteLength ), "unexpected report data\n" );
 
     status = HidP_SetUsageValue( HidP_Input, HID_USAGE_PAGE_LED, 0, 6, 1, preparsed_data, report,
@@ -2502,8 +2502,7 @@ static void test_hid_driver( DWORD report_id, DWORD polled )
                 REPORT_COUNT(1, 8),
                 REPORT_SIZE(1, 1),
                 INPUT(1, Cnst|Var|Abs),
-                REPORT_COUNT(1, 8),
-                REPORT_SIZE(1, 1),
+                REPORT_SIZE(1, 8),
                 INPUT(1, Cnst|Var|Abs),
                 /* needs to be 8 bit aligned as next has Buff */
 
@@ -2724,7 +2723,7 @@ static void test_hid_driver( DWORD report_id, DWORD polled )
     {
         .Usage = HID_USAGE_GENERIC_JOYSTICK,
         .UsagePage = HID_USAGE_PAGE_GENERIC,
-        .InputReportByteLength = report_id ? 25 : 26,
+        .InputReportByteLength = report_id ? 32 : 33,
         .OutputReportByteLength = report_id ? 2 : 3,
         .FeatureReportByteLength = report_id ? 21 : 22,
         .NumberLinkCollectionNodes = 10,
diff --git a/dlls/hidparse.sys/main.c b/dlls/hidparse.sys/main.c
index ca15a91c75a..18ee23974f0 100644
--- a/dlls/hidparse.sys/main.c
+++ b/dlls/hidparse.sys/main.c
@@ -360,6 +360,7 @@ static BOOL parse_new_value_caps( struct hid_parser_state *state, HIDP_REPORT_TY
 {
     struct hid_value_caps *values;
     USAGE usage_page = state->items.usage_page;
+    USHORT report_count = state->items.report_count;
     DWORD i, usages_size = max( 1, state->usages_size );
     USHORT *byte_length = &state->byte_length[type];
     ULONG start_bit, *bit_size = &state->bit_size[type][state->items.report_id];
@@ -408,6 +409,7 @@ static BOOL parse_new_value_caps( struct hid_parser_state *state, HIDP_REPORT_TY
     state->data_count[type] = state->items.data_index_max + 1;
 
     state->items.usage_page = usage_page;
+    state->items.report_count = report_count;
     reset_local_items( state );
     return TRUE;
 }
-- 
2.33.0




More information about the wine-devel mailing list