[PATCH v3 6/6] ntoskrnl.exe/tests: Add some HidP_InitializeReportForID tests.

Zebediah Figura (she/her) zfigura at codeweavers.com
Tue Jun 8 15:50:08 CDT 2021


On 6/4/21 4:12 AM, Rémi Bernon wrote:
> Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
> ---
>   dlls/ntoskrnl.exe/tests/ntoskrnl.c | 20 +++++++++++++++++++-
>   1 file changed, 19 insertions(+), 1 deletion(-)
> 
> diff --git a/dlls/ntoskrnl.exe/tests/ntoskrnl.c b/dlls/ntoskrnl.exe/tests/ntoskrnl.c
> index 099f747ff86..bd7dc2093e9 100644
> --- a/dlls/ntoskrnl.exe/tests/ntoskrnl.c
> +++ b/dlls/ntoskrnl.exe/tests/ntoskrnl.c
> @@ -1626,7 +1626,7 @@ static void test_hid_device(void)
>           {0}, 1, 1, 3, 11, 0, 0, 0, 0, 0, 0
>       };
>   
> -    char buffer[200];
> +    char buffer[200], report[200];
>       SP_DEVICE_INTERFACE_DETAIL_DATA_A *iface_detail = (void *)buffer;
>       SP_DEVICE_INTERFACE_DATA iface = {sizeof(iface)};
>       SP_DEVINFO_DATA device = {sizeof(device)};
> @@ -1861,6 +1861,24 @@ static void test_hid_device(void)
>       todo_wine ok(status == HIDP_STATUS_USAGE_NOT_FOUND, "HidP_GetSpecificValueCaps returned %#x\n", status);
>       ok(count == 0, "HidP_GetSpecificValueCaps returned count %d, expected %d\n", count, 0);
>   
> +    status = HidP_InitializeReportForID(HidP_Input, 0, (PHIDP_PREPARSED_DATA)buffer, report, sizeof(report));
> +    ok(status == HIDP_STATUS_INVALID_PREPARSED_DATA, "HidP_InitializeReportForID returned %#x\n", status);
> +    status = HidP_InitializeReportForID(HidP_Feature + 1, 0, preparsed_data, report, sizeof(report));
> +    ok(status == HIDP_STATUS_INVALID_REPORT_TYPE, "HidP_InitializeReportForID returned %#x\n", status);
> +    status = HidP_InitializeReportForID(HidP_Input, 0, preparsed_data, report, sizeof(report));
> +    ok(status == HIDP_STATUS_INVALID_REPORT_LENGTH, "HidP_InitializeReportForID returned %#x\n", status);
> +    status = HidP_InitializeReportForID(HidP_Input, 0, preparsed_data, report, caps.InputReportByteLength + 1);
> +    ok(status == HIDP_STATUS_INVALID_REPORT_LENGTH, "HidP_InitializeReportForID returned %#x\n", status);
> +
> +    memset(report, 0xcd, sizeof(report));
> +    status = HidP_InitializeReportForID(HidP_Input, 0, preparsed_data, report, caps.InputReportByteLength);
> +    ok(status == HIDP_STATUS_SUCCESS, "HidP_InitializeReportForID returned %#x\n", status);
> +
> +    memset(buffer, 0xcd, sizeof(buffer));
> +    memset(buffer, 0, 5);
> +    buffer[0] = 0;

This statement is redundant; is there a copy-paste error here?

> +    ok(!memcmp(buffer, report, sizeof(buffer)), "unexpected report data\n");
> +
>       HidD_FreePreparsedData(preparsed_data);
>       CloseHandle(file);
>   
> 



More information about the wine-devel mailing list