https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6291990483dc78380036fffa4b9d4f7afd8ba819

commit 6291990483dc78380036fffa4b9d4f7afd8ba819
Author:     Amine Khaldi <[email protected]>
AuthorDate: Sat Oct 26 22:57:25 2019 +0100
Commit:     Amine Khaldi <[email protected]>
CommitDate: Sat Oct 26 22:57:25 2019 +0100

    [HID_WINETEST] Sync with Wine Staging 4.18. CORE-16441
---
 modules/rostests/winetests/hid/device.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/modules/rostests/winetests/hid/device.c 
b/modules/rostests/winetests/hid/device.c
index f20677fb1b4..bb819cc83f2 100644
--- a/modules/rostests/winetests/hid/device.c
+++ b/modules/rostests/winetests/hid/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)
@@ -79,10 +84,17 @@ static void run_for_each_device(device_test *test)
                 trace("Not enough permissions to read device %s.\n", 
wine_dbgstr_w(data->DevicePath));
                 continue;
             }
+            if (file == INVALID_HANDLE_VALUE && GetLastError() == 
ERROR_SHARING_VIOLATION)
+            {
+                trace("Device is busy: %s.\n", 
wine_dbgstr_w(data->DevicePath));
+                continue;
+            }
+
             ok(file != INVALID_HANDLE_VALUE, "Failed to open %s, error %u.\n",
                 wine_dbgstr_w(data->DevicePath), GetLastError());
 
-            test(file);
+            if (file != INVALID_HANDLE_VALUE)
+                test(file);
 
             CloseHandle(file);
         }

Reply via email to