[PATCH 1/7] ddraw/tests: Pass in device to look for when enumerating.

Jeff Smith whydoubt at gmail.com
Thu Dec 12 23:00:02 CST 2019


This makes it possible to scan for devices other than HAL.

Signed-off-by: Jeff Smith <whydoubt at gmail.com>
---
 dlls/ddraw/tests/ddraw7.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c
index 470464951c..d921746152 100644
--- a/dlls/ddraw/tests/ddraw7.c
+++ b/dlls/ddraw/tests/ddraw7.c
@@ -339,10 +339,10 @@ static IDirectDraw7 *create_ddraw(void)
 
 static HRESULT WINAPI enum_devtype_cb(char *desc_str, char *name, D3DDEVICEDESC7 *desc, void *ctx)
 {
-    BOOL *hal_ok = ctx;
-    if (IsEqualGUID(&desc->deviceGUID, &IID_IDirect3DTnLHalDevice))
+    struct { REFCLSID riid; BOOL present; } *device_data = ctx;
+    if (IsEqualGUID(&desc->deviceGUID, device_data->riid))
     {
-        *hal_ok = TRUE;
+        device_data->present = TRUE;
         return DDENUMRET_CANCEL;
     }
     return DDENUMRET_OK;
@@ -357,7 +357,7 @@ static IDirect3DDevice7 *create_device(HWND window, DWORD coop_level)
     IDirectDraw7 *ddraw;
     IDirect3D7 *d3d7;
     HRESULT hr;
-    BOOL hal_ok = FALSE;
+    struct { REFCLSID riid; BOOL present; } device_data = { &IID_IDirect3DTnLHalDevice, FALSE };
     const GUID *devtype = &IID_IDirect3DHALDevice;
 
     if (!(ddraw = create_ddraw()))
@@ -397,9 +397,9 @@ static IDirect3DDevice7 *create_device(HWND window, DWORD coop_level)
         return NULL;
     }
 
-    hr = IDirect3D7_EnumDevices(d3d7, enum_devtype_cb, &hal_ok);
+    hr = IDirect3D7_EnumDevices(d3d7, enum_devtype_cb, &device_data);
     ok(SUCCEEDED(hr), "Failed to enumerate devices, hr %#x.\n", hr);
-    if (hal_ok) devtype = &IID_IDirect3DTnLHalDevice;
+    if (device_data.present) devtype = device_data.riid;
 
     memset(&z_fmt, 0, sizeof(z_fmt));
     hr = IDirect3D7_EnumZBufferFormats(d3d7, devtype, enum_z_fmt, &z_fmt);
@@ -5650,7 +5650,7 @@ static void test_rt_caps(void)
     PALETTEENTRY palette_entries[256];
     IDirectDrawPalette *palette;
     IDirectDraw7 *ddraw;
-    BOOL hal_ok = FALSE;
+    struct { REFCLSID riid; BOOL present; } device_data = { &IID_IDirect3DTnLHalDevice, FALSE };
     DDPIXELFORMAT z_fmt;
     IDirect3D7 *d3d;
     unsigned int i;
@@ -5848,10 +5848,10 @@ static void test_rt_caps(void)
         goto done;
     }
 
-    hr = IDirect3D7_EnumDevices(d3d, enum_devtype_cb, &hal_ok);
+    hr = IDirect3D7_EnumDevices(d3d, enum_devtype_cb, &device_data);
     ok(SUCCEEDED(hr), "Failed to enumerate devices, hr %#x.\n", hr);
-    if (hal_ok)
-        devtype = &IID_IDirect3DTnLHalDevice;
+    if (device_data.present)
+        devtype = device_data.riid;
 
     memset(&z_fmt, 0, sizeof(z_fmt));
     hr = IDirect3D7_EnumZBufferFormats(d3d, devtype, enum_z_fmt, &z_fmt);
@@ -6133,7 +6133,7 @@ static void test_surface_lock(void)
     DDSURFACEDESC2 ddsd;
     ULONG refcount;
     DDPIXELFORMAT z_fmt;
-    BOOL hal_ok = FALSE;
+    struct { REFCLSID riid; BOOL present; } device_data = { &IID_IDirect3DTnLHalDevice, FALSE };
     const GUID *devtype = &IID_IDirect3DHALDevice;
     D3DDEVICEDESC7 device_desc;
     BOOL cubemap_supported;
@@ -6254,10 +6254,10 @@ static void test_surface_lock(void)
         goto done;
     }
 
-    hr = IDirect3D7_EnumDevices(d3d, enum_devtype_cb, &hal_ok);
+    hr = IDirect3D7_EnumDevices(d3d, enum_devtype_cb, &device_data);
     ok(SUCCEEDED(hr), "Failed to enumerate devices, hr %#x.\n", hr);
-    if (hal_ok)
-        devtype = &IID_IDirect3DTnLHalDevice;
+    if (device_data.present)
+        devtype = device_data.riid;
 
     memset(&z_fmt, 0, sizeof(z_fmt));
     hr = IDirect3D7_EnumZBufferFormats(d3d, devtype, enum_z_fmt, &z_fmt);
-- 
2.23.0




More information about the wine-devel mailing list