Zebediah Figura : setupapi: Implement SetupDiInstallDriverFiles().

Alexandre Julliard julliard at winehq.org
Thu May 23 16:04:39 CDT 2019


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

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Wed May 22 22:55:53 2019 -0500

setupapi: Implement SetupDiInstallDriverFiles().

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

---

 dlls/setupapi/devinst.c     | 43 ++++++++++++++++++++++++++++++++++++++++++-
 dlls/setupapi/setupapi.spec |  2 +-
 2 files changed, 43 insertions(+), 2 deletions(-)

diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c
index 07288e5..9903c48 100644
--- a/dlls/setupapi/devinst.c
+++ b/dlls/setupapi/devinst.c
@@ -3674,9 +3674,10 @@ BOOL WINAPI SetupDiCallClassInstaller(DI_FUNCTION function, HDEVINFO devinfo, SP
             return SetupDiSelectBestCompatDrv(devinfo, device_data);
         case DIF_REGISTER_COINSTALLERS:
             return SetupDiRegisterCoDeviceInstallers(devinfo, device_data);
+        case DIF_INSTALLDEVICEFILES:
+            return SetupDiInstallDriverFiles(devinfo, device_data);
         case DIF_FINISHINSTALL_ACTION:
         case DIF_INSTALLDEVICE:
-        case DIF_INSTALLDEVICEFILES:
         case DIF_INSTALLINTERFACES:
         case DIF_PROPERTYCHANGE:
         case DIF_SELECTDEVICE:
@@ -4552,3 +4553,43 @@ BOOL WINAPI SetupDiSelectBestCompatDrv(HDEVINFO devinfo, SP_DEVINFO_DATA *device
 
     return TRUE;
 }
+
+/***********************************************************************
+ *              SetupDiInstallDriverFiles (SETUPAPI.@)
+ */
+BOOL WINAPI SetupDiInstallDriverFiles(HDEVINFO devinfo, SP_DEVINFO_DATA *device_data)
+{
+    WCHAR section[LINE_LEN], section_ext[LINE_LEN];
+    struct device *device;
+    struct driver *driver;
+    void *callback_ctx;
+    INFCONTEXT ctx;
+    HINF hinf;
+
+    TRACE("devinfo %p, device_data %p.\n", devinfo, device_data);
+
+    if (!(device = get_device(devinfo, device_data)))
+        return FALSE;
+
+    if (!(driver = device->selected_driver))
+    {
+        ERR("No driver selected for device %p.\n", devinfo);
+        SetLastError(ERROR_NO_DRIVER_SELECTED);
+        return FALSE;
+    }
+
+    if ((hinf = SetupOpenInfFileW(driver->inf_path, NULL, INF_STYLE_WIN4, NULL)) == INVALID_HANDLE_VALUE)
+        return FALSE;
+
+    SetupFindFirstLineW(hinf, driver->mfg_key, driver->description, &ctx);
+    SetupGetStringFieldW(&ctx, 1, section, ARRAY_SIZE(section), NULL);
+    SetupDiGetActualSectionToInstallW(hinf, section, section_ext, ARRAY_SIZE(section_ext), NULL, NULL);
+
+    callback_ctx = SetupInitDefaultQueueCallback(NULL);
+    SetupInstallFromInfSectionW(NULL, hinf, section_ext, SPINST_FILES, NULL, NULL,
+            SP_COPY_NEWER_ONLY, SetupDefaultQueueCallbackW, callback_ctx, NULL, NULL);
+    SetupTermDefaultQueueCallback(callback_ctx);
+
+    SetupCloseInfFile(hinf);
+    return TRUE;
+}
diff --git a/dlls/setupapi/setupapi.spec b/dlls/setupapi/setupapi.spec
index 1d18870..97347f5 100644
--- a/dlls/setupapi/setupapi.spec
+++ b/dlls/setupapi/setupapi.spec
@@ -368,7 +368,7 @@
 @ stdcall SetupDiInstallClassW(long wstr long ptr)
 @ stub SetupDiInstallDevice
 @ stdcall SetupDiInstallDeviceInterfaces(ptr ptr)
-@ stub SetupDiInstallDriverFiles
+@ stdcall SetupDiInstallDriverFiles(ptr ptr)
 @ stdcall SetupDiLoadClassIcon(ptr ptr ptr)
 @ stub SetupDiMoveDuplicateDevice
 @ stdcall SetupDiOpenClassRegKey(ptr long)




More information about the wine-cvs mailing list