[PATCH 7/7] setupapi: Add a semi-stub implementation of SetupDiSelectBestCompatDrv().

Zebediah Figura z.figura12 at gmail.com
Mon May 20 23:55:49 CDT 2019


Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 dlls/setupapi/devinst.c | 26 ++++++++++++++++++++++++++
 dlls/setupapi/stubs.c   | 11 -----------
 2 files changed, 26 insertions(+), 11 deletions(-)

diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c
index 25bde67752..a864cdde73 100644
--- a/dlls/setupapi/devinst.c
+++ b/dlls/setupapi/devinst.c
@@ -4380,3 +4380,29 @@ BOOL WINAPI SetupDiEnumDriverInfoA(HDEVINFO devinfo, SP_DEVINFO_DATA *device_dat
             sizeof(driver_data->ProviderName), NULL, NULL);
     return ret;
 }
+
+/***********************************************************************
+ *              SetupDiSelectBestCompatDrv (SETUPAPI.@)
+ */
+BOOL WINAPI SetupDiSelectBestCompatDrv(HDEVINFO devinfo, SP_DEVINFO_DATA *device_data)
+{
+    struct device *device;
+
+    TRACE("devinfo %p, device_data %p.\n", devinfo, device_data);
+
+    if (!(device = get_device(devinfo, device_data)))
+        return FALSE;
+
+    if (!device->driver_count)
+    {
+        ERR("No compatible drivers were enumerated for device %s.\n", debugstr_w(device->instanceId));
+        SetLastError(ERROR_NO_COMPAT_DRIVERS);
+        return FALSE;
+    }
+
+    WARN("Semi-stub, selecting the first available driver.\n");
+
+    device->selected_driver = &device->drivers[0];
+
+    return TRUE;
+}
diff --git a/dlls/setupapi/stubs.c b/dlls/setupapi/stubs.c
index c2ac2a4892..e6d1f1a0ce 100644
--- a/dlls/setupapi/stubs.c
+++ b/dlls/setupapi/stubs.c
@@ -620,17 +620,6 @@ BOOL WINAPI SetupDiLoadClassIcon(const GUID *ClassGuid, HICON *LargeIcon, PINT M
     return FALSE;
 }
 
-/***********************************************************************
- *              SetupDiSelectBestCompatDrv (SETUPAPI.@)
- */
-BOOL WINAPI SetupDiSelectBestCompatDrv(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData)
-{
-    FIXME(": stub %p, %p\n", DeviceInfoSet, DeviceInfoData);
-
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return FALSE;
-}
-
 /***********************************************************************
  *              SetupDiSetSelectedDevice  (SETUPAPI.@)
  */
-- 
2.21.0




More information about the wine-devel mailing list