hid: Fill the HIDD_ATTRIBUTES Size member, and add a test for expected size.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
stable
Rémi Bernon 2019-06-18 11:34:25 +02:00 committed by Alexandre Julliard
parent d8dec0b3f9
commit cce8074aa9
2 changed files with 6 additions and 0 deletions

View File

@ -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;

View File

@ -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)