[PATCH 3/7] setupapi: Process the .HW subsection in SetupDiInstallDevice().

Zebediah Figura z.figura12 at gmail.com
Fri May 24 23:33:54 CDT 2019


Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 dlls/setupapi/devinst.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c
index f565fec3590..f9abf3a303b 100644
--- a/dlls/setupapi/devinst.c
+++ b/dlls/setupapi/devinst.c
@@ -4728,12 +4728,13 @@ BOOL WINAPI SetupDiInstallDevice(HDEVINFO devinfo, SP_DEVINFO_DATA *device_data)
     static const WCHAR infpathW[] = {'I','n','f','P','a','t','h',0};
     static const WCHAR infsectionW[] = {'I','n','f','S','e','c','t','i','o','n',0};
     static const WCHAR infsectionextW[] = {'I','n','f','S','e','c','t','i','o','n','E','x','t',0};
-    WCHAR section[LINE_LEN], section_ext[LINE_LEN], inf_path[MAX_PATH], *extptr, *filepart;
+    static const WCHAR dothwW[] = {'.','H','W',0};
+    WCHAR section[LINE_LEN], section_ext[LINE_LEN], subsection[LINE_LEN], inf_path[MAX_PATH], *extptr, *filepart;
     UINT install_flags = SPINST_ALL;
+    HKEY driver_key, device_key;
     struct device *device;
     struct driver *driver;
     void *callback_ctx;
-    HKEY driver_key;
     INFCONTEXT ctx;
     HINF hinf;
     LONG l;
@@ -4764,6 +4765,15 @@ BOOL WINAPI SetupDiInstallDevice(HDEVINFO devinfo, SP_DEVINFO_DATA *device_data)
         return FALSE;
     }
 
+    if ((l = RegCreateKeyExW(device->key, DeviceParameters, 0, NULL, 0,
+            KEY_READ | KEY_WRITE, NULL, &device_key, NULL)))
+    {
+        SetLastError(l);
+        RegCloseKey(driver_key);
+        SetupCloseInfFile(hinf);
+        return FALSE;
+    }
+
     if (device->params.Flags & DI_NOFILECOPY)
         install_flags &= ~SPINST_FILES;
 
@@ -4772,6 +4782,12 @@ BOOL WINAPI SetupDiInstallDevice(HDEVINFO devinfo, SP_DEVINFO_DATA *device_data)
     SetupInstallFromInfSectionW(NULL, hinf, section_ext, install_flags, driver_key, NULL,
             SP_COPY_NEWER_ONLY, SetupDefaultQueueCallbackW, callback_ctx, NULL, NULL);
 
+    strcpyW(subsection, section_ext);
+    strcatW(subsection, dothwW);
+
+    SetupInstallFromInfSectionW(NULL, hinf, subsection, install_flags, device_key, NULL,
+            SP_COPY_NEWER_ONLY, SetupDefaultQueueCallbackW, callback_ctx, NULL, NULL);
+
     SetupTermDefaultQueueCallback(callback_ctx);
     SetupCloseInfFile(hinf);
 
@@ -4783,6 +4799,7 @@ BOOL WINAPI SetupDiInstallDevice(HDEVINFO devinfo, SP_DEVINFO_DATA *device_data)
     if (extptr)
         RegSetValueExW(driver_key, infsectionextW, 0, REG_SZ, (BYTE *)extptr, strlenW(extptr) * sizeof(WCHAR));
 
+    RegCloseKey(device_key);
     RegCloseKey(driver_key);
     return TRUE;
 }
-- 
2.21.0




More information about the wine-devel mailing list