Zebediah Figura : setupapi: Add a basic implementation of SetupDiInstallDevice().
Alexandre Julliard
julliard at winehq.org
Mon May 27 14:50:19 CDT 2019
Module: wine
Branch: master
Commit: dc9c4221bd08ddc398593bae5307c9761a750dca
URL: https://source.winehq.org/git/wine.git/?a=commit;h=dc9c4221bd08ddc398593bae5307c9761a750dca
Author: Zebediah Figura <z.figura12 at gmail.com>
Date: Fri May 24 23:33:52 2019 -0500
setupapi: Add a basic implementation of SetupDiInstallDevice().
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/setupapi/devinst.c | 58 ++++++++++++++++++++++++++++++++++++++++++++-
dlls/setupapi/setupapi.spec | 2 +-
2 files changed, 58 insertions(+), 2 deletions(-)
diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c
index 864e6dd..f60fd53 100644
--- a/dlls/setupapi/devinst.c
+++ b/dlls/setupapi/devinst.c
@@ -3684,8 +3684,9 @@ BOOL WINAPI SetupDiCallClassInstaller(DI_FUNCTION function, HDEVINFO devinfo, SP
return SetupDiInstallDriverFiles(devinfo, device_data);
case DIF_INSTALLINTERFACES:
return SetupDiInstallDeviceInterfaces(devinfo, device_data);
- case DIF_FINISHINSTALL_ACTION:
case DIF_INSTALLDEVICE:
+ return SetupDiInstallDevice(devinfo, device_data);
+ case DIF_FINISHINSTALL_ACTION:
case DIF_PROPERTYCHANGE:
case DIF_SELECTDEVICE:
case DIF_UNREMOVE:
@@ -4677,3 +4678,58 @@ BOOL WINAPI SetupDiInstallDriverFiles(HDEVINFO devinfo, SP_DEVINFO_DATA *device_
SetupCloseInfFile(hinf);
return TRUE;
}
+
+/***********************************************************************
+ * SetupDiInstallDevice (SETUPAPI.@)
+ */
+BOOL WINAPI SetupDiInstallDevice(HDEVINFO devinfo, SP_DEVINFO_DATA *device_data)
+{
+ WCHAR section[LINE_LEN], section_ext[LINE_LEN];
+ UINT install_flags = SPINST_ALL;
+ struct device *device;
+ struct driver *driver;
+ void *callback_ctx;
+ HKEY driver_key;
+ INFCONTEXT ctx;
+ HINF hinf;
+ LONG l;
+
+ 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);
+
+ if ((l = create_driver_key(device, &driver_key)))
+ {
+ SetLastError(l);
+ SetupCloseInfFile(hinf);
+ return FALSE;
+ }
+
+ if (device->params.Flags & DI_NOFILECOPY)
+ install_flags &= ~SPINST_FILES;
+
+ callback_ctx = SetupInitDefaultQueueCallback(NULL);
+
+ SetupInstallFromInfSectionW(NULL, hinf, section_ext, install_flags, driver_key, NULL,
+ SP_COPY_NEWER_ONLY, SetupDefaultQueueCallbackW, callback_ctx, NULL, NULL);
+
+ SetupTermDefaultQueueCallback(callback_ctx);
+ SetupCloseInfFile(hinf);
+ RegCloseKey(driver_key);
+ return TRUE;
+}
diff --git a/dlls/setupapi/setupapi.spec b/dlls/setupapi/setupapi.spec
index 97347f5..81256a3 100644
--- a/dlls/setupapi/setupapi.spec
+++ b/dlls/setupapi/setupapi.spec
@@ -366,7 +366,7 @@
@ stub SetupDiInstallClassExA
@ stub SetupDiInstallClassExW
@ stdcall SetupDiInstallClassW(long wstr long ptr)
-@ stub SetupDiInstallDevice
+@ stdcall SetupDiInstallDevice(ptr ptr)
@ stdcall SetupDiInstallDeviceInterfaces(ptr ptr)
@ stdcall SetupDiInstallDriverFiles(ptr ptr)
@ stdcall SetupDiLoadClassIcon(ptr ptr ptr)
More information about the wine-cvs
mailing list