Commit 28bbaf67 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

hid: Return HIDP_STATUS_INCOMPATIBLE_REPORT_ID when id mismatches.

parent 0d915de4
......@@ -96,13 +96,14 @@ static NTSTATUS enum_value_caps( WINE_HIDP_PREPARSED_DATA *preparsed, HIDP_REPOR
{
const struct hid_value_caps *caps, *caps_end;
NTSTATUS status;
BOOL incompatible = FALSE;
LONG remaining = *count;
for (status = get_value_caps_range( preparsed, report_type, report_len, &caps, &caps_end );
status == HIDP_STATUS_SUCCESS && caps != caps_end; caps++)
{
if (!match_value_caps( caps, filter )) continue;
if (filter->report_id && caps->report_id != filter->report_id) continue;
if (filter->report_id && caps->report_id != filter->report_id) incompatible = TRUE;
else if (filter->array && (caps->is_range || caps->report_count <= 1)) return HIDP_STATUS_NOT_VALUE_ARRAY;
else if (remaining-- > 0) status = callback( caps, user );
}
......@@ -111,7 +112,7 @@ static NTSTATUS enum_value_caps( WINE_HIDP_PREPARSED_DATA *preparsed, HIDP_REPOR
if (status != HIDP_STATUS_SUCCESS) return status;
*count -= remaining;
if (*count == 0) return HIDP_STATUS_USAGE_NOT_FOUND;
if (*count == 0) return incompatible ? HIDP_STATUS_INCOMPATIBLE_REPORT_ID : HIDP_STATUS_USAGE_NOT_FOUND;
if (remaining < 0) return HIDP_STATUS_BUFFER_TOO_SMALL;
return HIDP_STATUS_SUCCESS;
}
......
......@@ -2292,14 +2292,12 @@ static void test_hidp(HANDLE file, int report_id)
status = HidP_SetUsageValue(HidP_Feature, HID_USAGE_PAGE_ORDINAL, waveform_list, 3,
HID_USAGE_HAPTICS_WAVEFORM_RUMBLE, preparsed_data, report,
caps.FeatureReportByteLength);
todo_wine_if(!report_id)
ok(status == (report_id ? HIDP_STATUS_SUCCESS : HIDP_STATUS_INCOMPATIBLE_REPORT_ID),
"HidP_SetUsageValue returned %#x\n", status);
report[0] = 2;
status = HidP_SetUsageValue(HidP_Feature, HID_USAGE_PAGE_ORDINAL, waveform_list, 3,
HID_USAGE_HAPTICS_WAVEFORM_RUMBLE, preparsed_data, report,
caps.FeatureReportByteLength);
todo_wine
ok(status == HIDP_STATUS_INCOMPATIBLE_REPORT_ID, "HidP_SetUsageValue returned %#x\n", status);
report[0] = report_id;
status = HidP_SetUsageValue(HidP_Feature, HID_USAGE_PAGE_ORDINAL, 0xdead, 3, HID_USAGE_HAPTICS_WAVEFORM_RUMBLE,
......@@ -2330,13 +2328,11 @@ static void test_hidp(HANDLE file, int report_id)
report[0] = 1 - report_id;
status = HidP_GetUsageValue(HidP_Feature, HID_USAGE_PAGE_ORDINAL, waveform_list, 3, &value,
preparsed_data, report, caps.FeatureReportByteLength);
todo_wine_if(!report_id)
ok(status == (report_id ? HIDP_STATUS_SUCCESS : HIDP_STATUS_INCOMPATIBLE_REPORT_ID),
"HidP_GetUsageValue returned %#x\n", status);
report[0] = 2;
status = HidP_GetUsageValue(HidP_Feature, HID_USAGE_PAGE_ORDINAL, waveform_list, 3, &value,
preparsed_data, report, caps.FeatureReportByteLength);
todo_wine
ok(status == HIDP_STATUS_INCOMPATIBLE_REPORT_ID, "HidP_GetUsageValue returned %#x\n", status);
report[0] = report_id;
status = HidP_GetUsageValue(HidP_Feature, HID_USAGE_PAGE_ORDINAL, 0xdead, 3, &value,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment