Erich E. Hoover : ddraw: Make DirectDrawEnumerateEx only enumerate secondary display devices when requested.

Alexandre Julliard julliard at winehq.org
Thu Jan 9 12:52:50 CST 2014


Module: wine
Branch: master
Commit: 639f9335c2405832b9962a4bc5b95b053bf596a9
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=639f9335c2405832b9962a4bc5b95b053bf596a9

Author: Erich E. Hoover <erich.e.hoover at gmail.com>
Date:   Wed Jan  8 15:02:28 2014 -0700

ddraw: Make DirectDrawEnumerateEx only enumerate secondary display devices when requested.

---

 dlls/ddraw/main.c |   61 +++++++++++++++++++++++++++++++----------------------
 1 file changed, 36 insertions(+), 25 deletions(-)

diff --git a/dlls/ddraw/main.c b/dlls/ddraw/main.c
index e613126..2e61b0c 100644
--- a/dlls/ddraw/main.c
+++ b/dlls/ddraw/main.c
@@ -59,6 +59,36 @@ static HRESULT CALLBACK enum_callback(GUID *guid, char *description, char *drive
     return info->callback(guid, description, driver_name, info->context);
 }
 
+static void ddraw_enumerate_secondary_devices(struct wined3d *wined3d, LPDDENUMCALLBACKEXA callback,
+                                              void *context)
+{
+    static CHAR driver_desc[] = "DirectDraw HAL";
+    struct wined3d_adapter_identifier adapter_id;
+    BOOL cont_enum = TRUE;
+    HRESULT hr = S_OK;
+    UINT adapter = 0;
+
+    for (adapter = 0; SUCCEEDED(hr) && cont_enum; adapter++)
+    {
+        char DriverName[512] = "";
+
+        /* The Battle.net System Checker expects the GetAdapterIdentifier DeviceName to match the
+         * Driver Name, so obtain the DeviceName and GUID from D3D. */
+        memset(&adapter_id, 0x0, sizeof(adapter_id));
+        adapter_id.device_name = DriverName;
+        adapter_id.device_name_size = sizeof(DriverName);
+        wined3d_mutex_lock();
+        hr = wined3d_get_adapter_identifier(wined3d, adapter, 0x0, &adapter_id);
+        wined3d_mutex_unlock();
+        if (SUCCEEDED(hr))
+        {
+            TRACE("Interface %d: %s\n", adapter, wine_dbgstr_guid(&adapter_id.device_identifier));
+            cont_enum = callback(&adapter_id.device_identifier, driver_desc, adapter_id.device_name,
+                                 context, 0);
+        }
+    }
+}
+
 /* Handle table functions */
 BOOL ddraw_handle_table_init(struct ddraw_handle_table *t, UINT initial_size)
 {
@@ -373,8 +403,8 @@ HRESULT WINAPI DirectDrawEnumerateExA(LPDDENUMCALLBACKEXA callback, void *contex
                   DDENUM_NONDISPLAYDEVICES))
         return DDERR_INVALIDPARAMS;
 
-    if (flags)
-        FIXME("flags 0x%08x not handled\n", flags);
+    if (flags & ~DDENUM_ATTACHEDSECONDARYDEVICES)
+        FIXME("flags 0x%08x not handled\n", flags & ~DDENUM_ATTACHEDSECONDARYDEVICES);
 
     TRACE("Enumerating ddraw interfaces\n");
     if (!(wined3d = wined3d_create(7, WINED3D_LEGACY_DEPTH_BIAS)))
@@ -393,33 +423,14 @@ HRESULT WINAPI DirectDrawEnumerateExA(LPDDENUMCALLBACKEXA callback, void *contex
         /* QuickTime expects the description "DirectDraw HAL" */
         static CHAR driver_desc[] = "DirectDraw HAL",
         driver_name[] = "display";
-        struct wined3d_adapter_identifier adapter_id;
-        HRESULT hr = S_OK;
-        UINT adapter = 0;
         BOOL cont_enum;
 
-        /* The Battle.net System Checker expects both a NULL device and a GUID-based device */
         TRACE("Default interface: DirectDraw HAL\n");
         cont_enum = callback(NULL, driver_desc, driver_name, context, 0);
-        for (adapter = 0; SUCCEEDED(hr) && cont_enum; adapter++)
-        {
-            char DriverName[512] = "";
-
-            /* The Battle.net System Checker expects the GetAdapterIdentifier DeviceName to match the
-             * Driver Name, so obtain the DeviceName and GUID from D3D. */
-            memset(&adapter_id, 0x0, sizeof(adapter_id));
-            adapter_id.device_name = DriverName;
-            adapter_id.device_name_size = sizeof(DriverName);
-            wined3d_mutex_lock();
-            hr = wined3d_get_adapter_identifier(wined3d, adapter, 0x0, &adapter_id);
-            wined3d_mutex_unlock();
-            if (SUCCEEDED(hr))
-            {
-                TRACE("Interface %d: %s\n", adapter, wine_dbgstr_guid(&adapter_id.device_identifier));
-                cont_enum = callback(&adapter_id.device_identifier, driver_desc,
-                                     adapter_id.device_name, context, 0);
-            }
-        }
+
+        /* The Battle.net System Checker expects both a NULL device and a GUID-based device */
+        if (cont_enum && (flags & ~DDENUM_ATTACHEDSECONDARYDEVICES))
+            ddraw_enumerate_secondary_devices(wined3d, callback, context);
     }
     __EXCEPT_PAGE_FAULT
     {




More information about the wine-cvs mailing list