msi: Check transform validation flags.
This commit is contained in:
parent
7cf23a7957
commit
a5d8ab57f6
|
@ -46,54 +46,57 @@ static BOOL match_language( MSIPACKAGE *package, LANGID langid )
|
||||||
|
|
||||||
static UINT check_transform_applicable( MSIPACKAGE *package, IStorage *transform )
|
static UINT check_transform_applicable( MSIPACKAGE *package, IStorage *transform )
|
||||||
{
|
{
|
||||||
WCHAR *package_product, *transform_product, *template = NULL;
|
MSISUMMARYINFO *si = MSI_GetSummaryInformationW( transform, 0 );
|
||||||
UINT ret = ERROR_FUNCTION_FAILED;
|
UINT valid_flags = 0, wanted_flags = 0;
|
||||||
|
|
||||||
package_product = msi_dup_property( package->db, szProductCode );
|
if (si) wanted_flags = msi_suminfo_get_int32( si, PID_CHARCOUNT );
|
||||||
transform_product = msi_get_suminfo_product( transform );
|
TRACE("validation flags %x\n", wanted_flags);
|
||||||
|
|
||||||
TRACE("package = %s transform = %s\n", debugstr_w(package_product), debugstr_w(transform_product));
|
if (wanted_flags & ~(MSITRANSFORM_VALIDATE_PRODUCT|MSITRANSFORM_VALIDATE_LANGUAGE))
|
||||||
|
FIXME("unsupported validation flags %x\n", wanted_flags);
|
||||||
|
|
||||||
if (!transform_product || strstrW( transform_product, package_product ))
|
if (wanted_flags & MSITRANSFORM_VALIDATE_PRODUCT)
|
||||||
{
|
{
|
||||||
MSISUMMARYINFO *si;
|
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));
|
||||||
|
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
WCHAR *template;
|
||||||
const WCHAR *p;
|
const WCHAR *p;
|
||||||
|
|
||||||
si = MSI_GetSummaryInformationW( transform, 0 );
|
|
||||||
if (!si)
|
if (!si)
|
||||||
{
|
{
|
||||||
ERR("no summary information!\n");
|
ERR("no summary information!\n");
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
template = msi_suminfo_dup_string( si, PID_TEMPLATE );
|
if (!(template = msi_suminfo_dup_string( si, PID_TEMPLATE )))
|
||||||
if (!template)
|
|
||||||
{
|
{
|
||||||
ERR("no template property!\n");
|
ERR("no template property!\n");
|
||||||
msiobj_release( &si->hdr );
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
if (!template[0])
|
|
||||||
{
|
|
||||||
ret = ERROR_SUCCESS;
|
|
||||||
msiobj_release( &si->hdr );
|
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
TRACE("template: %s\n", debugstr_w(template));
|
TRACE("template: %s\n", debugstr_w(template));
|
||||||
p = strchrW( template, ';' );
|
if (!template[0] || ((p = strchrW( template, ';' )) && match_language( package, atoiW( p + 1 ) )))
|
||||||
if (p && match_language( package, atoiW( p + 1 ) ))
|
|
||||||
{
|
{
|
||||||
TRACE("applicable transform\n");
|
valid_flags |= MSITRANSFORM_VALIDATE_LANGUAGE;
|
||||||
ret = ERROR_SUCCESS;
|
|
||||||
}
|
}
|
||||||
/* FIXME: check platform */
|
msi_free( template );
|
||||||
msiobj_release( &si->hdr );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
end:
|
end:
|
||||||
msi_free( transform_product );
|
msiobj_release( &si->hdr );
|
||||||
msi_free( package_product );
|
if (valid_flags & ~wanted_flags) return ERROR_FUNCTION_FAILED;
|
||||||
msi_free( template );
|
TRACE("applicable transform\n");
|
||||||
return ret;
|
return ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static UINT apply_substorage_transform( MSIPACKAGE *package, MSIDATABASE *patch_db, LPCWSTR name )
|
static UINT apply_substorage_transform( MSIPACKAGE *package, MSIDATABASE *patch_db, LPCWSTR name )
|
||||||
|
|
|
@ -145,6 +145,21 @@ typedef enum tagMSIDBSTATE
|
||||||
MSIDBSTATE_WRITE = 1
|
MSIDBSTATE_WRITE = 1
|
||||||
} MSIDBSTATE;
|
} 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
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
Loading…
Reference in New Issue