hid: Return HIDP_STATUS_SUCCESS even if no usages are found.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Rémi Bernon 2021-08-12 10:26:54 +02:00 committed by Alexandre Julliard
parent 5679e006ca
commit b36b2999c8
3 changed files with 6 additions and 3 deletions

View File

@ -328,7 +328,6 @@ NTSTATUS WINAPI HidP_GetUsages( HIDP_REPORT_TYPE report_type, USAGE usage_page,
*usages_len = params.usages - usages;
if (status != HIDP_STATUS_SUCCESS) return status;
if (*usages_len == 0) return HIDP_STATUS_USAGE_NOT_FOUND;
if (params.usages > params.usages_end) return HIDP_STATUS_BUFFER_TOO_SMALL;
return status;
}
@ -672,7 +671,6 @@ NTSTATUS WINAPI HidP_GetUsagesEx( HIDP_REPORT_TYPE report_type, USHORT collectio
*usages_len = params.usages - usages;
if (status != HIDP_STATUS_SUCCESS) return status;
if (*usages_len == 0) return HIDP_STATUS_USAGE_NOT_FOUND;
if (params.usages > params.usages_end) return HIDP_STATUS_BUFFER_TOO_SMALL;
return status;
}

View File

@ -2220,6 +2220,12 @@ static void test_hidp(HANDLE file, HANDLE async_file, int report_id, BOOL polled
report, caps.InputReportByteLength);
ok(status == HIDP_STATUS_SUCCESS, "HidP_SetUsages returned %#x\n", status);
value = ARRAY_SIZE(usages);
status = HidP_GetUsages(HidP_Input, HID_USAGE_PAGE_KEYBOARD, 0, usages, &value, preparsed_data,
report, caps.InputReportByteLength);
ok(status == HIDP_STATUS_SUCCESS, "HidP_GetUsages returned %#x\n", status);
ok(value == 0, "got usage count %d, expected %d\n", value, 2);
usages[0] = 0x9;
usages[1] = 0xb;
usages[2] = 0xa;

View File

@ -678,7 +678,6 @@ static void check_hid_caps(DWORD index, HANDLE device, PHIDP_PREPARSED_DATA pre
length = ARRAY_SIZE(usages);
status = HidP_GetUsages(HidP_Input, HID_USAGE_PAGE_BUTTON, 0, usages, &length, preparsed, buffer, hid_caps->InputReportByteLength);
todo_wine
ok(status == HIDP_STATUS_SUCCESS, "HidP_GetUsages returned %#x\n", status);
ok(length == 0, "got length %u\n", length);