Zebediah Figura : setupapi: Implement SetupDiGetDeviceInstallParams().

Alexandre Julliard julliard at winehq.org
Thu May 16 16:26:57 CDT 2019


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

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Wed May 15 22:56:06 2019 -0500

setupapi: Implement SetupDiGetDeviceInstallParams().

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

---

 dlls/setupapi/devinst.c | 62 +++++++++++++++++++++++++++++++++++++------------
 1 file changed, 47 insertions(+), 15 deletions(-)

diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c
index 7440465..8c91960 100644
--- a/dlls/setupapi/devinst.c
+++ b/dlls/setupapi/devinst.c
@@ -118,6 +118,7 @@ struct device
     DEVINST               devnode;
     struct list           entry;
     BOOL                  removed;
+    SP_DEVINSTALL_PARAMS_W params;
 };
 
 struct device_iface
@@ -730,7 +731,7 @@ static struct device *SETUPDI_CreateDeviceInfo(struct DeviceInfoSet *set,
     TRACE("%p, %s, %s, %d\n", set, debugstr_guid(class),
         debugstr_w(instanceid), phantom);
 
-    if (!(device = heap_alloc(sizeof(*device))))
+    if (!(device = heap_alloc_zero(sizeof(*device))))
     {
         SetLastError(ERROR_OUTOFMEMORY);
         return NULL;
@@ -752,6 +753,7 @@ static struct device *SETUPDI_CreateDeviceInfo(struct DeviceInfoSet *set,
     device->devnode = alloc_devnode(device);
     device->removed = FALSE;
     list_add_tail(&set->devices, &device->entry);
+    device->params.cbSize = sizeof(SP_DEVINSTALL_PARAMS_W);
 
     if (phantom)
         RegSetValueExW(device->key, Phantom, 0, REG_DWORD, (const BYTE *)&one, sizeof(one));
@@ -3501,27 +3503,57 @@ BOOL WINAPI SetupDiCallClassInstaller(
 }
 
 /***********************************************************************
- *		SetupDiGetDeviceInstallParamsW (SETUPAPI.@)
+ *              SetupDiGetDeviceInstallParamsW (SETUPAPI.@)
  */
-BOOL WINAPI SetupDiGetDeviceInstallParamsW(
-       HDEVINFO DeviceInfoSet,
-       PSP_DEVINFO_DATA DeviceInfoData,
-       PSP_DEVINSTALL_PARAMS_W DeviceInstallParams)
+BOOL WINAPI SetupDiGetDeviceInstallParamsW(HDEVINFO devinfo,
+        SP_DEVINFO_DATA *device_data, SP_DEVINSTALL_PARAMS_W *params)
 {
-    FIXME("%p %p %p\n", DeviceInfoSet, DeviceInfoData, DeviceInstallParams);
-    return FALSE;
+    struct device *device;
+
+    TRACE("devinfo %p, device_data %p, params %p.\n", devinfo, device_data, params);
+
+    if (params->cbSize != sizeof(SP_DEVINSTALL_PARAMS_W))
+    {
+        SetLastError(ERROR_INVALID_USER_BUFFER);
+        return FALSE;
+    }
+
+    if (!(device = get_device(devinfo, device_data)))
+        return FALSE;
+
+    *params = device->params;
+
+    return TRUE;
 }
 
 /***********************************************************************
- *		SetupDiGetDeviceInstallParamsA (SETUPAPI.@)
+ *              SetupDiGetDeviceInstallParamsA (SETUPAPI.@)
  */
-BOOL WINAPI SetupDiGetDeviceInstallParamsA(
-       HDEVINFO DeviceInfoSet,
-       PSP_DEVINFO_DATA DeviceInfoData,
-       PSP_DEVINSTALL_PARAMS_A DeviceInstallParams)
+BOOL WINAPI SetupDiGetDeviceInstallParamsA(HDEVINFO devinfo,
+        SP_DEVINFO_DATA *device_data, SP_DEVINSTALL_PARAMS_A *params)
 {
-    FIXME("%p %p %p\n", DeviceInfoSet, DeviceInfoData, DeviceInstallParams);
-    return FALSE;
+    SP_DEVINSTALL_PARAMS_W paramsW;
+    BOOL ret;
+
+    if (params->cbSize != sizeof(SP_DEVINSTALL_PARAMS_A))
+    {
+        SetLastError(ERROR_INVALID_USER_BUFFER);
+        return FALSE;
+    }
+
+    paramsW.cbSize = sizeof(paramsW);
+    ret = SetupDiGetDeviceInstallParamsW(devinfo, device_data, &paramsW);
+    params->Flags = paramsW.Flags;
+    params->FlagsEx = paramsW.FlagsEx;
+    params->hwndParent = paramsW.hwndParent;
+    params->InstallMsgHandler = paramsW.InstallMsgHandler;
+    params->InstallMsgHandlerContext = paramsW.InstallMsgHandlerContext;
+    params->FileQueue = paramsW.FileQueue;
+    params->ClassInstallReserved = paramsW.ClassInstallReserved;
+    params->Reserved = paramsW.Reserved;
+    WideCharToMultiByte(CP_ACP, 0, paramsW.DriverPath, -1, params->DriverPath, sizeof(params->DriverPath), NULL, NULL);
+
+    return ret;
 }
 
 /***********************************************************************




More information about the wine-cvs mailing list