From ac9d876fe9179c73ba345605b084693103e88cee Mon Sep 17 00:00:00 2001 From: winesync Date: Sat, 12 Mar 2022 23:50:38 +0100 Subject: [PATCH] [WINESYNC] msi: Generate unique names for 32- and 64-bit custom action server pipes. Signed-off-by: Zebediah Figura Signed-off-by: Hans Leidekker Signed-off-by: Alexandre Julliard wine commit id 6925846988fb78a2dd217d2b837e59ec53234f87 by Zebediah Figura --- base/system/msiexec/msiexec.c | 4 ++-- dll/win32/msi/custom.c | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/base/system/msiexec/msiexec.c b/base/system/msiexec/msiexec.c index 47cef7e0fa2..ead3bfb9dea 100644 --- a/base/system/msiexec/msiexec.c +++ b/base/system/msiexec/msiexec.c @@ -406,7 +406,7 @@ static DWORD CALLBACK custom_action_thread(void *arg) static int custom_action_server(const WCHAR *arg) { - static const WCHAR pipe_name[] = {'\\','\\','.','\\','p','i','p','e','\\','m','s','i','c','a','_','%','x',0}; + static const WCHAR pipe_name[] = {'\\','\\','.','\\','p','i','p','e','\\','m','s','i','c','a','_','%','x','_','%','d',0}; DWORD client_pid = atoiW(arg); DWORD64 thread64; WCHAR buffer[24]; @@ -423,7 +423,7 @@ static int custom_action_server(const WCHAR *arg) return 1; } - sprintfW(buffer, pipe_name, client_pid); + sprintfW(buffer, pipe_name, client_pid, sizeof(void *) * 8); pipe = CreateFileW(buffer, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL); if (pipe == INVALID_HANDLE_VALUE) { diff --git a/dll/win32/msi/custom.c b/dll/win32/msi/custom.c index 8cb5fd42d69..e7ee80c689d 100644 --- a/dll/win32/msi/custom.c +++ b/dll/win32/msi/custom.c @@ -604,7 +604,7 @@ UINT CDECL __wine_msi_call_dll_function(const GUID *guid) static DWORD custom_start_server(MSIPACKAGE *package, DWORD arch) { - static const WCHAR pipe_name[] = {'\\','\\','.','\\','p','i','p','e','\\','m','s','i','c','a','_','%','x',0}; + static const WCHAR pipe_name[] = {'\\','\\','.','\\','p','i','p','e','\\','m','s','i','c','a','_','%','x','_','%','d',0}; static const WCHAR msiexecW[] = {'\\','m','s','i','e','x','e','c','.','e','x','e',0}; static const WCHAR argsW[] = {'%','s',' ','-','E','m','b','e','d','d','i','n','g',' ','%','d',0}; @@ -620,9 +620,11 @@ static DWORD custom_start_server(MSIPACKAGE *package, DWORD arch) (arch == SCS_64BIT_BINARY && package->custom_server_64_process)) return ERROR_SUCCESS; - sprintfW(buffer, pipe_name, GetCurrentProcessId()); + sprintfW(buffer, pipe_name, GetCurrentProcessId(), arch == SCS_32BIT_BINARY ? 32 : 64); pipe = CreateNamedPipeW(buffer, PIPE_ACCESS_DUPLEX, 0, 1, sizeof(DWORD64), sizeof(GUID), 0, NULL); + if (pipe == INVALID_HANDLE_VALUE) + ERR("Failed to create custom action client pipe: %u\n", GetLastError()); if (sizeof(void *) == 8 && arch == SCS_32BIT_BINARY) GetSystemWow64DirectoryW(path, MAX_PATH - sizeof(msiexecW)/sizeof(WCHAR));