hidparse.sys: Preserve the original report_count in parse_new_value_caps.

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@gmail.com>
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Ivo Ivanov 2021-10-01 09:51:04 +02:00 committed by Alexandre Julliard
parent 11fe73ed8f
commit d97426be02
2 changed files with 6 additions and 5 deletions

View File

@ -1771,8 +1771,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,
@ -2460,8 +2460,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 */
@ -2682,7 +2681,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,

View File

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