msi: Fix error handling.
This commit is contained in:
parent
3ef703ad6c
commit
959c71846d
|
@ -291,13 +291,13 @@ static UINT store_binary_to_temp(MSIPACKAGE *package, LPCWSTR source,
|
||||||
'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
|
'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
|
||||||
'`','B','i' ,'n','a','r','y','`',' ','W','H','E','R','E',' ',
|
'`','B','i' ,'n','a','r','y','`',' ','W','H','E','R','E',' ',
|
||||||
'`','N','a','m','e','`',' ','=',' ','\'','%','s','\'',0};
|
'`','N','a','m','e','`',' ','=',' ','\'','%','s','\'',0};
|
||||||
UINT rc;
|
|
||||||
MSIRECORD *row = 0;
|
MSIRECORD *row = 0;
|
||||||
HANDLE file;
|
HANDLE file;
|
||||||
CHAR buffer[1024];
|
CHAR buffer[1024];
|
||||||
static const WCHAR f1[] = {'m','s','i',0};
|
static const WCHAR f1[] = {'m','s','i',0};
|
||||||
WCHAR fmt[MAX_PATH];
|
WCHAR fmt[MAX_PATH];
|
||||||
DWORD sz = MAX_PATH;
|
DWORD sz = MAX_PATH;
|
||||||
|
UINT r;
|
||||||
|
|
||||||
if (MSI_GetPropertyW(package, cszTempFolder, fmt, &sz) != ERROR_SUCCESS)
|
if (MSI_GetPropertyW(package, cszTempFolder, fmt, &sz) != ERROR_SUCCESS)
|
||||||
GetTempPathW(MAX_PATH, fmt);
|
GetTempPathW(MAX_PATH, fmt);
|
||||||
|
@ -309,34 +309,35 @@ static UINT store_binary_to_temp(MSIPACKAGE *package, LPCWSTR source,
|
||||||
}
|
}
|
||||||
track_tempfile(package, tmp_file, tmp_file);
|
track_tempfile(package, tmp_file, tmp_file);
|
||||||
|
|
||||||
/* write out the file */
|
|
||||||
file = CreateFileW(tmp_file, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
|
|
||||||
FILE_ATTRIBUTE_NORMAL, NULL);
|
|
||||||
if (file == INVALID_HANDLE_VALUE)
|
|
||||||
return ERROR_FUNCTION_FAILED;
|
|
||||||
|
|
||||||
row = MSI_QueryGetRecord(package->db, query, source);
|
row = MSI_QueryGetRecord(package->db, query, source);
|
||||||
if (!row)
|
if (!row)
|
||||||
return ERROR_FUNCTION_FAILED;
|
return ERROR_FUNCTION_FAILED;
|
||||||
|
|
||||||
|
/* write out the file */
|
||||||
|
file = CreateFileW(tmp_file, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
|
||||||
|
FILE_ATTRIBUTE_NORMAL, NULL);
|
||||||
|
if (file == INVALID_HANDLE_VALUE)
|
||||||
|
r = ERROR_FUNCTION_FAILED;
|
||||||
|
else
|
||||||
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
DWORD write;
|
DWORD write;
|
||||||
sz = sizeof buffer;
|
sz = sizeof buffer;
|
||||||
rc = MSI_RecordReadStream(row, 2, buffer, &sz);
|
r = MSI_RecordReadStream(row, 2, buffer, &sz);
|
||||||
if (rc != ERROR_SUCCESS)
|
if (r != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
ERR("Failed to get stream\n");
|
ERR("Failed to get stream\n");
|
||||||
CloseHandle(file);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
WriteFile(file, buffer, sz, &write, NULL);
|
WriteFile(file, buffer, sz, &write, NULL);
|
||||||
} while (sz == sizeof buffer);
|
} while (sz == sizeof buffer);
|
||||||
|
|
||||||
CloseHandle(file);
|
CloseHandle(file);
|
||||||
|
}
|
||||||
|
|
||||||
msiobj_release(&row->hdr);
|
msiobj_release(&row->hdr);
|
||||||
|
|
||||||
return ERROR_SUCCESS;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void file_running_action(MSIPACKAGE* package, HANDLE Handle,
|
static void file_running_action(MSIPACKAGE* package, HANDLE Handle,
|
||||||
|
|
Loading…
Reference in New Issue