From 0270f18e110128b2646ac050c8bfb316a0515e43 Mon Sep 17 00:00:00 2001 From: Andrew Nguyen Date: Wed, 3 Mar 2010 02:53:23 -0600 Subject: [PATCH] msi: Correctly set the process working directory in custom action type 34. --- dlls/msi/custom.c | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/dlls/msi/custom.c b/dlls/msi/custom.c index 2b2a3e1373f..584c0507c53 100644 --- a/dlls/msi/custom.c +++ b/dlls/msi/custom.c @@ -1120,38 +1120,44 @@ static UINT HANDLE_CustomType50(MSIPACKAGE *package, LPCWSTR source, static UINT HANDLE_CustomType34(MSIPACKAGE *package, LPCWSTR source, LPCWSTR target, const INT type, LPCWSTR action) { - LPWSTR filename, deformated; + LPWSTR workingdir, filename; STARTUPINFOW si; PROCESS_INFORMATION info; BOOL rc; - memset(&si,0,sizeof(STARTUPINFOW)); + memset(&si, 0, sizeof(STARTUPINFOW)); - filename = resolve_folder(package, source, FALSE, FALSE, TRUE, NULL); + workingdir = resolve_folder(package, source, FALSE, FALSE, TRUE, NULL); - if (!filename) + if (!workingdir) return ERROR_FUNCTION_FAILED; - SetCurrentDirectoryW(filename); - msi_free(filename); + deformat_string(package, target, &filename); - deformat_string(package,target,&deformated); - - if (!deformated) + if (!filename) + { + msi_free(workingdir); return ERROR_FUNCTION_FAILED; + } - TRACE("executing exe %s\n", debugstr_w(deformated)); + TRACE("executing exe %s with working directory %s\n", + debugstr_w(filename), debugstr_w(workingdir)); - rc = CreateProcessW(NULL, deformated, NULL, NULL, FALSE, 0, NULL, - c_collen, &si, &info); + rc = CreateProcessW(NULL, filename, NULL, NULL, FALSE, 0, NULL, + workingdir, &si, &info); if ( !rc ) { - ERR("Unable to execute command %s\n", debugstr_w(deformated)); - msi_free(deformated); + ERR("Unable to execute command %s with working directory %s\n", + debugstr_w(filename), debugstr_w(workingdir)); + msi_free(filename); + msi_free(workingdir); return ERROR_SUCCESS; } - msi_free(deformated); + + msi_free(filename); + msi_free(workingdir); + CloseHandle( info.hThread ); return wait_process_handle(package, type, info.hProcess, action); -- 2.11.4.GIT