aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2020-07-19 16:19:17 +1000
committerSean Hall <r.sean.hall@gmail.com>2020-07-19 19:19:36 +1000
commit414c07f7adce9c9fd0132ab0fade0267f743f665 (patch)
treeb2c207fa0b8363e41b11e843db55cea97456bf80 /src
parent2a87b3e728fb56202d21d402cecc0bceeac49ade (diff)
downloadwix-414c07f7adce9c9fd0132ab0fade0267f743f665.tar.gz
wix-414c07f7adce9c9fd0132ab0fade0267f743f665.tar.bz2
wix-414c07f7adce9c9fd0132ab0fade0267f743f665.zip
WIXFEAT:6204 Use the new DpiAwareness attribute on BootstrapperApplication element to control the DPI awareness settings in the bundle's application manifest.
Diffstat (limited to 'src')
-rw-r--r--src/WixToolset.Core.Burn/Bundles/CreateBundleExeCommand.cs59
-rw-r--r--src/WixToolset.Core/Compiler_Bundle.cs46
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/BundleFixture.cs2
3 files changed, 98 insertions, 9 deletions
diff --git a/src/WixToolset.Core.Burn/Bundles/CreateBundleExeCommand.cs b/src/WixToolset.Core.Burn/Bundles/CreateBundleExeCommand.cs
index f804a2d8..0355cdc6 100644
--- a/src/WixToolset.Core.Burn/Bundles/CreateBundleExeCommand.cs
+++ b/src/WixToolset.Core.Burn/Bundles/CreateBundleExeCommand.cs
@@ -107,6 +107,8 @@ namespace WixToolset.Core.Burn.Bundles
107 const string asmv3Namespace = "urn:schemas-microsoft-com:asm.v3"; 107 const string asmv3Namespace = "urn:schemas-microsoft-com:asm.v3";
108 const string compatv1Namespace = "urn:schemas-microsoft-com:compatibility.v1"; 108 const string compatv1Namespace = "urn:schemas-microsoft-com:compatibility.v1";
109 const string ws2005Namespace = "http://schemas.microsoft.com/SMI/2005/WindowsSettings"; 109 const string ws2005Namespace = "http://schemas.microsoft.com/SMI/2005/WindowsSettings";
110 const string ws2016Namespace = "http://schemas.microsoft.com/SMI/2016/WindowsSettings";
111 const string ws2017Namespace = "http://schemas.microsoft.com/SMI/2017/WindowsSettings";
110 112
111 var bundleFileName = Path.GetFileName(outputPath); 113 var bundleFileName = Path.GetFileName(outputPath);
112 var bundleAssemblyVersion = windowsAssemblyVersion.ToString(); 114 var bundleAssemblyVersion = windowsAssemblyVersion.ToString();
@@ -181,13 +183,56 @@ namespace WixToolset.Core.Burn.Bundles
181 writer.WriteEndElement(); // </security> 183 writer.WriteEndElement(); // </security>
182 writer.WriteEndElement(); // </trustInfo> 184 writer.WriteEndElement(); // </trustInfo>
183 185
184 writer.WriteStartElement("application", asmv3Namespace); 186 if (bootstrapperApplicationSymbol.DpiAwareness != WixBootstrapperApplicationDpiAwarenessType.Unaware)
185 writer.WriteStartElement("windowsSettings"); 187 {
186 writer.WriteStartElement("dpiAware", ws2005Namespace); 188 string dpiAwareValue = null;
187 writer.WriteString("true"); 189 string dpiAwarenessValue = null;
188 writer.WriteEndElement(); // </application> 190 string gdiScalingValue = null;
189 writer.WriteEndElement(); // </windowSettings> 191
190 writer.WriteEndElement(); // </dpiAware> 192 switch(bootstrapperApplicationSymbol.DpiAwareness)
193 {
194 case WixBootstrapperApplicationDpiAwarenessType.GdiScaled:
195 gdiScalingValue = "true";
196 break;
197 case WixBootstrapperApplicationDpiAwarenessType.PerMonitor:
198 dpiAwareValue = "true/pm";
199 break;
200 case WixBootstrapperApplicationDpiAwarenessType.PerMonitorV2:
201 dpiAwareValue = "true/pm";
202 dpiAwarenessValue = "PerMonitorV2, PerMonitor";
203 break;
204 case WixBootstrapperApplicationDpiAwarenessType.System:
205 dpiAwareValue = "true";
206 break;
207 }
208
209 writer.WriteStartElement("application", asmv3Namespace);
210 writer.WriteStartElement("windowsSettings");
211
212 if (dpiAwareValue != null)
213 {
214 writer.WriteStartElement("dpiAware", ws2005Namespace);
215 writer.WriteString(dpiAwareValue);
216 writer.WriteEndElement();
217 }
218
219 if (dpiAwarenessValue != null)
220 {
221 writer.WriteStartElement("dpiAwareness", ws2016Namespace);
222 writer.WriteString(dpiAwarenessValue);
223 writer.WriteEndElement();
224 }
225
226 if (gdiScalingValue != null)
227 {
228 writer.WriteStartElement("gdiScaling", ws2017Namespace);
229 writer.WriteString(gdiScalingValue);
230 writer.WriteEndElement();
231 }
232
233 writer.WriteEndElement(); // </windowSettings>
234 writer.WriteEndElement(); // </application>
235 }
191 236
192 writer.WriteEndDocument(); // </assembly> 237 writer.WriteEndDocument(); // </assembly>
193 writer.Close(); 238 writer.Close();
diff --git a/src/WixToolset.Core/Compiler_Bundle.cs b/src/WixToolset.Core/Compiler_Bundle.cs
index 7cdb8ca0..d73db84d 100644
--- a/src/WixToolset.Core/Compiler_Bundle.cs
+++ b/src/WixToolset.Core/Compiler_Bundle.cs
@@ -649,6 +649,7 @@ namespace WixToolset.Core
649 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node); 649 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
650 Identifier previousId = null; 650 Identifier previousId = null;
651 var previousType = ComplexReferenceChildType.Unknown; 651 var previousType = ComplexReferenceChildType.Unknown;
652 var dpiAwareness = WixBootstrapperApplicationDpiAwarenessType.PerMonitorV2;
652 653
653 // The BootstrapperApplication element acts like a Payload element so delegate to the "Payload" attribute parsing code to parse and create a Payload entry. 654 // The BootstrapperApplication element acts like a Payload element so delegate to the "Payload" attribute parsing code to parse and create a Payload entry.
654 var id = this.ParsePayloadElementContent(node, ComplexReferenceParentType.Container, Compiler.BurnUXContainerId, previousType, previousId, false); 655 var id = this.ParsePayloadElementContent(node, ComplexReferenceParentType.Container, Compiler.BurnUXContainerId, previousType, previousId, false);
@@ -658,6 +659,40 @@ namespace WixToolset.Core
658 previousType = ComplexReferenceChildType.Payload; 659 previousType = ComplexReferenceChildType.Payload;
659 } 660 }
660 661
662 foreach (var attrib in node.Attributes())
663 {
664 if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || CompilerCore.WixNamespace == attrib.Name.Namespace)
665 {
666 switch (attrib.Name.LocalName)
667 {
668 case "DpiAwareness":
669 var dpiAwarenessValue = this.Core.GetAttributeValue(sourceLineNumbers, attrib);
670 switch (dpiAwarenessValue)
671 {
672 case "gdiScaled":
673 dpiAwareness = WixBootstrapperApplicationDpiAwarenessType.GdiScaled;
674 break;
675 case "perMonitor":
676 dpiAwareness = WixBootstrapperApplicationDpiAwarenessType.PerMonitor;
677 break;
678 case "perMonitorV2":
679 dpiAwareness = WixBootstrapperApplicationDpiAwarenessType.PerMonitorV2;
680 break;
681 case "system":
682 dpiAwareness = WixBootstrapperApplicationDpiAwarenessType.System;
683 break;
684 case "unaware":
685 dpiAwareness = WixBootstrapperApplicationDpiAwarenessType.Unaware;
686 break;
687 default:
688 this.Core.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, node.Name.LocalName, "DpiAwareness", dpiAwarenessValue, "gdiScaled", "perMonitor", "perMonitorV2", "system", "unaware"));
689 break;
690 }
691 break;
692 }
693 }
694 }
695
661 foreach (var child in node.Elements()) 696 foreach (var child in node.Elements())
662 { 697 {
663 if (CompilerCore.WixNamespace == child.Name.Namespace) 698 if (CompilerCore.WixNamespace == child.Name.Namespace)
@@ -702,7 +737,10 @@ namespace WixToolset.Core
702 737
703 if (null != id) 738 if (null != id)
704 { 739 {
705 this.Core.AddSymbol(new WixBootstrapperApplicationSymbol(sourceLineNumbers, id)); 740 this.Core.AddSymbol(new WixBootstrapperApplicationSymbol(sourceLineNumbers, id)
741 {
742 DpiAwareness = dpiAwareness,
743 });
706 } 744 }
707 } 745 }
708 } 746 }
@@ -1325,6 +1363,12 @@ namespace WixToolset.Core
1325 case "EnableSignatureVerification": 1363 case "EnableSignatureVerification":
1326 enableSignatureVerification = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib); 1364 enableSignatureVerification = this.Core.GetAttributeYesNoValue(sourceLineNumbers, attrib);
1327 break; 1365 break;
1366 case "DpiAwareness":
1367 if (node.Name.LocalName != "BootstrapperApplication")
1368 {
1369 this.Core.UnexpectedAttribute(node, attrib);
1370 }
1371 break;
1328 default: 1372 default:
1329 this.Core.UnexpectedAttribute(node, attrib); 1373 this.Core.UnexpectedAttribute(node, attrib);
1330 break; 1374 break;
diff --git a/src/test/WixToolsetTest.CoreIntegration/BundleFixture.cs b/src/test/WixToolsetTest.CoreIntegration/BundleFixture.cs
index 9c5ec6ec..5e1e5866 100644
--- a/src/test/WixToolsetTest.CoreIntegration/BundleFixture.cs
+++ b/src/test/WixToolsetTest.CoreIntegration/BundleFixture.cs
@@ -127,7 +127,7 @@ namespace WixToolsetTest.CoreIntegration
127 "<dependency><dependentAssembly><assemblyIdentity name=\"Microsoft.Windows.Common-Controls\" version=\"6.0.0.0\" processorArchitecture=\"x86\" publicKeyToken=\"6595b64144ccf1df\" language=\"*\" type=\"win32\" /></dependentAssembly></dependency>" + 127 "<dependency><dependentAssembly><assemblyIdentity name=\"Microsoft.Windows.Common-Controls\" version=\"6.0.0.0\" processorArchitecture=\"x86\" publicKeyToken=\"6595b64144ccf1df\" language=\"*\" type=\"win32\" /></dependentAssembly></dependency>" +
128 "<compatibility xmlns=\"urn:schemas-microsoft-com:compatibility.v1\"><application><supportedOS Id=\"{e2011457-1546-43c5-a5fe-008deee3d3f0}\" /><supportedOS Id=\"{35138b9a-5d96-4fbd-8e2d-a2440225f93a}\" /><supportedOS Id=\"{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}\" /><supportedOS Id=\"{1f676c76-80e1-4239-95bb-83d0f6d0da78}\" /><supportedOS Id=\"{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}\" /></application></compatibility>" + 128 "<compatibility xmlns=\"urn:schemas-microsoft-com:compatibility.v1\"><application><supportedOS Id=\"{e2011457-1546-43c5-a5fe-008deee3d3f0}\" /><supportedOS Id=\"{35138b9a-5d96-4fbd-8e2d-a2440225f93a}\" /><supportedOS Id=\"{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}\" /><supportedOS Id=\"{1f676c76-80e1-4239-95bb-83d0f6d0da78}\" /><supportedOS Id=\"{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}\" /></application></compatibility>" +
129 "<trustInfo xmlns=\"urn:schemas-microsoft-com:asm.v3\"><security><requestedPrivileges><requestedExecutionLevel level=\"asInvoker\" uiAccess=\"false\" /></requestedPrivileges></security></trustInfo>" + 129 "<trustInfo xmlns=\"urn:schemas-microsoft-com:asm.v3\"><security><requestedPrivileges><requestedExecutionLevel level=\"asInvoker\" uiAccess=\"false\" /></requestedPrivileges></security></trustInfo>" +
130 "<application xmlns=\"urn:schemas-microsoft-com:asm.v3\"><windowsSettings><dpiAware xmlns=\"http://schemas.microsoft.com/SMI/2005/WindowsSettings\">true</dpiAware></windowsSettings></application>" + 130 "<application xmlns=\"urn:schemas-microsoft-com:asm.v3\"><windowsSettings><dpiAware xmlns=\"http://schemas.microsoft.com/SMI/2005/WindowsSettings\">true/pm</dpiAware><dpiAwareness xmlns=\"http://schemas.microsoft.com/SMI/2016/WindowsSettings\">PerMonitorV2, PerMonitor</dpiAwareness></windowsSettings></application>" +
131 "</assembly>", actualManifestData); 131 "</assembly>", actualManifestData);
132 } 132 }
133 } 133 }