[5/5] msi: Only apply a transform when its language id matches the system language id.
Hans Leidekker
hans at codeweavers.com
Tue Mar 24 04:26:42 CDT 2009
Fix for office 2007 sp1 installer.
-Hans
diff --git a/dlls/msi/action.c b/dlls/msi/action.c
index eb07f22..ce038a1 100644
--- a/dlls/msi/action.c
+++ b/dlls/msi/action.c
@@ -401,9 +401,13 @@ static LPWSTR* msi_split_string( LPCWSTR str, WCHAR sep )
static UINT msi_check_transform_applicable( MSIPACKAGE *package, IStorage *patch )
{
- WCHAR szProductCode[] = { 'P','r','o','d','u','c','t','C','o','d','e',0 };
- LPWSTR prod_code, patch_product;
- UINT ret;
+ static const WCHAR szProductCode[] =
+ { 'P','r','o','d','u','c','t','C','o','d','e',0 };
+ static const WCHAR szSystemLanguageID[] =
+ { 'S','y','s','t','e','m','L','a','n','g','u','a','g','e','I','D',0 };
+
+ LPWSTR prod_code, patch_product, langid = NULL, template = NULL;
+ UINT ret = ERROR_FUNCTION_FAILED;
prod_code = msi_dup_property( package, szProductCode );
patch_product = msi_get_suminfo_product( patch );
@@ -411,12 +415,57 @@ static UINT msi_check_transform_applicable( MSIPACKAGE *package, IStorage *patch
TRACE("db = %s patch = %s\n", debugstr_w(prod_code), debugstr_w(patch_product));
if ( strstrW( patch_product, prod_code ) )
- ret = ERROR_SUCCESS;
- else
- ret = ERROR_FUNCTION_FAILED;
+ {
+ static const WCHAR zero[] = {'0',0};
+ MSISUMMARYINFO *si;
+ const WCHAR *p;
+
+ si = MSI_GetSummaryInformationW( patch, 0 );
+ if (!si)
+ {
+ ERR("no summary information!\n");
+ goto end;
+ }
+ template = msi_suminfo_dup_string( si, PID_TEMPLATE );
+ if (!template)
+ {
+ ERR("no template property!\n");
+ msiobj_release( &si->hdr );
+ goto end;
+ }
+
+ if (!template[0])
+ {
+ ret = ERROR_SUCCESS;
+ msiobj_release( &si->hdr );
+ goto end;
+ }
+
+ langid = msi_dup_property( package, szSystemLanguageID );
+ if (!langid)
+ {
+ msiobj_release( &si->hdr );
+ goto end;
+ }
+
+ p = strchrW( template, ';' );
+ if (p && (!strcmpW( p + 1, langid ) || !strcmpW( p + 1, zero )))
+ {
+ TRACE("applicable transform\n");
+ ret = ERROR_SUCCESS;
+ }
+
+ /* FIXME: check platform */
+
+ msiobj_release( &si->hdr );
+ }
+
+end:
msi_free( patch_product );
msi_free( prod_code );
+ msi_free( template );
+ msi_free( langid );
return ret;
}
diff --git a/dlls/msi/package.c b/dlls/msi/package.c
index 378ad76..b2c46a2 100644
--- a/dlls/msi/package.c
+++ b/dlls/msi/package.c
@@ -440,11 +440,12 @@ static VOID set_installer_properties(MSIPACKAGE *package)
static const WCHAR szDate[] = {'D','a','t','e',0};
static const WCHAR szTime[] = {'T','i','m','e',0};
static const WCHAR szUserLangID[] = {'U','s','e','r','L','a','n','g','u','a','g','e','I','D',0};
+ static const WCHAR szSystemLangID[] = {'S','y','s','t','e','m','L','a','n','g','u','a','g','e','I','D',0};
/*
* Other things that probably should be set:
*
- * SystemLanguageID ComputerName UserLanguageID LogonUser VirtualMemory
+ * ComputerName LogonUser VirtualMemory
* ShellAdvSupport DefaultUIFont PackagecodeChanging
* ProductState CaptionHeight BorderTop BorderSide TextHeight
* RedirectedDllSupport
@@ -640,6 +641,11 @@ static VOID set_installer_properties(MSIPACKAGE *package)
sprintfW(bufstr, szIntFormat, langid);
MSI_SetPropertyW( package, szUserLangID, bufstr );
+
+ langid = GetSystemDefaultLangID();
+ sprintfW(bufstr, szIntFormat, langid);
+
+ MSI_SetPropertyW( package, szSystemLangID, bufstr );
}
static UINT msi_load_summary_properties( MSIPACKAGE *package )
More information about the wine-patches
mailing list