https://git.reactos.org/?p=reactos.git;a=commitdiff;h=20260e3310ebc25ec583ce...
commit 20260e3310ebc25ec583ce9da70510db7eaa69a2 Author: winesync ros-dev@reactos.org AuthorDate: Sat Mar 12 15:12:10 2022 +0100 Commit: Mark Jansen mark.jansen@reactos.org CommitDate: Sun Mar 20 19:27:43 2022 +0100
[WINESYNC] msi: Execute the custom action server with the correct bitness.
The bitness depends solely on the bitness of the DLL (tested manually).
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 6049b0f8c3637b6ef55b05a57893191ab808c69f by Zebediah Figura z.figura12@gmail.com --- dll/win32/msi/custom.c | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-)
diff --git a/dll/win32/msi/custom.c b/dll/win32/msi/custom.c index d6a8e11aec6..027d0f6961a 100644 --- a/dll/win32/msi/custom.c +++ b/dll/win32/msi/custom.c @@ -580,11 +580,17 @@ UINT __wine_msi_call_dll_function(const GUID *guid)
static DWORD WINAPI DllThread( LPVOID arg ) { - WCHAR buffer[64] = {'m','s','i','e','x','e','c','.','e','x','e',' ','-','E','m','b','e','d','d','i','n','g',' ',0}; + static const WCHAR msiexecW[] = {'\','m','s','i','e','x','e','c','.','e','x','e',0}; + static const WCHAR argsW[] = {' ','-','E','m','b','e','d','d','i','n','g',' ',0}; + msi_custom_action_info *info; PROCESS_INFORMATION pi = {0}; STARTUPINFOW si = {0}; + WCHAR buffer[MAX_PATH], cmdline[MAX_PATH + 60]; RPC_STATUS status; GUID *guid = arg; + void *cookie; + BOOL wow64; + DWORD arch; DWORD rc;
TRACE("custom action (%x) started\n", GetCurrentThreadId() ); @@ -606,8 +612,27 @@ static DWORD WINAPI DllThread( LPVOID arg ) return status; }
- StringFromGUID2(guid, buffer + strlenW(buffer), 39); - CreateProcessW(NULL, buffer, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi); + info = find_action_by_guid(guid); + GetBinaryTypeW(info->source, &arch); + + if (sizeof(void *) == 8 && arch == SCS_32BIT_BINARY) + GetSystemWow64DirectoryW(buffer, MAX_PATH - sizeof(msiexecW)/sizeof(WCHAR)); + else + GetSystemDirectoryW(buffer, MAX_PATH - sizeof(msiexecW)/sizeof(WCHAR)); + strcatW(buffer, msiexecW); + strcpyW(cmdline, buffer); + strcatW(cmdline, argsW); + StringFromGUID2(guid, cmdline + strlenW(cmdline), 39); + + if (IsWow64Process(GetCurrentProcess(), &wow64) && wow64 && arch == SCS_64BIT_BINARY) + { + Wow64DisableWow64FsRedirection(&cookie); + CreateProcessW(buffer, cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi); + Wow64RevertWow64FsRedirection(cookie); + } + else + CreateProcessW(buffer, cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi); + WaitForSingleObject(pi.hProcess, INFINITE); GetExitCodeProcess(pi.hProcess, &rc); CloseHandle(pi.hProcess);