[PATCH] hid: Fill the HIDD_ATTRIBUTES Size member, and add a test for expected size

Aric Stewart aric at codeweavers.com
Thu Jun 20 12:17:48 CDT 2019


Signed-off-by: Aric Stewart <aric at codeweavers.com>

On 6/18/19 4:34 AM, Rémi Bernon wrote:
> Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
> ---
>   dlls/hid/hidd.c         | 1 +
>   dlls/hid/tests/device.c | 5 +++++
>   2 files changed, 6 insertions(+)
> 
> diff --git a/dlls/hid/hidd.c b/dlls/hid/hidd.c
> index 16b3a3f0a2b..4bb4deb48b3 100644
> --- a/dlls/hid/hidd.c
> +++ b/dlls/hid/hidd.c
> @@ -69,6 +69,7 @@ BOOLEAN WINAPI HidD_GetAttributes(HANDLE HidDeviceObject, PHIDD_ATTRIBUTES Attr)
> 
>       if (ret)
>       {
> +        Attr->Size = sizeof(HIDD_ATTRIBUTES);
>           Attr->VendorID = info.VendorID;
>           Attr->ProductID = info.ProductID;
>           Attr->VersionNumber = info.VersionNumber;
> diff --git a/dlls/hid/tests/device.c b/dlls/hid/tests/device.c
> index 4651ced06dd..bb819cc83f2 100644
> --- a/dlls/hid/tests/device.c
> +++ b/dlls/hid/tests/device.c
> @@ -34,6 +34,7 @@ static void test_device_info(HANDLE device)
>   {
>       PHIDP_PREPARSED_DATA ppd;
>       HIDP_CAPS Caps;
> +    HIDD_ATTRIBUTES attributes;
>       NTSTATUS status;
>       BOOL rc;
>       WCHAR device_name[128];
> @@ -47,6 +48,10 @@ static void test_device_info(HANDLE device)
>       trace("Found device %s (%02x, %02x)\n", wine_dbgstr_w(device_name), Caps.UsagePage, Caps.Usage);
>       rc = HidD_FreePreparsedData(ppd);
>       ok(rc, "Failed to free preparsed data(0x%x)\n", GetLastError());
> +    rc = HidD_GetAttributes(device, &attributes);
> +    ok(rc, "Failed to get device attributes (0x%x)\n", GetLastError());
> +    ok(attributes.Size == sizeof(attributes), "Unexpected HIDD_ATTRIBUTES size: %d\n", attributes.Size);
> +    trace("Device attributes: vid:%04x pid:%04x ver:%04x\n", attributes.VendorID, attributes.ProductID, attributes.VersionNumber);
>   }
> 
>   static void run_for_each_device(device_test *test)
> --
> 2.20.1
> 
> 
> 



More information about the wine-devel mailing list