=?UTF-8?Q?R=C3=A9mi=20Bernon=20?=: hid: Fill the HIDD_ATTRIBUTES Size member, and add a test for expected size.

Alexandre Julliard julliard at winehq.org
Thu Jun 20 16:04:19 CDT 2019


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

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Tue Jun 18 11:34:25 2019 +0200

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

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

---

 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 16b3a3f..4bb4deb 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 4651ced..bb819cc 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)




More information about the wine-cvs mailing list