@joebigelow / wix / commits / bfba90f1

Replace Win64 attribute with Bitness attribute

Rob Mensching committed Feb 11, 2021 at 15:22 UTC bfba90f1714724ab661e43af5cc48bc148bdef70
4 files changed +37 -8
global.json
+1 -1
@@ -1,6 +1,6 @@
1 {
2 "msbuild-sdks": {
3 - "WixToolset.Sdk": "4.0.0-build-0186"
3 + "WixToolset.Sdk": "4.0.0-build-0188"
4 },
5 "sdk": {
6 "allowPrerelease": false
src/test/WixToolsetTest.Util/TestData/BundleWithSearches/Bundle.wxs
+13 -1
@@ -1,10 +1,11 @@
1 -<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util">
1 +<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util">
2 <Bundle Name="!(loc.BundleName)" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="047730a5-30fe-4a62-a520-da9381b8226a">
3 <BootstrapperApplication>
4 <BootstrapperApplicationDll SourceFile="fakeba.dll" />
5 </BootstrapperApplication>
6
7 <util:RegistrySearchRef Id="RegistrySearchId" />
8 + <util:RegistrySearchRef Id="RegistrySearchId64" />
9 <util:ProductSearchRef Id="ProductSearchId" />
10 <util:FileSearchRef Id="FileSearchId" />
11 <util:WindowsFeatureSearchRef Id="DetectSHA2SupportId" />
@@ -26,6 +27,17 @@
27 Result="value" />
28 </Fragment>
29
30 + <Fragment>
31 + <util:RegistrySearch
32 + Id="RegistrySearchId64"
33 + Variable="RegistrySearchVariable64"
34 + Root="HKLM"
35 + Key="SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full"
36 + Value="Release"
37 + Result="value"
38 + Bitness="always64" />
39 + </Fragment>
40 +
41 <Fragment>
42 <util:ProductSearch Id="ProductSearchId" Variable="ProductSearchVariable" UpgradeCode="738D02BF-E231-4370-8209-E9FD4E1BE2A1" Condition="1 &amp; 2 &lt; 3" Result="version" />
43 </Fragment>
src/test/WixToolsetTest.Util/UtilExtensionFixture.cs
+3 -1
@@ -243,7 +243,7 @@ namespace WixToolsetTest.Util
243 "</BundleExtension>", bundleExtensionDatas[0].GetTestXml());
244
245 var utilSearches = extractResult.SelectManifestNodes("/burn:BurnManifest/*[self::burn:ExtensionSearch or self::burn:FileSearch or self::burn:MsiProductSearch or self::burn:RegistrySearch]");
246 - Assert.Equal(4, utilSearches.Count);
246 + Assert.Equal(5, utilSearches.Count);
247 Assert.Equal("<ExtensionSearch Id='DetectSHA2SupportId' Variable='IsSHA2Supported' " +
248 "ExtensionId='Wix4UtilBundleExtension_X86' />", utilSearches[0].GetTestXml());
249 Assert.Equal("<FileSearch Id='FileSearchId' Variable='FileSearchVariable' " +
@@ -252,6 +252,8 @@ namespace WixToolsetTest.Util
252 "UpgradeCode='{738D02BF-E231-4370-8209-E9FD4E1BE2A1}' Type='version' />", utilSearches[2].GetTestXml());
253 Assert.Equal("<RegistrySearch Id='RegistrySearchId' Variable='RegistrySearchVariable' " +
254 @"Root='HKLM' Key='SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full' Value='Release' Type='value' VariableType='string' />", utilSearches[3].GetTestXml());
255 + Assert.Equal("<RegistrySearch Id='RegistrySearchId64' Variable='RegistrySearchVariable64' " +
256 + @"Root='HKLM' Key='SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full' Value='Release' Type='value' Win64='yes' VariableType='string' />", utilSearches[4].GetTestXml());
257 }
258 }
259
src/wixext/UtilCompiler.cs
+20 -5
@@ -2684,7 +2684,7 @@ namespace WixToolset.Util
2684 string key = null;
2685 string value = null;
2686 var expand = YesNoType.NotSet;
2687 - var win64 = YesNoType.NotSet;
2687 + var win64 = this.Context.IsCurrentPlatform64Bit;
2688 var attributes = WixRegistrySearchAttributes.Raw | WixRegistrySearchAttributes.WantValue;
2689
2690 foreach (var attrib in element.Attributes())
@@ -2699,6 +2699,24 @@ namespace WixToolset.Util
2699 case "After":
2700 this.ParseCommonSearchAttributes(sourceLineNumbers, attrib, ref id, ref variable, ref condition, ref after);
2701 break;
2702 + case "Bitness":
2703 + var bitnessValue = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib);
2704 + switch (bitnessValue)
2705 + {
2706 + case "always32":
2707 + win64 = false;
2708 + break;
2709 + case "always64":
2710 + win64 = true;
2711 + break;
2712 + case "default":
2713 + case "":
2714 + break;
2715 + default:
2716 + this.Messaging.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, attrib.Name.LocalName, attrib.Name.LocalName, bitnessValue, "default", "always32", "always64"));
2717 + break;
2718 + }
2719 + break;
2720 case "Root":
2721 root = this.ParseHelper.GetAttributeRegistryRootValue(sourceLineNumbers, attrib, false);
2722 break;
@@ -2741,9 +2759,6 @@ namespace WixToolset.Util
2759 break;
2760 }
2761 break;
2744 - case "Win64":
2745 - win64 = this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib);
2746 - break;
2762 default:
2763 this.ParseHelper.UnexpectedAttribute(element, attrib);
2764 break;
@@ -2780,7 +2795,7 @@ namespace WixToolset.Util
2795 attributes |= WixRegistrySearchAttributes.ExpandEnvironmentVariables;
2796 }
2797
2783 - if (win64 == YesNoType.Yes)
2798 + if (win64)
2799 {
2800 attributes |= WixRegistrySearchAttributes.Win64;
2801 }