Commit 0d7dc8f9 authored by Mike McCormack's avatar Mike McCormack Committed by Alexandre Julliard

msi: Only apply transforms that are valid for a database.

parent 7f98f1d0
......@@ -398,6 +398,28 @@ static LPWSTR* msi_split_string( LPCWSTR str, WCHAR sep )
return ret;
}
static UINT msi_check_transform_applicable( MSIPACKAGE *package, IStorage *patch )
{
WCHAR szProductCode[] = { 'P','r','o','d','u','c','t','C','o','d','e',0 };
LPWSTR prod_code, patch_product;
UINT ret;
prod_code = msi_dup_property( package, szProductCode );
patch_product = msi_get_suminfo_product( patch );
TRACE("db = %s patch = %s\n", debugstr_w(prod_code), debugstr_w(patch_product));
if ( strstrW( patch_product, prod_code ) )
ret = ERROR_SUCCESS;
else
ret = ERROR_FUNCTION_FAILED;
msi_free( patch_product );
msi_free( prod_code );
return ret;
}
static UINT msi_apply_substorage_transform( MSIPACKAGE *package,
MSIDATABASE *patch_db, LPCWSTR name )
{
......@@ -416,14 +438,17 @@ static UINT msi_apply_substorage_transform( MSIPACKAGE *package,
r = IStorage_OpenStorage( patch_db->storage, name, NULL, STGM_SHARE_EXCLUSIVE, NULL, 0, &stg );
if (SUCCEEDED(r))
{
ret = msi_table_apply_transform( package->db, stg );
ret = msi_check_transform_applicable( package, stg );
if (ret == ERROR_SUCCESS)
msi_table_apply_transform( package->db, stg );
else
TRACE("substorage transform %s wasn't applicable\n", debugstr_w(name));
IStorage_Release( stg );
ret = ERROR_SUCCESS;
}
else
ERR("failed to open substorage %s\n", debugstr_w(name));
return ret;
return ERROR_SUCCESS;
}
static UINT msi_check_patch_applicable( MSIPACKAGE *package, MSISUMMARYINFO *si )
......
......@@ -688,6 +688,7 @@ extern UINT MSI_PreviewDialogW( MSIPREVIEW *, LPCWSTR );
/* summary information */
extern MSISUMMARYINFO *MSI_GetSummaryInformationW( IStorage *stg, UINT uiUpdateCount );
extern LPWSTR msi_suminfo_dup_string( MSISUMMARYINFO *si, UINT uiProperty );
extern LPWSTR msi_get_suminfo_product( IStorage *stg );
/* undocumented functions */
UINT WINAPI MsiCreateAndVerifyInstallerDirectory( DWORD );
......
......@@ -602,6 +602,22 @@ LPWSTR msi_suminfo_dup_string( MSISUMMARYINFO *si, UINT uiProperty )
return strdupAtoW( prop->u.pszVal );
}
LPWSTR msi_get_suminfo_product( IStorage *stg )
{
MSISUMMARYINFO *si;
LPWSTR prod;
si = MSI_GetSummaryInformationW( stg, 0 );
if (!si)
{
ERR("no summary information!\n");
return NULL;
}
prod = msi_suminfo_dup_string( si, PID_REVNUMBER );
msiobj_release( &si->hdr );
return prod;
}
UINT WINAPI MsiSummaryInfoGetPropertyA(
MSIHANDLE handle, UINT uiProperty, UINT *puiDataType, INT *piValue,
FILETIME *pftValue, LPSTR szValueBuf, DWORD *pcchValueBuf)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment