[PATCH 3/4] msi: Avoid connecting to the RPC server more than once.

Zebediah Figura z.figura12 at gmail.com
Tue Jul 10 05:08:46 CDT 2018


This is a no-op as is, but is necessary as of the next patch in the case of
nested custom actions.

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 dlls/msi/custom.c  | 27 ++++++++++++++-------------
 dlls/msi/package.c |  2 ++
 2 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/dlls/msi/custom.c b/dlls/msi/custom.c
index a6c9785..0fa47bc 100644
--- a/dlls/msi/custom.c
+++ b/dlls/msi/custom.c
@@ -522,19 +522,22 @@ UINT CDECL __wine_msi_call_dll_function(const GUID *guid)
 
     TRACE("%s\n", debugstr_guid( guid ));
 
-    status = RpcStringBindingComposeW(NULL, ncalrpcW, NULL, endpoint_lrpcW, NULL, &binding_str);
-    if (status != RPC_S_OK)
+    if (!rpc_handle)
     {
-        ERR("RpcStringBindingCompose failed: %#x\n", status);
-        return status;
+        status = RpcStringBindingComposeW(NULL, ncalrpcW, NULL, endpoint_lrpcW, NULL, &binding_str);
+        if (status != RPC_S_OK)
+        {
+            ERR("RpcStringBindingCompose failed: %#x\n", status);
+            return status;
+        }
+        status = RpcBindingFromStringBindingW(binding_str, &rpc_handle);
+        if (status != RPC_S_OK)
+        {
+            ERR("RpcBindingFromStringBinding failed: %#x\n", status);
+            return status;
+        }
+        RpcStringFreeW(&binding_str);
     }
-    status = RpcBindingFromStringBindingW(binding_str, &rpc_handle);
-    if (status != RPC_S_OK)
-    {
-        ERR("RpcBindingFromStringBinding failed: %#x\n", status);
-        return status;
-    }
-    RpcStringFreeW(&binding_str);
 
     r = remote_GetActionInfo(guid, &type, &dll, &proc, &remote_package);
     if (r != ERROR_SUCCESS)
@@ -582,8 +585,6 @@ UINT CDECL __wine_msi_call_dll_function(const GUID *guid)
     midl_user_free(dll);
     midl_user_free(proc);
 
-    RpcBindingFree(&rpc_handle);
-
     return r;
 }
 
diff --git a/dlls/msi/package.c b/dlls/msi/package.c
index 9569c4f..1ab52ea 100644
--- a/dlls/msi/package.c
+++ b/dlls/msi/package.c
@@ -344,6 +344,8 @@ static void MSI_FreePackage( MSIOBJECTHDR *arg)
     CloseHandle( package->log_file );
     if (package->rpc_server_started)
         RpcServerUnregisterIf(s_IWineMsiRemote_v0_0_s_ifspec, NULL, FALSE);
+    if (rpc_handle)
+        RpcBindingFree(&rpc_handle);
 
     if (package->delete_on_close) DeleteFileW( package->localfile );
     msi_free( package->localfile );
-- 
2.7.4




More information about the wine-devel mailing list