Zebediah Figura : setupapi: Add a semi-stub implementation of SetupDiSelectBestCompatDrv().

Alexandre Julliard julliard at winehq.org
Tue May 21 16:45:22 CDT 2019


Module: wine
Branch: master
Commit: 9fa4a2af1cb1b17c78f46e7d571620bc310faf4e
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=9fa4a2af1cb1b17c78f46e7d571620bc310faf4e

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Mon May 20 23:55:49 2019 -0500

setupapi: Add a semi-stub implementation of SetupDiSelectBestCompatDrv().

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 2152ffd..9b83c35 100644
--- a/dlls/setupapi/devinst.c
+++ b/dlls/setupapi/devinst.c
@@ -4325,3 +4325,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 c2ac2a4..e6d1f1a 100644
--- a/dlls/setupapi/stubs.c
+++ b/dlls/setupapi/stubs.c
@@ -621,17 +621,6 @@ BOOL WINAPI SetupDiLoadClassIcon(const GUID *ClassGuid, HICON *LargeIcon, PINT M
 }
 
 /***********************************************************************
- *              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.@)
  */
 BOOL WINAPI SetupDiSetSelectedDevice(HDEVINFO SetupDiSetSelectedDevice, PSP_DEVINFO_DATA DeviceInfoData)




More information about the wine-cvs mailing list