msi: Correctly set the process working directory in custom action type 34.

This commit is contained in:
Andrew Nguyen 2010-03-03 02:53:23 -06:00 committed by Alexandre Julliard
parent cafb20bb5c
commit 0270f18e11
1 changed files with 23 additions and 17 deletions

View File

@ -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 (!workingdir)
return ERROR_FUNCTION_FAILED;
deformat_string(package, target, &filename);
if (!filename)
{
msi_free(workingdir);
return ERROR_FUNCTION_FAILED;
}
SetCurrentDirectoryW(filename);
msi_free(filename);
TRACE("executing exe %s with working directory %s\n",
debugstr_w(filename), debugstr_w(workingdir));
deformat_string(package,target,&deformated);
if (!deformated)
return ERROR_FUNCTION_FAILED;
TRACE("executing exe %s\n", debugstr_w(deformated));
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);