Zebediah Figura : setupapi: Initialize COM if necessary when registering DLLs.

Alexandre Julliard julliard at winehq.org
Tue Feb 11 15:44:53 CST 2020


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

Author: Zebediah Figura <zfigura at codeweavers.com>
Date:   Mon Feb 10 14:41:31 2020 -0600

setupapi: Initialize COM if necessary when registering DLLs.

Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/setupapi/install.c       | 14 ++++++++++++++
 dlls/setupapi/tests/install.c |  2 +-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/dlls/setupapi/install.c b/dlls/setupapi/install.c
index e166754168..86390b5a41 100644
--- a/dlls/setupapi/install.c
+++ b/dlls/setupapi/install.c
@@ -1125,6 +1125,7 @@ BOOL WINAPI SetupInstallFromInfSectionW( HWND owner, HINF hinf, PCWSTR section,
     if (flags & SPINST_REGSVR)
     {
         struct register_dll_info info;
+        HRESULT hr;
 
         info.unregister    = FALSE;
         info.modules_size  = 0;
@@ -1142,14 +1143,21 @@ BOOL WINAPI SetupInstallFromInfSectionW( HWND owner, HINF hinf, PCWSTR section,
         else
             return FALSE;
 
+        hr = CoInitialize(NULL);
+
         ret = iterate_section_fields( hinf, section, RegisterDlls, register_dlls_callback, &info );
         for (i = 0; i < info.modules_count; i++) FreeLibrary( info.modules[i] );
+
+        if (SUCCEEDED(hr))
+            CoUninitialize();
+
         HeapFree( GetProcessHeap(), 0, info.modules );
         if (!ret) return FALSE;
     }
     if (flags & SPINST_UNREGSVR)
     {
         struct register_dll_info info;
+        HRESULT hr;
 
         info.unregister    = TRUE;
         info.modules_size  = 0;
@@ -1162,8 +1170,14 @@ BOOL WINAPI SetupInstallFromInfSectionW( HWND owner, HINF hinf, PCWSTR section,
         }
         else info.callback = NULL;
 
+        hr = CoInitialize(NULL);
+
         ret = iterate_section_fields( hinf, section, UnregisterDlls, register_dlls_callback, &info );
         for (i = 0; i < info.modules_count; i++) FreeLibrary( info.modules[i] );
+
+        if (SUCCEEDED(hr))
+            CoUninitialize();
+
         HeapFree( GetProcessHeap(), 0, info.modules );
         if (!ret) return FALSE;
     }
diff --git a/dlls/setupapi/tests/install.c b/dlls/setupapi/tests/install.c
index b918bb21f6..8a2f9eec35 100644
--- a/dlls/setupapi/tests/install.c
+++ b/dlls/setupapi/tests/install.c
@@ -2092,7 +2092,7 @@ static void test_register_dlls(void)
     ok(ret, "Failed to install, error %#x.\n", GetLastError());
 
     l = RegOpenKeyA(HKEY_CURRENT_USER, "winetest_setupapi_selfreg", &key);
-    todo_wine ok(!l, "Got error %u.\n", l);
+    ok(!l, "Got error %u.\n", l);
     RegCloseKey(key);
 
     ret = SetupInstallFromInfSectionA(NULL, hinf, "DefaultInstall", SPINST_UNREGSVR,




More information about the wine-cvs mailing list