aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Core.WindowsInstaller/Bind/AttachPatchTransformsCommand.cs
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2021-04-02 14:41:49 -0700
committerRob Mensching <rob@firegiant.com>2021-04-02 14:58:00 -0700
commit4449fcc5b8d104817c67135229682c66c3d892ca (patch)
tree327f617de2e296ddb4e62c50bf07ec8b5dcf0a3e /src/WixToolset.Core.WindowsInstaller/Bind/AttachPatchTransformsCommand.cs
parent9cca339473d77c7036035f949239f5231c325968 (diff)
downloadwix-4449fcc5b8d104817c67135229682c66c3d892ca.tar.gz
wix-4449fcc5b8d104817c67135229682c66c3d892ca.tar.bz2
wix-4449fcc5b8d104817c67135229682c66c3d892ca.zip
Enable codepages and languages to be set via .wxl files
Fixes wixtoolset/issues#5801
Diffstat (limited to 'src/WixToolset.Core.WindowsInstaller/Bind/AttachPatchTransformsCommand.cs')
-rw-r--r--src/WixToolset.Core.WindowsInstaller/Bind/AttachPatchTransformsCommand.cs26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/AttachPatchTransformsCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/AttachPatchTransformsCommand.cs
index 5f8df92c..76bcd532 100644
--- a/src/WixToolset.Core.WindowsInstaller/Bind/AttachPatchTransformsCommand.cs
+++ b/src/WixToolset.Core.WindowsInstaller/Bind/AttachPatchTransformsCommand.cs
@@ -91,15 +91,15 @@ namespace WixToolset.Core.WindowsInstaller.Bind
91 var symbols = this.Intermediate.Sections.SelectMany(s => s.Symbols).ToList(); 91 var symbols = this.Intermediate.Sections.SelectMany(s => s.Symbols).ToList();
92 92
93 // Get the patch id from the WixPatchId symbol. 93 // Get the patch id from the WixPatchId symbol.
94 var patchIdSymbol = symbols.OfType<WixPatchIdSymbol>().FirstOrDefault(); 94 var patchSymbol = symbols.OfType<WixPatchSymbol>().FirstOrDefault();
95 95
96 if (String.IsNullOrEmpty(patchIdSymbol.Id?.Id)) 96 if (String.IsNullOrEmpty(patchSymbol.Id?.Id))
97 { 97 {
98 this.Messaging.Write(ErrorMessages.ExpectedPatchIdInWixMsp()); 98 this.Messaging.Write(ErrorMessages.ExpectedPatchIdInWixMsp());
99 return subStorages; 99 return subStorages;
100 } 100 }
101 101
102 if (String.IsNullOrEmpty(patchIdSymbol.ClientPatchId)) 102 if (String.IsNullOrEmpty(patchSymbol.ClientPatchId))
103 { 103 {
104 this.Messaging.Write(ErrorMessages.ExpectedClientPatchIdInWixMsp()); 104 this.Messaging.Write(ErrorMessages.ExpectedClientPatchIdInWixMsp());
105 return subStorages; 105 return subStorages;
@@ -115,7 +115,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
115 } 115 }
116 116
117 // populate MSP summary information 117 // populate MSP summary information
118 var patchMetadata = this.PopulateSummaryInformation(summaryInfo, symbols, patchIdSymbol, section.Codepage); 118 var patchMetadata = this.PopulateSummaryInformation(summaryInfo, symbols, patchSymbol);
119 119
120 // enumerate transforms 120 // enumerate transforms
121 var productCodes = new SortedSet<string>(); 121 var productCodes = new SortedSet<string>();
@@ -168,7 +168,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
168 mainTransform.Transform.Tables.Remove("Media"); 168 mainTransform.Transform.Tables.Remove("Media");
169 mainTransform.Transform.Tables.Remove("MsiDigitalSignature"); 169 mainTransform.Transform.Tables.Remove("MsiDigitalSignature");
170 170
171 var pairedTransform = this.BuildPairedTransform(summaryInfo, patchMetadata, patchIdSymbol, mainTransform.Transform, mediaSymbol, baselineSymbol, out var productCode); 171 var pairedTransform = this.BuildPairedTransform(summaryInfo, patchMetadata, patchSymbol, mainTransform.Transform, mediaSymbol, baselineSymbol, out var productCode);
172 172
173 productCode = productCode.ToUpperInvariant(); 173 productCode = productCode.ToUpperInvariant();
174 productCodes.Add(productCode); 174 productCodes.Add(productCode);
@@ -211,14 +211,14 @@ namespace WixToolset.Core.WindowsInstaller.Bind
211 productCodes = FinalizePatchProductCodes(symbols, productCodes); 211 productCodes = FinalizePatchProductCodes(symbols, productCodes);
212 212
213 // Semicolon delimited list of the product codes that can accept the patch. 213 // Semicolon delimited list of the product codes that can accept the patch.
214 summaryInfo.Add(SummaryInformationType.PatchProductCodes, new SummaryInformationSymbol(patchIdSymbol.SourceLineNumbers) 214 summaryInfo.Add(SummaryInformationType.PatchProductCodes, new SummaryInformationSymbol(patchSymbol.SourceLineNumbers)
215 { 215 {
216 PropertyId = SummaryInformationType.PatchProductCodes, 216 PropertyId = SummaryInformationType.PatchProductCodes,
217 Value = String.Join(";", productCodes) 217 Value = String.Join(";", productCodes)
218 }); 218 });
219 219
220 // Semicolon delimited list of transform substorage names in the order they are applied. 220 // Semicolon delimited list of transform substorage names in the order they are applied.
221 summaryInfo.Add(SummaryInformationType.TransformNames, new SummaryInformationSymbol(patchIdSymbol.SourceLineNumbers) 221 summaryInfo.Add(SummaryInformationType.TransformNames, new SummaryInformationSymbol(patchSymbol.SourceLineNumbers)
222 { 222 {
223 PropertyId = SummaryInformationType.TransformNames, 223 PropertyId = SummaryInformationType.TransformNames,
224 Value = String.Join(";", transformNames) 224 Value = String.Join(";", transformNames)
@@ -262,25 +262,25 @@ namespace WixToolset.Core.WindowsInstaller.Bind
262 return result; 262 return result;
263 } 263 }
264 264
265 private Dictionary<string, MsiPatchMetadataSymbol> PopulateSummaryInformation(Dictionary<SummaryInformationType, SummaryInformationSymbol> summaryInfo, List<IntermediateSymbol> symbols, WixPatchIdSymbol patchIdSymbol, int codepage) 265 private Dictionary<string, MsiPatchMetadataSymbol> PopulateSummaryInformation(Dictionary<SummaryInformationType, SummaryInformationSymbol> summaryInfo, List<IntermediateSymbol> symbols, WixPatchSymbol patchSymbol)
266 { 266 {
267 // PID_CODEPAGE 267 // PID_CODEPAGE
268 if (!summaryInfo.ContainsKey(SummaryInformationType.Codepage)) 268 if (!summaryInfo.ContainsKey(SummaryInformationType.Codepage))
269 { 269 {
270 // Set the code page by default to the same code page for the 270 // Set the code page by default to the same code page for the
271 // string pool in the database. 271 // string pool in the database.
272 AddSummaryInformation(SummaryInformationType.Codepage, codepage.ToString(CultureInfo.InvariantCulture), patchIdSymbol.SourceLineNumbers); 272 AddSummaryInformation(SummaryInformationType.Codepage, patchSymbol.Codepage?.ToString(CultureInfo.InvariantCulture) ?? "0", patchSymbol.SourceLineNumbers);
273 } 273 }
274 274
275 // GUID patch code for the patch. 275 // GUID patch code for the patch.
276 AddSummaryInformation(SummaryInformationType.PatchCode, patchIdSymbol.Id.Id, patchIdSymbol.SourceLineNumbers); 276 AddSummaryInformation(SummaryInformationType.PatchCode, patchSymbol.Id.Id, patchSymbol.SourceLineNumbers);
277 277
278 // Indicates the minimum Windows Installer version that is required to install the patch. 278 // Indicates the minimum Windows Installer version that is required to install the patch.
279 AddSummaryInformation(SummaryInformationType.PatchInstallerRequirement, ((int)SummaryInformation.InstallerRequirement.Version31).ToString(CultureInfo.InvariantCulture), patchIdSymbol.SourceLineNumbers); 279 AddSummaryInformation(SummaryInformationType.PatchInstallerRequirement, ((int)SummaryInformation.InstallerRequirement.Version31).ToString(CultureInfo.InvariantCulture), patchSymbol.SourceLineNumbers);
280 280
281 if (!summaryInfo.ContainsKey(SummaryInformationType.Security)) 281 if (!summaryInfo.ContainsKey(SummaryInformationType.Security))
282 { 282 {
283 AddSummaryInformation(SummaryInformationType.Security, "4", patchIdSymbol.SourceLineNumbers); // Read-only enforced; 283 AddSummaryInformation(SummaryInformationType.Security, "4", patchSymbol.SourceLineNumbers); // Read-only enforced;
284 } 284 }
285 285
286 // Use authored comments or default to display name. 286 // Use authored comments or default to display name.
@@ -1090,7 +1090,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind
1090 /// <summary> 1090 /// <summary>
1091 /// Create the #transform for the given main transform. 1091 /// Create the #transform for the given main transform.
1092 /// </summary> 1092 /// </summary>
1093 private WindowsInstallerData BuildPairedTransform(Dictionary<SummaryInformationType, SummaryInformationSymbol> summaryInfo, Dictionary<string, MsiPatchMetadataSymbol> patchMetadata, WixPatchIdSymbol patchIdSymbol, WindowsInstallerData mainTransform, MediaSymbol mediaSymbol, WixPatchBaselineSymbol baselineSymbol, out string productCode) 1093 private WindowsInstallerData BuildPairedTransform(Dictionary<SummaryInformationType, SummaryInformationSymbol> summaryInfo, Dictionary<string, MsiPatchMetadataSymbol> patchMetadata, WixPatchSymbol patchIdSymbol, WindowsInstallerData mainTransform, MediaSymbol mediaSymbol, WixPatchBaselineSymbol baselineSymbol, out string productCode)
1094 { 1094 {
1095 productCode = null; 1095 productCode = null;
1096 1096