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 | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-)
diff --git a/dlls/msi/custom.c b/dlls/msi/custom.c index 72c3efd..4ec1a39 100644 --- a/dlls/msi/custom.c +++ b/dlls/msi/custom.c @@ -579,11 +579,19 @@ 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 msiexec32W[] = {'C',':','/','w','i','n','d','o','w','s','/', + 's','y','s','w','o','w','6','4','/','m','s','i','e','x','e','c','.','e','x','e',0}; + static const WCHAR msiexecW[] = {'m','s','i','e','x','e','c','.','e','x','e',0}; + static const WCHAR embeddingW[] = {' ','-','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 +613,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) + strcpyW(buffer, msiexec32W); + else + strcpyW(buffer, msiexecW); + strcatW(buffer, embeddingW); 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);
This has no effect anymore, and won't work if the architecture doesn't match.
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/msi/custom.c | 16 ++++++---------- dlls/msi/msipriv.h | 1 - dlls/msi/package.c | 2 -- 3 files changed, 6 insertions(+), 13 deletions(-)
diff --git a/dlls/msi/custom.c b/dlls/msi/custom.c index 4ec1a39..4f386ce 100644 --- a/dlls/msi/custom.c +++ b/dlls/msi/custom.c @@ -235,7 +235,7 @@ WCHAR *msi_create_temp_file( MSIDATABASE *db ) return ret; }
-static MSIBINARY *create_temp_binary( MSIPACKAGE *package, LPCWSTR source, BOOL dll ) +static MSIBINARY *create_temp_binary(MSIPACKAGE *package, LPCWSTR source) { static const WCHAR query[] = { 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', @@ -272,11 +272,6 @@ static MSIBINARY *create_temp_binary( MSIPACKAGE *package, LPCWSTR source, BOOL CloseHandle( file ); if (r != ERROR_SUCCESS) goto error;
- /* keep a reference to prevent the dll from being unloaded */ - if (dll && !(binary->module = LoadLibraryW( tmpfile ))) - { - ERR( "failed to load dll %s (%u)\n", debugstr_w( tmpfile ), GetLastError() ); - } binary->source = strdupW( source ); binary->tmpfile = tmpfile; list_add_tail( &package->binaries, &binary->entry ); @@ -292,7 +287,7 @@ error: return NULL; }
-static MSIBINARY *get_temp_binary( MSIPACKAGE *package, LPCWSTR source, BOOL dll ) +static MSIBINARY *get_temp_binary(MSIPACKAGE *package, LPCWSTR source) { MSIBINARY *binary;
@@ -302,7 +297,7 @@ static MSIBINARY *get_temp_binary( MSIPACKAGE *package, LPCWSTR source, BOOL dll return binary; }
- return create_temp_binary( package, source, dll ); + return create_temp_binary(package, source); }
static void file_running_action(MSIPACKAGE* package, HANDLE Handle, @@ -692,7 +687,7 @@ static UINT HANDLE_CustomType1( MSIPACKAGE *package, const WCHAR *source, const msi_custom_action_info *info; MSIBINARY *binary;
- if (!(binary = get_temp_binary( package, source, TRUE ))) + if (!(binary = get_temp_binary(package, source))) return ERROR_FUNCTION_FAILED;
TRACE("Calling function %s from %s\n", debugstr_w(target), debugstr_w(binary->tmpfile)); @@ -776,7 +771,8 @@ static UINT HANDLE_CustomType2( MSIPACKAGE *package, const WCHAR *source, const HANDLE handle; WCHAR *arg;
- if (!(binary = get_temp_binary( package, source, FALSE ))) return ERROR_FUNCTION_FAILED; + if (!(binary = get_temp_binary(package, source))) + return ERROR_FUNCTION_FAILED;
deformat_string( package, target, &arg ); TRACE("exe %s arg %s\n", debugstr_w(binary->tmpfile), debugstr_w(arg)); diff --git a/dlls/msi/msipriv.h b/dlls/msi/msipriv.h index aede960..46cbb43 100644 --- a/dlls/msi/msipriv.h +++ b/dlls/msi/msipriv.h @@ -206,7 +206,6 @@ typedef struct tagMSIBINARY struct list entry; WCHAR *source; WCHAR *tmpfile; - HMODULE module; } MSIBINARY;
typedef struct _column_info diff --git a/dlls/msi/package.c b/dlls/msi/package.c index a2fa785..3de3113 100644 --- a/dlls/msi/package.c +++ b/dlls/msi/package.c @@ -290,8 +290,6 @@ static void free_package_structures( MSIPACKAGE *package ) MSIBINARY *binary = LIST_ENTRY( item, MSIBINARY, entry );
list_remove( &binary->entry ); - if (binary->module) - FreeLibrary( binary->module ); if (!DeleteFileW( binary->tmpfile )) ERR("failed to delete %s (%u)\n", debugstr_w(binary->tmpfile), GetLastError()); msi_free( binary->source );
Signed-off-by: Hans Leidekker hans@codeweavers.com
Zebediah Figura z.figura12@gmail.com writes:
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 | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-)
diff --git a/dlls/msi/custom.c b/dlls/msi/custom.c index 72c3efd..4ec1a39 100644 --- a/dlls/msi/custom.c +++ b/dlls/msi/custom.c @@ -579,11 +579,19 @@ 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 msiexec32W[] = {'C',':','/','w','i','n','d','o','w','s','/',
's','y','s','w','o','w','6','4','/','m','s','i','e','x','e','c','.','e','x','e',0};
This works, but it would be cleaner to use GetSystemWow64Directory. Also you probably want to pass the full path name as the application name in CreateProcess.
On 30/04/18 13:01, Alexandre Julliard wrote:
Zebediah Figura z.figura12@gmail.com writes:
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 | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-)
diff --git a/dlls/msi/custom.c b/dlls/msi/custom.c index 72c3efd..4ec1a39 100644 --- a/dlls/msi/custom.c +++ b/dlls/msi/custom.c @@ -579,11 +579,19 @@ 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 msiexec32W[] = {'C',':','/','w','i','n','d','o','w','s','/',
's','y','s','w','o','w','6','4','/','m','s','i','e','x','e','c','.','e','x','e',0};
This works, but it would be cleaner to use GetSystemWow64Directory. Also you probably want to pass the full path name as the application name in CreateProcess.
Thanks; I've sent an updated patch.