msi: Improve parsing of the supported platforms string.

This commit is contained in:
Hans Leidekker 2013-01-31 15:11:38 +01:00 committed by Alexandre Julliard
parent d4e9b2cd0f
commit 07be9f0585
3 changed files with 29 additions and 11 deletions

View File

@ -338,6 +338,7 @@ typedef struct msi_dialog_tag msi_dialog;
enum platform
{
PLATFORM_UNKNOWN,
PLATFORM_INTEL,
PLATFORM_INTEL64,
PLATFORM_X64,

View File

@ -1269,9 +1269,18 @@ UINT msi_create_empty_local_file( LPWSTR path, LPCWSTR suffix )
return ERROR_SUCCESS;
}
static enum platform parse_platform( WCHAR *str )
{
if (!str[0] || !strcmpW( str, szIntel )) return PLATFORM_INTEL;
else if (!strcmpW( str, szIntel64 )) return PLATFORM_INTEL64;
else if (!strcmpW( str, szX64 ) || !strcmpW( str, szAMD64 )) return PLATFORM_X64;
else if (!strcmpW( str, szARM )) return PLATFORM_ARM;
return PLATFORM_UNKNOWN;
}
static UINT msi_parse_summary( MSISUMMARYINFO *si, MSIPACKAGE *package )
{
WCHAR *template, *p, *q;
WCHAR *template, *p, *q, *platform;
DWORD i, count;
package->version = msi_suminfo_get_int32( si, PID_PAGECOUNT );
@ -1291,16 +1300,16 @@ static UINT msi_parse_summary( MSISUMMARYINFO *si, MSIPACKAGE *package )
return ERROR_PATCH_PACKAGE_INVALID;
}
*p = 0;
if ((q = strchrW( template, ',' ))) *q = 0;
if (!template[0] || !strcmpW( template, szIntel ))
package->platform = PLATFORM_INTEL;
else if (!strcmpW( template, szIntel64 ))
package->platform = PLATFORM_INTEL64;
else if (!strcmpW( template, szX64 ) || !strcmpW( template, szAMD64 ))
package->platform = PLATFORM_X64;
else if (!strcmpW( template, szARM ))
package->platform = PLATFORM_ARM;
else
platform = template;
if ((q = strchrW( platform, ',' ))) *q = 0;
package->platform = parse_platform( platform );
while (package->platform == PLATFORM_UNKNOWN && q)
{
platform = q + 1;
if ((q = strchrW( platform, ',' ))) *q = 0;
package->platform = parse_platform( platform );
}
if (package->platform == PLATFORM_UNKNOWN)
{
WARN("unknown platform %s\n", debugstr_w(template));
msi_free( template );

View File

@ -6294,6 +6294,14 @@ static void test_package_validation(void)
ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
ok(delete_pf("msitest", FALSE), "directory does not exist\n");
DeleteFile(msifile);
create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "Alpha,Beta,Intel;0");
r = MsiInstallProductA(msifile, NULL);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
ok(delete_pf("msitest\\maximus", TRUE), "file does not exist\n");
ok(delete_pf("msitest", FALSE), "directory does not exist\n");
DeleteFile(msifile);
create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "x64;0");