Commit a5d8ab57 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

msi: Check transform validation flags.

parent 7cf23a79
......@@ -46,54 +46,57 @@ static BOOL match_language( MSIPACKAGE *package, LANGID langid )
static UINT check_transform_applicable( MSIPACKAGE *package, IStorage *transform )
{
WCHAR *package_product, *transform_product, *template = NULL;
UINT ret = ERROR_FUNCTION_FAILED;
MSISUMMARYINFO *si = MSI_GetSummaryInformationW( transform, 0 );
UINT valid_flags = 0, wanted_flags = 0;
if (si) wanted_flags = msi_suminfo_get_int32( si, PID_CHARCOUNT );
TRACE("validation flags %x\n", wanted_flags);
package_product = msi_dup_property( package->db, szProductCode );
transform_product = msi_get_suminfo_product( transform );
if (wanted_flags & ~(MSITRANSFORM_VALIDATE_PRODUCT|MSITRANSFORM_VALIDATE_LANGUAGE))
FIXME("unsupported validation flags %x\n", wanted_flags);
if (wanted_flags & MSITRANSFORM_VALIDATE_PRODUCT)
{
WCHAR *package_product = msi_dup_property( package->db, szProductCode );
WCHAR *transform_product = msi_get_suminfo_product( transform );
TRACE("package = %s transform = %s\n", debugstr_w(package_product), debugstr_w(transform_product));
TRACE("package = %s transform = %s\n", debugstr_w(package_product), debugstr_w(transform_product));
if (!transform_product || strstrW( transform_product, package_product ))
if (!transform_product || strstrW( transform_product, package_product ))
{
valid_flags |= MSITRANSFORM_VALIDATE_PRODUCT;
}
msi_free( transform_product );
msi_free( package_product );
}
if (wanted_flags & MSITRANSFORM_VALIDATE_LANGUAGE)
{
MSISUMMARYINFO *si;
WCHAR *template;
const WCHAR *p;
si = MSI_GetSummaryInformationW( transform, 0 );
if (!si)
{
ERR("no summary information!\n");
goto end;
}
template = msi_suminfo_dup_string( si, PID_TEMPLATE );
if (!template)
if (!(template = msi_suminfo_dup_string( si, PID_TEMPLATE )))
{
ERR("no template property!\n");
msiobj_release( &si->hdr );
goto end;
}
if (!template[0])
{
ret = ERROR_SUCCESS;
msiobj_release( &si->hdr );
goto end;
}
TRACE("template: %s\n", debugstr_w(template));
p = strchrW( template, ';' );
if (p && match_language( package, atoiW( p + 1 ) ))
if (!template[0] || ((p = strchrW( template, ';' )) && match_language( package, atoiW( p + 1 ) )))
{
TRACE("applicable transform\n");
ret = ERROR_SUCCESS;
valid_flags |= MSITRANSFORM_VALIDATE_LANGUAGE;
}
/* FIXME: check platform */
msiobj_release( &si->hdr );
msi_free( template );
}
end:
msi_free( transform_product );
msi_free( package_product );
msi_free( template );
return ret;
msiobj_release( &si->hdr );
if (valid_flags & ~wanted_flags) return ERROR_FUNCTION_FAILED;
TRACE("applicable transform\n");
return ERROR_SUCCESS;
}
static UINT apply_substorage_transform( MSIPACKAGE *package, MSIDATABASE *patch_db, LPCWSTR name )
......
......@@ -145,6 +145,21 @@ typedef enum tagMSIDBSTATE
MSIDBSTATE_WRITE = 1
} MSIDBSTATE;
typedef enum tagMSITRANSFORM_VALIDATE
{
MSITRANSFORM_VALIDATE_LANGUAGE = 0x00000001,
MSITRANSFORM_VALIDATE_PRODUCT = 0x00000002,
MSITRANSFORM_VALIDATE_PLATFORM = 0x00000004,
MSITRANSFORM_VALIDATE_MAJORVERSION = 0x00000008,
MSITRANSFORM_VALIDATE_MINORVERSION = 0x00000010,
MSITRANSFORM_VALIDATE_UPDATEVERSION = 0x00000020,
MSITRANSFORM_VALIDATE_NEWLESSBASEVERSION = 0x00000040,
MSITRANSFORM_VALIDATE_NEWLESSEQUALBASEVERSION = 0x00000080,
MSITRANSFORM_VALIDATE_NEWEQUALBASEVERSION = 0x00000100,
MSITRANSFORM_VALIDATE_NEWGREATEREQUALBASEVERSION = 0x00000200,
MSITRANSFORM_VALIDATE_NEWGREATERBASEVERSION = 0x00000400,
MSITRANSFORM_VALIDATE_UPGRADECODE = 0x00000800
} MSITRANSFORM_VALIDATE;
#ifdef __cplusplus
extern "C" {
......
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