[PATCH] msi: Append the custom action client PID to the endpoint name.
Ztirfe Elgnid
z.figura12 at gmail.com
Sat Mar 23 22:01:18 CDT 2019
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
On Fri, Mar 22, 2019 at 9:17 PM Zebediah Figura <z.figura12 at gmail.com> wrote:
>
> Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46833
> ---
> 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 8bf0902914..facb1d81e1 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 aecba1b1b3..eeb9ea757c 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 efbcb5c7f4..3340ade776 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;
> --
> 2.17.1
>
More information about the wine-devel
mailing list