[3/3] msi: Improve parsing of the supported platforms string.
Hans Leidekker
hans at codeweavers.com
Thu Jan 31 08:11:38 CST 2013
---
dlls/msi/msipriv.h | 1 +
dlls/msi/package.c | 31 ++++++++++++++++++++-----------
dlls/msi/tests/install.c | 8 ++++++++
3 files changed, 29 insertions(+), 11 deletions(-)
diff --git a/dlls/msi/msipriv.h b/dlls/msi/msipriv.h
index f709bac..c477405 100644
--- a/dlls/msi/msipriv.h
+++ b/dlls/msi/msipriv.h
@@ -338,6 +338,7 @@ typedef struct msi_dialog_tag msi_dialog;
enum platform
{
+ PLATFORM_UNKNOWN,
PLATFORM_INTEL,
PLATFORM_INTEL64,
PLATFORM_X64,
diff --git a/dlls/msi/package.c b/dlls/msi/package.c
index db0ec25..385000c 100644
--- a/dlls/msi/package.c
+++ b/dlls/msi/package.c
@@ -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 );
diff --git a/dlls/msi/tests/install.c b/dlls/msi/tests/install.c
index 0cf9347..e063a87 100644
--- a/dlls/msi/tests/install.c
+++ b/dlls/msi/tests/install.c
@@ -6295,6 +6295,14 @@ static void test_package_validation(void)
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");
r = MsiInstallProductA(msifile, NULL);
--
1.7.10.4
More information about the wine-patches
mailing list