Signed-off-by: Zebediah Figura z.figura12@gmail.com --- 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 71311238c3..41573908ac 100644 --- a/dlls/setupapi/devinst.c +++ b/dlls/setupapi/devinst.c @@ -3715,9 +3715,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: @@ -4593,3 +4594,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 892a8031bf..9ecff232d8 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)