[PATCH 3/3] gdi32/tests: Add test for GUID_DISPLAY_DEVICE_ARRIVAL device interface presence.

Paul Gofman pgofman at codeweavers.com
Mon Sep 6 06:51:52 CDT 2021


Signed-off-by: Paul Gofman <pgofman at codeweavers.com>
---
 dlls/gdi32/tests/Makefile.in |  2 +-
 dlls/gdi32/tests/driver.c    | 33 +++++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+), 1 deletion(-)

diff --git a/dlls/gdi32/tests/Makefile.in b/dlls/gdi32/tests/Makefile.in
index 876f6a376a2..3eb478ff765 100644
--- a/dlls/gdi32/tests/Makefile.in
+++ b/dlls/gdi32/tests/Makefile.in
@@ -1,5 +1,5 @@
 TESTDLL   = gdi32.dll
-IMPORTS   = user32 gdi32 advapi32
+IMPORTS   = setupapi user32 gdi32 advapi32
 
 C_SRCS = \
 	bitmap.c \
diff --git a/dlls/gdi32/tests/driver.c b/dlls/gdi32/tests/driver.c
index eb0da18b32e..1b00aa32a73 100644
--- a/dlls/gdi32/tests/driver.c
+++ b/dlls/gdi32/tests/driver.c
@@ -29,6 +29,10 @@
 #include "winternl.h"
 #include "dwmapi.h"
 #include "ddk/d3dkmthk.h"
+#include "initguid.h"
+#include "ntddvdeo.h"
+#include "devguid.h"
+#include "setupapi.h"
 
 #include "wine/test.h"
 
@@ -789,6 +793,34 @@ static void test_D3DKMTCheckOcclusion(void)
     DestroyWindow(hwnd);
 }
 
+static void test_device_interfaces(void)
+{
+    SP_DEVINFO_DATA device_data = {sizeof(device_data)};
+    SP_DEVICE_INTERFACE_DATA iface = {sizeof(iface)};
+    unsigned int i;
+    HDEVINFO set;
+    BOOL ret;
+
+    set = SetupDiGetClassDevsW(&GUID_DISPLAY_DEVICE_ARRIVAL, NULL, NULL, DIGCF_DEVICEINTERFACE);
+    ok(set != INVALID_HANDLE_VALUE, "SetupDiGetClassDevs failed, error %u.\n", GetLastError());
+
+    i = 0;
+    while ((ret = SetupDiEnumDeviceInfo(set, i, &device_data)))
+    {
+        ret = SetupDiEnumDeviceInterfaces(set, &device_data, &GUID_DISPLAY_DEVICE_ARRIVAL, 0, &iface);
+        ok(IsEqualGUID(&iface.InterfaceClassGuid, &GUID_DISPLAY_DEVICE_ARRIVAL),
+                "Got unexpected guid %s.\n",
+                wine_dbgstr_guid(&iface.InterfaceClassGuid));
+        ok(ret, "Got unexpected ret %#x, GetLastError() %u.\n", ret, GetLastError());
+        ++i;
+    }
+    ok(!ret && GetLastError() == ERROR_NO_MORE_ITEMS, "Got unexpected ret %#x, GetLastError() %u.\n",
+            ret, GetLastError());
+    ok(i || broken(!i) /* before Win8 */, "Could not find any devices.\n");
+
+    SetupDiDestroyDeviceInfoList(set);
+}
+
 START_TEST(driver)
 {
     HMODULE gdi32 = GetModuleHandleA("gdi32.dll");
@@ -814,6 +846,7 @@ START_TEST(driver)
     test_D3DKMTCheckVidPnExclusiveOwnership();
     test_D3DKMTSetVidPnSourceOwner();
     test_D3DKMTCheckOcclusion();
+    test_device_interfaces();
 
     FreeLibrary(dwmapi);
 }
-- 
2.31.1




More information about the wine-devel mailing list