Commit 07be9f05 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

msi: Improve parsing of the supported platforms string.

parent d4e9b2cd
...@@ -338,6 +338,7 @@ typedef struct msi_dialog_tag msi_dialog; ...@@ -338,6 +338,7 @@ typedef struct msi_dialog_tag msi_dialog;
enum platform enum platform
{ {
PLATFORM_UNKNOWN,
PLATFORM_INTEL, PLATFORM_INTEL,
PLATFORM_INTEL64, PLATFORM_INTEL64,
PLATFORM_X64, PLATFORM_X64,
......
...@@ -1269,9 +1269,18 @@ UINT msi_create_empty_local_file( LPWSTR path, LPCWSTR suffix ) ...@@ -1269,9 +1269,18 @@ UINT msi_create_empty_local_file( LPWSTR path, LPCWSTR suffix )
return ERROR_SUCCESS; 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 ) static UINT msi_parse_summary( MSISUMMARYINFO *si, MSIPACKAGE *package )
{ {
WCHAR *template, *p, *q; WCHAR *template, *p, *q, *platform;
DWORD i, count; DWORD i, count;
package->version = msi_suminfo_get_int32( si, PID_PAGECOUNT ); package->version = msi_suminfo_get_int32( si, PID_PAGECOUNT );
...@@ -1291,16 +1300,16 @@ static UINT msi_parse_summary( MSISUMMARYINFO *si, MSIPACKAGE *package ) ...@@ -1291,16 +1300,16 @@ static UINT msi_parse_summary( MSISUMMARYINFO *si, MSIPACKAGE *package )
return ERROR_PATCH_PACKAGE_INVALID; return ERROR_PATCH_PACKAGE_INVALID;
} }
*p = 0; *p = 0;
if ((q = strchrW( template, ',' ))) *q = 0; platform = template;
if (!template[0] || !strcmpW( template, szIntel )) if ((q = strchrW( platform, ',' ))) *q = 0;
package->platform = PLATFORM_INTEL; package->platform = parse_platform( platform );
else if (!strcmpW( template, szIntel64 )) while (package->platform == PLATFORM_UNKNOWN && q)
package->platform = PLATFORM_INTEL64; {
else if (!strcmpW( template, szX64 ) || !strcmpW( template, szAMD64 )) platform = q + 1;
package->platform = PLATFORM_X64; if ((q = strchrW( platform, ',' ))) *q = 0;
else if (!strcmpW( template, szARM )) package->platform = parse_platform( platform );
package->platform = PLATFORM_ARM; }
else if (package->platform == PLATFORM_UNKNOWN)
{ {
WARN("unknown platform %s\n", debugstr_w(template)); WARN("unknown platform %s\n", debugstr_w(template));
msi_free( template ); msi_free( template );
......
...@@ -6295,6 +6295,14 @@ static void test_package_validation(void) ...@@ -6295,6 +6295,14 @@ static void test_package_validation(void)
ok(delete_pf("msitest", FALSE), "directory does not exist\n"); ok(delete_pf("msitest", FALSE), "directory does not exist\n");
DeleteFile(msifile); 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"); create_database_template(msifile, pv_tables, sizeof(pv_tables)/sizeof(msi_table), 100, "x64;0");
r = MsiInstallProductA(msifile, NULL); r = MsiInstallProductA(msifile, NULL);
......
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