[PATCH 6/7] setupapi/tests: Add some tests for SetupDiGetDeviceInfoListDetail().
Zebediah Figura
z.figura12 at gmail.com
Mon May 27 22:13:19 CDT 2019
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
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 2d442bf968f..d7aa43fce2b 100644
--- a/dlls/setupapi/tests/devinst.c
+++ b/dlls/setupapi/tests/devinst.c
@@ -2739,6 +2739,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)};
@@ -2780,6 +2790,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);
@@ -2787,6 +2798,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);
@@ -2796,6 +2808,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);
@@ -2808,6 +2821,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);
@@ -2815,6 +2829,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");
@@ -2827,6 +2842,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");
@@ -2838,6 +2854,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");
@@ -2857,6 +2874,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}");
@@ -2868,6 +2886,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);
@@ -2876,6 +2895,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);
@@ -2888,6 +2908,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}");
@@ -2918,6 +2939,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);
@@ -2930,6 +2952,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);
@@ -2952,6 +2975,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}");
@@ -2962,6 +2986,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);
--
2.21.0
More information about the wine-devel
mailing list