msi: Fail if we can't write out a temporary file.

This commit is contained in:
Mike McCormack 2006-11-13 16:35:09 +09:00 committed by Alexandre Julliard
parent 2a46821b82
commit 1767989bd1
1 changed files with 15 additions and 11 deletions

View File

@ -528,11 +528,13 @@ static UINT HANDLE_CustomType1(MSIPACKAGE *package, LPCWSTR source,
LPCWSTR target, const INT type, LPCWSTR action) LPCWSTR target, const INT type, LPCWSTR action)
{ {
WCHAR tmp_file[MAX_PATH]; WCHAR tmp_file[MAX_PATH];
UINT rc = ERROR_SUCCESS; UINT r = ERROR_SUCCESS;
BOOL finished = FALSE; BOOL finished = FALSE;
HANDLE ThreadHandle; HANDLE ThreadHandle;
store_binary_to_temp(package, source, tmp_file); r = store_binary_to_temp(package, source, tmp_file);
if (r != ERROR_SUCCESS)
return r;
TRACE("Calling function %s from %s\n",debugstr_w(target), TRACE("Calling function %s from %s\n",debugstr_w(target),
debugstr_w(tmp_file)); debugstr_w(tmp_file));
@ -541,18 +543,18 @@ static UINT HANDLE_CustomType1(MSIPACKAGE *package, LPCWSTR source,
{ {
static const WCHAR dot[]={'.',0}; static const WCHAR dot[]={'.',0};
strcatW(tmp_file,dot); strcatW(tmp_file,dot);
} }
ThreadHandle = do_msidbCustomActionTypeDll( package, tmp_file, target ); ThreadHandle = do_msidbCustomActionTypeDll( package, tmp_file, target );
rc = process_handle(package, type, ThreadHandle, NULL, action, &finished ); r = process_handle(package, type, ThreadHandle, NULL, action, &finished );
if (!finished) if (!finished)
track_tempfile(package, tmp_file, tmp_file); track_tempfile(package, tmp_file, tmp_file);
else else
DeleteFileW(tmp_file); DeleteFileW(tmp_file);
return rc; return r;
} }
static UINT HANDLE_CustomType2(MSIPACKAGE *package, LPCWSTR source, static UINT HANDLE_CustomType2(MSIPACKAGE *package, LPCWSTR source,
@ -566,12 +568,14 @@ static UINT HANDLE_CustomType2(MSIPACKAGE *package, LPCWSTR source,
WCHAR *deformated; WCHAR *deformated;
WCHAR *cmd; WCHAR *cmd;
static const WCHAR spc[] = {' ',0}; static const WCHAR spc[] = {' ',0};
UINT prc = ERROR_SUCCESS; UINT r = ERROR_SUCCESS;
BOOL finished = FALSE; BOOL finished = FALSE;
memset(&si,0,sizeof(STARTUPINFOW)); memset(&si,0,sizeof(STARTUPINFOW));
store_binary_to_temp(package, source, tmp_file); r = store_binary_to_temp(package, source, tmp_file);
if (r != ERROR_SUCCESS)
return r;
deformat_string(package,target,&deformated); deformat_string(package,target,&deformated);
@ -579,7 +583,7 @@ static UINT HANDLE_CustomType2(MSIPACKAGE *package, LPCWSTR source,
if (deformated) if (deformated)
len += strlenW(deformated); len += strlenW(deformated);
cmd = msi_alloc(sizeof(WCHAR)*len); cmd = msi_alloc(sizeof(WCHAR)*len);
strcpyW(cmd,tmp_file); strcpyW(cmd,tmp_file);
@ -605,15 +609,15 @@ static UINT HANDLE_CustomType2(MSIPACKAGE *package, LPCWSTR source,
} }
msi_free(cmd); msi_free(cmd);
prc = process_handle(package, type, info.hThread, info.hProcess, action, r = process_handle(package, type, info.hThread, info.hProcess, action,
&finished); &finished);
if (!finished) if (!finished)
track_tempfile(package, tmp_file, tmp_file); track_tempfile(package, tmp_file, tmp_file);
else else
DeleteFileW(tmp_file); DeleteFileW(tmp_file);
return prc; return r;
} }
static UINT HANDLE_CustomType17(MSIPACKAGE *package, LPCWSTR source, static UINT HANDLE_CustomType17(MSIPACKAGE *package, LPCWSTR source,