Andrew Nguyen : msi: Correctly set the process working directory in custom action type 34.
Module: wine Branch: master Commit: 0270f18e110128b2646ac050c8bfb316a0515e43 URL: http://source.winehq.org/git/wine.git/?a=commit;h=0270f18e110128b2646ac050c8... Author: Andrew Nguyen <arethusa26(a)gmail.com> Date: Wed Mar 3 02:53:23 2010 -0600 msi: Correctly set the process working directory in custom action type 34. --- dlls/msi/custom.c | 36 +++++++++++++++++++++--------------- 1 files changed, 21 insertions(+), 15 deletions(-) diff --git a/dlls/msi/custom.c b/dlls/msi/custom.c index 2b2a3e1..584c050 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);
participants (1)
-
Alexandre Julliard