[PATCH 4/7] setupapi: Process the .Services subsection in SetupDiInstallDevice().

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


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

diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c
index f9abf3a303b..877286e2aae 100644
--- a/dlls/setupapi/devinst.c
+++ b/dlls/setupapi/devinst.c
@@ -4729,6 +4729,8 @@ BOOL WINAPI SetupDiInstallDevice(HDEVINFO devinfo, SP_DEVINFO_DATA *device_data)
     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};
     static const WCHAR dothwW[] = {'.','H','W',0};
+    static const WCHAR dotservicesW[] = {'.','S','e','r','v','i','c','e','s',0};
+    static const WCHAR addserviceW[] = {'A','d','d','S','e','r','v','i','c','e',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;
@@ -4788,6 +4790,26 @@ BOOL WINAPI SetupDiInstallDevice(HDEVINFO devinfo, SP_DEVINFO_DATA *device_data)
     SetupInstallFromInfSectionW(NULL, hinf, subsection, install_flags, device_key, NULL,
             SP_COPY_NEWER_ONLY, SetupDefaultQueueCallbackW, callback_ctx, NULL, NULL);
 
+    strcpyW(subsection, section_ext);
+    strcatW(subsection, dotservicesW);
+    SetupInstallServicesFromInfSectionW(hinf, subsection, 0);
+
+    if (SetupFindFirstLineW(hinf, subsection, addserviceW, &ctx))
+    {
+        do
+        {
+            INT flags;
+
+            if (SetupGetIntField(&ctx, 2, &flags) && (flags & SPSVCINST_ASSOCSERVICE))
+            {
+                WCHAR svc_name[LINE_LEN];
+                if (SetupGetStringFieldW(&ctx, 1, svc_name, ARRAY_SIZE(svc_name), NULL) && svc_name[0])
+                    RegSetValueExW(device->key, Service, 0, REG_SZ, (BYTE *)svc_name, strlenW(svc_name) * sizeof(WCHAR));
+                break;
+            }
+        } while (SetupFindNextMatchLineW(&ctx, addserviceW, &ctx));
+    }
+
     SetupTermDefaultQueueCallback(callback_ctx);
     SetupCloseInfFile(hinf);
 
-- 
2.21.0




More information about the wine-devel mailing list