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@gmail.com>
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2019-03-22 21:17:17 -05:00 committed by Alexandre Julliard
parent a3dfd2f251
commit 27a7952a84
3 changed files with 16 additions and 9 deletions

View File

@ -477,7 +477,7 @@ static void handle_msi_break(LPCSTR target)
} }
static WCHAR ncalrpcW[] = {'n','c','a','l','r','p','c',0}; 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__ #ifdef __i386__
/* wrapper for apps that don't declare the thread function correctly */ /* 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 #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; MsiCustomActionEntryPoint fn;
MSIHANDLE remote_package = 0; MSIHANDLE remote_package = 0;
@ -519,7 +519,10 @@ UINT CDECL __wine_msi_call_dll_function(const GUID *guid)
if (!rpc_handle) 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) if (status != RPC_S_OK)
{ {
ERR("RpcStringBindingCompose failed: %#x\n", status); ERR("RpcStringBindingCompose failed: %#x\n", status);
@ -740,8 +743,11 @@ static msi_custom_action_info *do_msidbCustomActionTypeDll(
if (!package->rpc_server_started) if (!package->rpc_server_started)
{ {
WCHAR endpoint[12];
sprintfW(endpoint, endpoint_fmtW, GetCurrentProcessId());
status = RpcServerUseProtseqEpW(ncalrpcW, RPC_C_PROTSEQ_MAX_REQS_DEFAULT, status = RpcServerUseProtseqEpW(ncalrpcW, RPC_C_PROTSEQ_MAX_REQS_DEFAULT,
endpoint_lrpcW, NULL); endpoint, NULL);
if (status != RPC_S_OK) if (status != RPC_S_OK)
{ {
ERR("RpcServerUseProtseqEp failed: %#x\n", status); ERR("RpcServerUseProtseqEp failed: %#x\n", status);

View File

@ -295,4 +295,4 @@
@ stdcall -private DllRegisterServer() @ stdcall -private DllRegisterServer()
@ stdcall -private DllUnregisterServer() @ stdcall -private DllUnregisterServer()
@ cdecl __wine_msi_call_dll_function(ptr) @ cdecl __wine_msi_call_dll_function(long ptr)

View File

@ -397,19 +397,20 @@ static DWORD DoUnregServer(void)
return ret; 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) static DWORD CALLBACK custom_action_thread(void *arg)
{ {
GUID guid = *(GUID *)arg; GUID guid = *(GUID *)arg;
heap_free(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 int custom_action_server(const WCHAR *arg)
{ {
static const WCHAR pipe_name[] = {'\\','\\','.','\\','p','i','p','e','\\','m','s','i','c','a','_','%','x','_','%','d',0}; 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; GUID guid, *thread_guid;
DWORD64 thread64; DWORD64 thread64;
WCHAR buffer[24]; WCHAR buffer[24];
@ -419,7 +420,7 @@ static int custom_action_server(const WCHAR *arg)
TRACE("%s\n", debugstr_w(arg)); TRACE("%s\n", debugstr_w(arg));
if (!client_pid) if (!(client_pid = atoiW(arg)))
{ {
ERR("Invalid parameter %s\n", debugstr_w(arg)); ERR("Invalid parameter %s\n", debugstr_w(arg));
return 1; return 1;