Rémi Bernon : hid: Return HIDP_STATUS_INCOMPATIBLE_REPORT_ID when id mismatches.

Alexandre Julliard julliard at winehq.org
Mon Jun 28 16:49:35 CDT 2021


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

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Mon Jun 28 09:21:57 2021 +0200

hid: Return HIDP_STATUS_INCOMPATIBLE_REPORT_ID when id mismatches.

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

---

 dlls/hid/hidp.c                    | 5 +++--
 dlls/ntoskrnl.exe/tests/ntoskrnl.c | 4 ----
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/dlls/hid/hidp.c b/dlls/hid/hidp.c
index 59f18276b38..6261c3c2f68 100644
--- a/dlls/hid/hidp.c
+++ b/dlls/hid/hidp.c
@@ -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;
 }
diff --git a/dlls/ntoskrnl.exe/tests/ntoskrnl.c b/dlls/ntoskrnl.exe/tests/ntoskrnl.c
index 432bc168259..753957a8ac6 100644
--- a/dlls/ntoskrnl.exe/tests/ntoskrnl.c
+++ b/dlls/ntoskrnl.exe/tests/ntoskrnl.c
@@ -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,




More information about the wine-cvs mailing list