Zebediah Figura : setupapi: Implement SetupDiEnumDriverInfo().

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


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

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

setupapi: Implement SetupDiEnumDriverInfo().

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

---

 dlls/setupapi/devinst.c | 67 +++++++++++++++++++++++++++++++++++++++++++++++++
 dlls/setupapi/stubs.c   | 22 ----------------
 2 files changed, 67 insertions(+), 22 deletions(-)

diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c
index 5ab8b0a..2152ffd 100644
--- a/dlls/setupapi/devinst.c
+++ b/dlls/setupapi/devinst.c
@@ -4258,3 +4258,70 @@ BOOL WINAPI SetupDiBuildDriverInfoList(HDEVINFO devinfo, SP_DEVINFO_DATA *device
 
     return TRUE;
 }
+
+/***********************************************************************
+ *              SetupDiEnumDriverInfoW (SETUPAPI.@)
+ */
+BOOL WINAPI SetupDiEnumDriverInfoW(HDEVINFO devinfo, SP_DEVINFO_DATA *device_data,
+        DWORD type, DWORD index, SP_DRVINFO_DATA_W *driver_data)
+{
+    static const WCHAR providerW[] = {'P','r','o','v','i','d','e','r',0};
+    struct device *device;
+    INFCONTEXT ctx;
+    HINF hinf;
+
+    TRACE("devinfo %p, device_data %p, type %#x, index %u, driver_data %p.\n",
+            devinfo, device_data, type, index, driver_data);
+
+    if (type != SPDIT_COMPATDRIVER)
+    {
+        FIXME("Unhandled type %#x.\n", type);
+        SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+        return FALSE;
+    }
+
+    if (!(device = get_device(devinfo, device_data)))
+        return FALSE;
+
+    if (index >= device->driver_count)
+    {
+        SetLastError(ERROR_NO_MORE_ITEMS);
+        return FALSE;
+    }
+
+    if ((hinf = SetupOpenInfFileW(device->drivers[index].inf_path, NULL, INF_STYLE_WIN4, NULL)) == INVALID_HANDLE_VALUE)
+        return FALSE;
+
+    driver_data->ProviderName[0] = 0;
+    if (SetupFindFirstLineW(hinf, Version, providerW, &ctx))
+        SetupGetStringFieldW(&ctx, 1, driver_data->ProviderName, ARRAY_SIZE(driver_data->ProviderName), NULL);
+    strcpyW(driver_data->Description, device->drivers[index].description);
+    strcpyW(driver_data->MfgName, device->drivers[index].manufacturer);
+    driver_data->DriverType = SPDIT_COMPATDRIVER;
+
+    SetupCloseInfFile(hinf);
+
+    return TRUE;
+}
+
+/***********************************************************************
+ *              SetupDiEnumDriverInfoA (SETUPAPI.@)
+ */
+BOOL WINAPI SetupDiEnumDriverInfoA(HDEVINFO devinfo, SP_DEVINFO_DATA *device_data,
+        DWORD type, DWORD index, SP_DRVINFO_DATA_A *driver_data)
+{
+    SP_DRVINFO_DATA_W driver_dataW;
+    BOOL ret;
+
+    driver_dataW.cbSize = sizeof(driver_dataW);
+    ret = SetupDiEnumDriverInfoW(devinfo, device_data, type, index, &driver_dataW);
+    driver_data->DriverType = driver_dataW.DriverType;
+    driver_data->Reserved = driver_dataW.Reserved;
+    WideCharToMultiByte(CP_ACP, 0, driver_dataW.Description, -1, driver_data->Description,
+            sizeof(driver_data->Description), NULL, NULL);
+    WideCharToMultiByte(CP_ACP, 0, driver_dataW.MfgName, -1, driver_data->MfgName,
+            sizeof(driver_data->MfgName), NULL, NULL);
+    WideCharToMultiByte(CP_ACP, 0, driver_dataW.ProviderName, -1, driver_data->ProviderName,
+            sizeof(driver_data->ProviderName), NULL, NULL);
+    return ret;
+}
diff --git a/dlls/setupapi/stubs.c b/dlls/setupapi/stubs.c
index 1be10ce..c2ac2a4 100644
--- a/dlls/setupapi/stubs.c
+++ b/dlls/setupapi/stubs.c
@@ -642,28 +642,6 @@ BOOL WINAPI SetupDiSetSelectedDevice(HDEVINFO SetupDiSetSelectedDevice, PSP_DEVI
 }
 
 /***********************************************************************
- *              SetupDiEnumDriverInfoA  (SETUPAPI.@)
- */
-BOOL WINAPI SetupDiEnumDriverInfoA(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD DriverType, DWORD MemberIndex, PSP_DRVINFO_DATA_A DriverInfoData)
-{
-    FIXME("(%p, %p, 0x%x, %u, %p stub\n", DeviceInfoSet, DeviceInfoData, DriverType, MemberIndex, DriverInfoData);
-
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return FALSE;
-}
-
-/***********************************************************************
- *              SetupDiEnumDriverInfoW  (SETUPAPI.@)
- */
-BOOL WINAPI SetupDiEnumDriverInfoW(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, DWORD DriverType, DWORD MemberIndex, PSP_DRVINFO_DATA_W DriverInfoData)
-{
-    FIXME("(%p, %p, 0x%x, %u, %p stub\n", DeviceInfoSet, DeviceInfoData, DriverType, MemberIndex, DriverInfoData);
-
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return FALSE;
-}
-
-/***********************************************************************
  *              CM_Request_Device_EjectA  (SETUPAPI.@)
  */
 CONFIGRET WINAPI CM_Request_Device_EjectA(DEVINST dev, PPNP_VETO_TYPE type, LPSTR name, ULONG length, ULONG flags)




More information about the wine-cvs mailing list