[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wine-devel
Subject:    [PATCH v2 1/2] msi: Execute the custom action server with the correct bitness.
From:       Zebediah Figura <z.figura12 () gmail ! com>
Date:       2018-04-30 18:36:50
Message-ID: 1525113411-14157-1-git-send-email-z.figura12 () gmail ! com
[Download RAW message or body]

The bitness depends solely on the bitness of the DLL (tested manually).

Fixes bugs 31741 and 37856.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
---
 dlls/msi/custom.c | 27 +++++++++++++++++++++++++--
 1 file changed, 25 insertions(+), 2 deletions(-)

diff --git a/dlls/msi/custom.c b/dlls/msi/custom.c
index 72c3efd..13ea8ee 100644
--- a/dlls/msi/custom.c
+++ b/dlls/msi/custom.c
@@ -579,11 +579,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', +        ' \
','-','E','m','b','e','d','d','i','n','g',' ',0}; +    msi_custom_action_info *info;
     PROCESS_INFORMATION pi = {0};
     STARTUPINFOW si = {0};
+    WCHAR buffer[100];
     RPC_STATUS status;
     GUID *guid = arg;
+    void *cookie;
+    BOOL wow64;
+    DWORD arch;
     DWORD rc;
 
     TRACE("custom action (%x) started\n", GetCurrentThreadId() );
@@ -605,8 +611,25 @@ static DWORD WINAPI DllThread( LPVOID arg )
         return status;
     }
 
+    info = find_action_by_guid(guid);
+    GetBinaryTypeW(info->source, &arch);
+
+    if (sizeof(void *) == 8 && arch == SCS_32BIT_BINARY)
+        GetSystemWow64DirectoryW(buffer, sizeof(buffer));
+    else
+        GetSystemDirectoryW(buffer, sizeof(buffer));
+    strcatW(buffer, msiexecW);
     StringFromGUID2(guid, buffer + strlenW(buffer), 39);
-    CreateProcessW(NULL, buffer, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
+
+    if (IsWow64Process(GetCurrentProcess(), &wow64) && wow64 && arch == \
SCS_64BIT_BINARY) +    {
+        Wow64DisableWow64FsRedirection(&cookie);
+        CreateProcessW(NULL, buffer, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
+        Wow64RevertWow64FsRedirection(cookie);
+    }
+    else
+        CreateProcessW(NULL, buffer, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
+
     WaitForSingleObject(pi.hProcess, INFINITE);
     GetExitCodeProcess(pi.hProcess, &rc);
     CloseHandle(pi.hProcess);
-- 
2.7.4


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic