From 86c91483d27f4d27181cfce60d450ba7f328230a Mon Sep 17 00:00:00 2001 From: Nir Bar Date: Tue, 16 Jun 2020 15:09:21 +0300 Subject: [PATCH] Add Bundle attribute RunAsAdmin See https://github.com/wixtoolset/issues/issues/5309 See https://github.com/wixtoolset/issues/issues/5431 See https://github.com/wixtoolset/issues/issues/4972 --- Readme.md | 1 + src/Setup/Nupkg/WiX.nuspec | 1 + src/Setup/Zip/binaries.zipproj | 3 +++ src/burn/burn.proj | 1 + src/burn/stub/Stub-admin.vcxproj | 21 +++++++++++++++++++++ src/burn/stub/Stub.vcxproj | 2 +- src/burn/stub/stub-admin.manifest | 17 +++++++++++++++++ src/tools/wix/Binder.cs | 2 +- src/tools/wix/Compiler.cs | 5 +++++ src/tools/wix/Data/tables.xml | 1 + src/tools/wix/WixBundleRow.cs | 6 ++++++ src/tools/wix/Xsd/wix.xsd | 5 +++++ 12 files changed, 63 insertions(+), 2 deletions(-) create mode 100644 src/burn/stub/Stub-admin.vcxproj create mode 100644 src/burn/stub/stub-admin.manifest diff --git a/Readme.md b/Readme.md index 081e78ad9..57d1235ec 100644 --- a/Readme.md +++ b/Readme.md @@ -2,6 +2,7 @@ [Panel::Software](http://www.panel-sw.co.il) provides a customized edition of WiX built on top of WiX 3.11.2 with the following changes +- [Bundle/@RunAsAdmin](https://github.com/wixtoolset/issues/issues/5309) attribute created a bootstrapper that requires elevation when launched - [RemotePayload](https://wixtoolset.org/documentation/manual/v3/xsd/wix/remotepayload.html) can be specified on any package payload rather than the main setup file - Add [heat.exe](https://wixtoolset.org/documentation/manual/v3/overview/heat.html) harvest type "payload_dir" to harvest a PayloadGroup. Specify _-url link_ to set base DownloadUrl for remote paylodas - Fix WiX issue [6144](https://github.com/wixtoolset/issues/issues/6144): Support multiple attached containers in bundles. Allow bootstrappers larger than 2GB diff --git a/src/Setup/Nupkg/WiX.nuspec b/src/Setup/Nupkg/WiX.nuspec index 177926ff9..c6e5a1f19 100644 --- a/src/Setup/Nupkg/WiX.nuspec +++ b/src/Setup/Nupkg/WiX.nuspec @@ -83,6 +83,7 @@ + diff --git a/src/Setup/Zip/binaries.zipproj b/src/Setup/Zip/binaries.zipproj index 3d6fe336c..9a97baf0b 100644 --- a/src/Setup/Zip/binaries.zipproj +++ b/src/Setup/Zip/binaries.zipproj @@ -52,6 +52,9 @@ x86 + + x86 + arm diff --git a/src/burn/burn.proj b/src/burn/burn.proj index 0e80f8192..3c5c402c5 100644 --- a/src/burn/burn.proj +++ b/src/burn/burn.proj @@ -9,6 +9,7 @@ + diff --git a/src/burn/stub/Stub-admin.vcxproj b/src/burn/stub/Stub-admin.vcxproj new file mode 100644 index 000000000..191d73800 --- /dev/null +++ b/src/burn/stub/Stub-admin.vcxproj @@ -0,0 +1,21 @@ + + + + + + + burn-admin + + + + + + + + + + + RequireAdministrator + + + diff --git a/src/burn/stub/Stub.vcxproj b/src/burn/stub/Stub.vcxproj index d8cc80b58..ae4741210 100644 --- a/src/burn/stub/Stub.vcxproj +++ b/src/burn/stub/Stub.vcxproj @@ -27,7 +27,7 @@ Win32Proj Application Unicode - burn + burn diff --git a/src/burn/stub/stub-admin.manifest b/src/burn/stub/stub-admin.manifest new file mode 100644 index 000000000..cd5cefc28 --- /dev/null +++ b/src/burn/stub/stub-admin.manifest @@ -0,0 +1,17 @@ + + + + + + + WiX Toolset Bootstrapper + + + + + + + + + + diff --git a/src/tools/wix/Binder.cs b/src/tools/wix/Binder.cs index 9bfd7d82f..a6bbb9991 100644 --- a/src/tools/wix/Binder.cs +++ b/src/tools/wix/Binder.cs @@ -3813,7 +3813,7 @@ private bool BindBundle(Output bundle, string bundleFile) stubPlatform = bundleInfo.Platform.ToString(); } string wixExeDirectory = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), stubPlatform); - string stubFile = Path.Combine(wixExeDirectory, "burn.exe"); + string stubFile = Path.Combine(wixExeDirectory, bundleInfo.RunAsAdmin ? "burn-admin.exe" : "burn.exe"); string bundleTempPath = Path.Combine(this.TempFilesLocation, Path.GetFileName(bundleFile)); this.core.OnMessage(WixVerboses.GeneratingBundle(bundleTempPath, stubFile)); diff --git a/src/tools/wix/Compiler.cs b/src/tools/wix/Compiler.cs index 8b8dd5ba2..1827b759f 100644 --- a/src/tools/wix/Compiler.cs +++ b/src/tools/wix/Compiler.cs @@ -19929,6 +19929,7 @@ private void ParseBundleElement(XmlNode node) string logVariablePrefixAndExtension = null; string iconSourceFile = null; string splashScreenSourceFile = null; + YesNoType runAsAdmin = YesNoType.No; // Process only standard attributes until the active section is initialized. foreach (XmlAttribute attrib in node.Attributes) @@ -19994,6 +19995,9 @@ private void ParseBundleElement(XmlNode node) case "SplashScreenSourceFile": splashScreenSourceFile = this.core.GetAttributeValue(sourceLineNumbers, attrib); break; + case "RunAsAdmin": + runAsAdmin = this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib); + break; case "Tag": tag = this.core.GetAttributeValue(sourceLineNumbers, attrib); break; @@ -20194,6 +20198,7 @@ private void ParseBundleElement(XmlNode node) row[17] = this.currentPlatform.ToString(); row[18] = parentName; row[19] = upgradeCode; + row[23] = (runAsAdmin == YesNoType.Yes) ? 1 : 0; } } diff --git a/src/tools/wix/Data/tables.xml b/src/tools/wix/Data/tables.xml index f7cc92118..88ee39789 100644 --- a/src/tools/wix/Data/tables.xml +++ b/src/tools/wix/Data/tables.xml @@ -1668,6 +1668,7 @@ + diff --git a/src/tools/wix/WixBundleRow.cs b/src/tools/wix/WixBundleRow.cs index b81cff3bd..4061d582e 100644 --- a/src/tools/wix/WixBundleRow.cs +++ b/src/tools/wix/WixBundleRow.cs @@ -224,5 +224,11 @@ public bool PerMachine get { return (null != this.Fields[22].Data && 0 != (int)this.Fields[22].Data); } set { this.Fields[22].Data = value ? 1 : 0; } } + + public bool RunAsAdmin + { + get { return (null != this.Fields[23].Data && 0 != (int)this.Fields[23].Data); } + set { this.Fields[23].Data = value ? 1 : 0; } + } } } diff --git a/src/tools/wix/Xsd/wix.xsd b/src/tools/wix/Xsd/wix.xsd index b145cc3f8..f09a12783 100644 --- a/src/tools/wix/Xsd/wix.xsd +++ b/src/tools/wix/Xsd/wix.xsd @@ -195,6 +195,11 @@ + + + Whether the bootstrapper shoule be launched with admin rights. Defaults to 'no'. It is strongly encouraged to launch the bootstrapper with least required privileges, and let WiX elevate as late as possible. However when absolutely required to, set this attribute to 'yes' to launch elevated + + Path to a bitmap that will be shown as the bootstrapper application is being loaded. If this attribute is not specified, no splash screen will be displayed.