Zebediah Figura : setupapi/tests: Add some tests for SetupDiGetDeviceInfoListDetail().

Alexandre Julliard julliard at winehq.org
Tue May 28 15:06:49 CDT 2019


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

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Mon May 27 22:13:19 2019 -0500

setupapi/tests: Add some tests for SetupDiGetDeviceInfoListDetail().

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/setupapi/tests/devinst.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/dlls/setupapi/tests/devinst.c b/dlls/setupapi/tests/devinst.c
index 3f4a5fd..09cd7ae 100644
--- a/dlls/setupapi/tests/devinst.c
+++ b/dlls/setupapi/tests/devinst.c
@@ -2731,6 +2731,16 @@ static void check_all_devices_enumerated_(int line, HDEVINFO set, BOOL expect_de
 }
 #define check_all_devices_enumerated(a,b) check_all_devices_enumerated_(__LINE__,a,b)
 
+static void check_device_list_(int line, HDEVINFO set, const GUID *expect)
+{
+    SP_DEVINFO_LIST_DETAIL_DATA_A detail = {sizeof(detail)};
+    BOOL ret = SetupDiGetDeviceInfoListDetailA(set, &detail);
+    ok_(__FILE__, line)(ret, "Failed to get list detail, error %#x.\n", GetLastError());
+    ok_(__FILE__, line)(IsEqualGUID(&detail.ClassGuid, expect), "Expected class %s, got %s\n",
+            wine_dbgstr_guid(expect), wine_dbgstr_guid(&detail.ClassGuid));
+}
+#define check_device_list(a,b) check_device_list_(__LINE__,a,b)
+
 static void test_get_class_devs(void)
 {
     SP_DEVICE_INTERFACE_DATA iface = {sizeof(iface)};
@@ -2772,6 +2782,7 @@ static void test_get_class_devs(void)
 
     set = SetupDiGetClassDevsA(NULL, NULL, NULL, DIGCF_ALLCLASSES);
     ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    check_device_list(set, &GUID_NULL);
     check_all_devices_enumerated(set, TRUE);
     check_device_iface(set, NULL, &iface_guid, 0, 0, NULL);
     ret = SetupDiDestroyDeviceInfoList(set);
@@ -2779,6 +2790,7 @@ static void test_get_class_devs(void)
 
     set = SetupDiGetClassDevsA(&guid, NULL, NULL, 0);
     ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    check_device_list(set, &guid);
     check_device_info(set, 0, &guid, "ROOT\\LEGACY_BOGUS\\FOO");
     check_device_info(set, 1, &guid, "ROOT\\LEGACY_BOGUS\\QUX");
     check_device_info(set, 2, NULL, NULL);
@@ -2788,6 +2800,7 @@ static void test_get_class_devs(void)
 
     set = SetupDiGetClassDevsA(&guid, NULL, NULL, DIGCF_ALLCLASSES);
     ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    check_device_list(set, &GUID_NULL);
     check_all_devices_enumerated(set, TRUE);
     check_device_iface(set, NULL, &iface_guid, 0, 0, NULL);
     ret = SetupDiDestroyDeviceInfoList(set);
@@ -2800,6 +2813,7 @@ static void test_get_class_devs(void)
 
     set = SetupDiGetClassDevsA(NULL, "ROOT", NULL, DIGCF_ALLCLASSES);
     ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    check_device_list(set, &GUID_NULL);
     check_all_devices_enumerated(set, TRUE);
     check_device_iface(set, NULL, &iface_guid, 0, 0, NULL);
     ret = SetupDiDestroyDeviceInfoList(set);
@@ -2807,6 +2821,7 @@ static void test_get_class_devs(void)
 
     set = SetupDiGetClassDevsA(NULL, "ROOT\\LEGACY_BOGUS", NULL, DIGCF_ALLCLASSES);
     ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    check_device_list(set, &GUID_NULL);
 todo_wine {
     check_device_info(set, 0, &guid2, "ROOT\\LEGACY_BOGUS\\BAR");
     check_device_info(set, 1, &guid, "ROOT\\LEGACY_BOGUS\\FOO");
@@ -2819,6 +2834,7 @@ todo_wine {
 
     set = SetupDiGetClassDevsA(&guid, "ROOT\\LEGACY_BOGUS", NULL, 0);
     ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    check_device_list(set, &guid);
 todo_wine {
     check_device_info(set, 0, &guid, "ROOT\\LEGACY_BOGUS\\FOO");
     check_device_info(set, 1, &guid, "ROOT\\LEGACY_BOGUS\\QUX");
@@ -2830,6 +2846,7 @@ todo_wine {
 
     set = SetupDiGetClassDevsA(&guid, "ROOT\\LEGACY_BOGUS", NULL, DIGCF_ALLCLASSES);
     ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    check_device_list(set, &GUID_NULL);
 todo_wine {
     check_device_info(set, 0, &guid2, "ROOT\\LEGACY_BOGUS\\BAR");
     check_device_info(set, 1, &guid, "ROOT\\LEGACY_BOGUS\\FOO");
@@ -2849,6 +2866,7 @@ todo_wine {
 
     set = SetupDiGetClassDevsA(NULL, NULL, NULL, DIGCF_DEVICEINTERFACE | DIGCF_ALLCLASSES);
     ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    check_device_list(set, &GUID_NULL);
     check_all_devices_enumerated(set, FALSE);
     check_device_iface(set, NULL, &iface_guid, 0, 0, "\\\\?\\root#legacy_bogus#foo#{deadbeef-3f65-11db-b704-0011955c2bdb}");
     check_device_iface(set, NULL, &iface_guid, 1, 0, "\\\\?\\root#legacy_bogus#qux#{deadbeef-3f65-11db-b704-0011955c2bdb}");
@@ -2860,6 +2878,7 @@ todo_wine {
 
     set = SetupDiGetClassDevsA(&guid, NULL, NULL, DIGCF_DEVICEINTERFACE);
     ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    check_device_list(set, &GUID_NULL);
     check_device_info(set, 0, NULL, NULL);
     check_device_iface(set, NULL, &iface_guid, 0, 0, NULL);
     check_device_iface(set, NULL, &iface_guid2, 0, 0, NULL);
@@ -2868,6 +2887,7 @@ todo_wine {
 
     set = SetupDiGetClassDevsA(&iface_guid, NULL, NULL, DIGCF_DEVICEINTERFACE);
     ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    check_device_list(set, &GUID_NULL);
     check_device_info(set, 0, &guid, "ROOT\\LEGACY_BOGUS\\FOO");
     check_device_info(set, 1, &guid, "ROOT\\LEGACY_BOGUS\\QUX");
     check_device_info(set, 2, &guid, NULL);
@@ -2880,6 +2900,7 @@ todo_wine {
 
     set = SetupDiGetClassDevsA(&iface_guid, NULL, NULL, DIGCF_DEVICEINTERFACE | DIGCF_ALLCLASSES);
     ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    check_device_list(set, &GUID_NULL);
     check_all_devices_enumerated(set, FALSE);
     check_device_iface(set, NULL, &iface_guid, 0, 0, "\\\\?\\root#legacy_bogus#foo#{deadbeef-3f65-11db-b704-0011955c2bdb}");
     check_device_iface(set, NULL, &iface_guid, 1, 0, "\\\\?\\root#legacy_bogus#qux#{deadbeef-3f65-11db-b704-0011955c2bdb}");
@@ -2910,6 +2931,7 @@ todo_wine {
 
     set = SetupDiGetClassDevsA(NULL, "ROOT\\LEGACY_BOGUS\\foo", NULL, DIGCF_DEVICEINTERFACE | DIGCF_ALLCLASSES);
     ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    check_device_list(set, &GUID_NULL);
     check_device_info(set, 0, &guid, "ROOT\\LEGACY_BOGUS\\FOO");
 todo_wine
     check_device_info(set, 1, NULL, NULL);
@@ -2922,6 +2944,7 @@ todo_wine
 
     set = SetupDiGetClassDevsA(NULL, "ROOT\\LEGACY_BOGUS\\bar", NULL, DIGCF_DEVICEINTERFACE | DIGCF_ALLCLASSES);
     ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    check_device_list(set, &GUID_NULL);
     check_device_info(set, 0, NULL, NULL);
     check_device_iface(set, NULL, &iface_guid, 0, 0, NULL);
     check_device_iface(set, NULL, &iface_guid2, 0, 0, NULL);
@@ -2944,6 +2967,7 @@ todo_wine {
 
     set = SetupDiGetClassDevsA(&iface_guid, "ROOT\\LEGACY_BOGUS\\foo", NULL, DIGCF_DEVICEINTERFACE);
     ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    check_device_list(set, &GUID_NULL);
     check_device_info(set, 0, &guid, "ROOT\\LEGACY_BOGUS\\FOO");
     check_device_info(set, 1, NULL, NULL);
     check_device_iface(set, NULL, &iface_guid, 0, 0, "\\\\?\\root#legacy_bogus#foo#{deadbeef-3f65-11db-b704-0011955c2bdb}");
@@ -2954,6 +2978,7 @@ todo_wine {
 
     set = SetupDiGetClassDevsA(&iface_guid, "ROOT\\LEGACY_BOGUS\\foo", NULL, DIGCF_DEVICEINTERFACE | DIGCF_ALLCLASSES);
     ok(set != INVALID_HANDLE_VALUE, "Failed to create device list, error %#x.\n", GetLastError());
+    check_device_list(set, &GUID_NULL);
     check_device_info(set, 0, &guid, "ROOT\\LEGACY_BOGUS\\FOO");
 todo_wine
     check_device_info(set, 1, NULL, NULL);




More information about the wine-cvs mailing list