[WINESYNC] 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>

wine commit id 27a7952a84d157caed21a663dd827728a02c443e by Zebediah Figura <z.figura12@gmail.com>
This commit is contained in:
winesync 2022-03-13 01:17:51 +01:00 committed by Mark Jansen
parent e89ff1f99b
commit c611d50ecc
No known key found for this signature in database
GPG key ID: B39240EE84BEAE8B
3 changed files with 16 additions and 9 deletions

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;

View file

@ -478,7 +478,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};
#if defined __i386__ && defined _MSC_VER #if defined __i386__ && defined _MSC_VER
__declspec(naked) UINT custom_proc_wrapper(MsiCustomActionEntryPoint entry, MSIHANDLE hinst) __declspec(naked) UINT custom_proc_wrapper(MsiCustomActionEntryPoint entry, MSIHANDLE hinst)
@ -517,7 +517,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;
@ -534,7 +534,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);
@ -755,8 +758,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)