Zebediah Figura : msi: Append the custom action client PID to the endpoint name.

Alexandre Julliard julliard at winehq.org
Mon Mar 25 16:54:57 CDT 2019


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

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Fri Mar 22 21:17:17 2019 -0500

msi: Append the custom action client PID to the endpoint name.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46833
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/msi/custom.c          | 14 ++++++++++----
 dlls/msi/msi.spec          |  2 +-
 programs/msiexec/msiexec.c |  9 +++++----
 3 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/dlls/msi/custom.c b/dlls/msi/custom.c
index 8bf0902..facb1d8 100644
--- a/dlls/msi/custom.c
+++ b/dlls/msi/custom.c
@@ -477,7 +477,7 @@ static void handle_msi_break(LPCSTR target)
 }
 
 static WCHAR ncalrpcW[] = {'n','c','a','l','r','p','c',0};
-static WCHAR endpoint_lrpcW[] = {'m','s','i',0};
+static WCHAR endpoint_fmtW[] = {'m','s','i','%','x',0};
 
 #ifdef __i386__
 /* wrapper for apps that don't declare the thread function correctly */
@@ -502,7 +502,7 @@ static UINT custom_proc_wrapper( MsiCustomActionEntryPoint entry, MSIHANDLE hins
 }
 #endif
 
-UINT CDECL __wine_msi_call_dll_function(const GUID *guid)
+UINT CDECL __wine_msi_call_dll_function(DWORD client_pid, const GUID *guid)
 {
     MsiCustomActionEntryPoint fn;
     MSIHANDLE remote_package = 0;
@@ -519,7 +519,10 @@ UINT CDECL __wine_msi_call_dll_function(const GUID *guid)
 
     if (!rpc_handle)
     {
-        status = RpcStringBindingComposeW(NULL, ncalrpcW, NULL, endpoint_lrpcW, NULL, &binding_str);
+        WCHAR endpoint[12];
+
+        sprintfW(endpoint, endpoint_fmtW, client_pid);
+        status = RpcStringBindingComposeW(NULL, ncalrpcW, NULL, endpoint, NULL, &binding_str);
         if (status != RPC_S_OK)
         {
             ERR("RpcStringBindingCompose failed: %#x\n", status);
@@ -740,8 +743,11 @@ static msi_custom_action_info *do_msidbCustomActionTypeDll(
 
     if (!package->rpc_server_started)
     {
+        WCHAR endpoint[12];
+
+        sprintfW(endpoint, endpoint_fmtW, GetCurrentProcessId());
         status = RpcServerUseProtseqEpW(ncalrpcW, RPC_C_PROTSEQ_MAX_REQS_DEFAULT,
-            endpoint_lrpcW, NULL);
+            endpoint, NULL);
         if (status != RPC_S_OK)
         {
             ERR("RpcServerUseProtseqEp failed: %#x\n", status);
diff --git a/dlls/msi/msi.spec b/dlls/msi/msi.spec
index aecba1b..eeb9ea7 100644
--- a/dlls/msi/msi.spec
+++ b/dlls/msi/msi.spec
@@ -295,4 +295,4 @@
 @ stdcall -private DllRegisterServer()
 @ stdcall -private DllUnregisterServer()
 
-@ cdecl __wine_msi_call_dll_function(ptr)
+@ cdecl __wine_msi_call_dll_function(long ptr)
diff --git a/programs/msiexec/msiexec.c b/programs/msiexec/msiexec.c
index efbcb5c..3340ade 100644
--- a/programs/msiexec/msiexec.c
+++ b/programs/msiexec/msiexec.c
@@ -397,19 +397,20 @@ static DWORD DoUnregServer(void)
     return ret;
 }
 
-extern UINT CDECL __wine_msi_call_dll_function(GUID *guid);
+extern UINT CDECL __wine_msi_call_dll_function(DWORD client_pid, const GUID *guid);
+
+static DWORD client_pid;
 
 static DWORD CALLBACK custom_action_thread(void *arg)
 {
     GUID guid = *(GUID *)arg;
     heap_free(arg);
-    return __wine_msi_call_dll_function(&guid);
+    return __wine_msi_call_dll_function(client_pid, &guid);
 }
 
 static int custom_action_server(const WCHAR *arg)
 {
     static const WCHAR pipe_name[] = {'\\','\\','.','\\','p','i','p','e','\\','m','s','i','c','a','_','%','x','_','%','d',0};
-    DWORD client_pid = atoiW(arg);
     GUID guid, *thread_guid;
     DWORD64 thread64;
     WCHAR buffer[24];
@@ -419,7 +420,7 @@ static int custom_action_server(const WCHAR *arg)
 
     TRACE("%s\n", debugstr_w(arg));
 
-    if (!client_pid)
+    if (!(client_pid = atoiW(arg)))
     {
         ERR("Invalid parameter %s\n", debugstr_w(arg));
         return 1;




More information about the wine-cvs mailing list