diff options
Diffstat (limited to 'src/ext/Util')
3 files changed, 31 insertions, 12 deletions
diff --git a/src/ext/Util/test/WixToolsetTest.Util/TestData/BundleWithSearches/Bundle.wxs b/src/ext/Util/test/WixToolsetTest.Util/TestData/BundleWithSearches/Bundle.wxs index 7fef0725..45147066 100644 --- a/src/ext/Util/test/WixToolsetTest.Util/TestData/BundleWithSearches/Bundle.wxs +++ b/src/ext/Util/test/WixToolsetTest.Util/TestData/BundleWithSearches/Bundle.wxs | |||
@@ -7,6 +7,7 @@ | |||
7 | <util:RegistrySearchRef Id="RegistrySearchId" /> | 7 | <util:RegistrySearchRef Id="RegistrySearchId" /> |
8 | <util:RegistrySearchRef Id="RegistrySearchId64" /> | 8 | <util:RegistrySearchRef Id="RegistrySearchId64" /> |
9 | <util:ProductSearchRef Id="ProductSearchId" /> | 9 | <util:ProductSearchRef Id="ProductSearchId" /> |
10 | <util:DirectorySearchRef Id="DirectorySearchId" /> | ||
10 | <util:FileSearchRef Id="FileSearchId" /> | 11 | <util:FileSearchRef Id="FileSearchId" /> |
11 | <util:WindowsFeatureSearchRef Id="DetectSHA2SupportId" /> | 12 | <util:WindowsFeatureSearchRef Id="DetectSHA2SupportId" /> |
12 | 13 | ||
@@ -43,6 +44,10 @@ | |||
43 | </Fragment> | 44 | </Fragment> |
44 | 45 | ||
45 | <Fragment> | 46 | <Fragment> |
47 | <util:DirectorySearch Id="DirectorySearchId" Variable="DirectorySearchVariable" Path="%windir%\System32" Result="exists" DisableFileRedirection="yes" /> | ||
48 | </Fragment> | ||
49 | |||
50 | <Fragment> | ||
46 | <util:FileSearch Id="FileSearchId" Variable="FileSearchVariable" Path="%windir%\System32\mscoree.dll" Result="exists" /> | 51 | <util:FileSearch Id="FileSearchId" Variable="FileSearchVariable" Path="%windir%\System32\mscoree.dll" Result="exists" /> |
47 | </Fragment> | 52 | </Fragment> |
48 | 53 | ||
diff --git a/src/ext/Util/test/WixToolsetTest.Util/UtilExtensionFixture.cs b/src/ext/Util/test/WixToolsetTest.Util/UtilExtensionFixture.cs index 32d18e9c..c7b7efb1 100644 --- a/src/ext/Util/test/WixToolsetTest.Util/UtilExtensionFixture.cs +++ b/src/ext/Util/test/WixToolsetTest.Util/UtilExtensionFixture.cs | |||
@@ -4,6 +4,7 @@ namespace WixToolsetTest.Util | |||
4 | { | 4 | { |
5 | using System.IO; | 5 | using System.IO; |
6 | using System.Linq; | 6 | using System.Linq; |
7 | using System.Xml; | ||
7 | using WixBuildTools.TestSupport; | 8 | using WixBuildTools.TestSupport; |
8 | using WixToolset.Core.TestPackage; | 9 | using WixToolset.Core.TestPackage; |
9 | using WixToolset.Util; | 10 | using WixToolset.Util; |
@@ -279,18 +280,19 @@ namespace WixToolsetTest.Util | |||
279 | "<WixWindowsFeatureSearch Id='DetectSHA2SupportId' Type='sha2CodeSigning' />" + | 280 | "<WixWindowsFeatureSearch Id='DetectSHA2SupportId' Type='sha2CodeSigning' />" + |
280 | "</BundleExtension>", bundleExtensionDatas[0].GetTestXml()); | 281 | "</BundleExtension>", bundleExtensionDatas[0].GetTestXml()); |
281 | 282 | ||
282 | var utilSearches = extractResult.SelectManifestNodes("/burn:BurnManifest/*[self::burn:ExtensionSearch or self::burn:FileSearch or self::burn:MsiProductSearch or self::burn:RegistrySearch]"); | 283 | var utilSearches = extractResult.SelectManifestNodes("/burn:BurnManifest/*[self::burn:ExtensionSearch or self::burn:DirectorySearch or self::burn:FileSearch or self::burn:MsiProductSearch or self::burn:RegistrySearch]") |
283 | Assert.Equal(5, utilSearches.Count); | 284 | .Cast<XmlElement>() |
284 | Assert.Equal("<ExtensionSearch Id='DetectSHA2SupportId' Variable='IsSHA2Supported' " + | 285 | .Select(e => e.GetTestXml()) |
285 | "ExtensionId='Wix4UtilBundleExtension_X86' />", utilSearches[0].GetTestXml()); | 286 | .ToArray(); |
286 | Assert.Equal("<FileSearch Id='FileSearchId' Variable='FileSearchVariable' " + | 287 | WixAssert.CompareLineByLine(new[] |
287 | $@"Path='%windir%\System32\mscoree.dll' Type='exists' />", utilSearches[1].GetTestXml()); | 288 | { |
288 | Assert.Equal("<MsiProductSearch Id='ProductSearchId' Variable='ProductSearchVariable' Condition='1 & 2 < 3' " + | 289 | @"<ExtensionSearch Id='DetectSHA2SupportId' Variable='IsSHA2Supported' ExtensionId='Wix4UtilBundleExtension_X86' />", |
289 | "UpgradeCode='{738D02BF-E231-4370-8209-E9FD4E1BE2A1}' Type='version' />", utilSearches[2].GetTestXml()); | 290 | @"<DirectorySearch Id='DirectorySearchId' Variable='DirectorySearchVariable' Path='%windir%\System32' Type='exists' DisableFileRedirection='yes' />", |
290 | Assert.Equal("<RegistrySearch Id='RegistrySearchId' Variable='RegistrySearchVariable' " + | 291 | @"<FileSearch Id='FileSearchId' Variable='FileSearchVariable' Path='%windir%\System32\mscoree.dll' Type='exists' />", |
291 | @"Root='HKLM' Key='SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full' Value='Release' Type='value' VariableType='string' />", utilSearches[3].GetTestXml()); | 292 | @"<MsiProductSearch Id='ProductSearchId' Variable='ProductSearchVariable' Condition='1 & 2 < 3' UpgradeCode='{738D02BF-E231-4370-8209-E9FD4E1BE2A1}' Type='version' />", |
292 | Assert.Equal("<RegistrySearch Id='RegistrySearchId64' Variable='RegistrySearchVariable64' " + | 293 | @"<RegistrySearch Id='RegistrySearchId' Variable='RegistrySearchVariable' Root='HKLM' Key='SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full' Value='Release' Type='value' VariableType='string' />", |
293 | @"Root='HKLM' Key='SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full' Value='Release' Win64='yes' Type='value' VariableType='string' />", utilSearches[4].GetTestXml()); | 294 | @"<RegistrySearch Id='RegistrySearchId64' Variable='RegistrySearchVariable64' Root='HKLM' Key='SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full' Value='Release' Win64='yes' Type='value' VariableType='string' />" |
295 | }, utilSearches); | ||
294 | } | 296 | } |
295 | } | 297 | } |
296 | 298 | ||
diff --git a/src/ext/Util/wixext/UtilCompiler.cs b/src/ext/Util/wixext/UtilCompiler.cs index 323e0f6a..d770555f 100644 --- a/src/ext/Util/wixext/UtilCompiler.cs +++ b/src/ext/Util/wixext/UtilCompiler.cs | |||
@@ -999,6 +999,12 @@ namespace WixToolset.Util | |||
999 | case "After": | 999 | case "After": |
1000 | this.ParseCommonSearchAttributes(sourceLineNumbers, attrib, ref id, ref variable, ref condition, ref after); | 1000 | this.ParseCommonSearchAttributes(sourceLineNumbers, attrib, ref id, ref variable, ref condition, ref after); |
1001 | break; | 1001 | break; |
1002 | case "DisableFileRedirection": | ||
1003 | if (this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib) == YesNoType.Yes) | ||
1004 | { | ||
1005 | attributes |= WixFileSearchAttributes.DisableFileRedirection; | ||
1006 | } | ||
1007 | break; | ||
1002 | case "Path": | 1008 | case "Path": |
1003 | path = this.ParseHelper.GetAttributeLongFilename(sourceLineNumbers, attrib, false, true); | 1009 | path = this.ParseHelper.GetAttributeLongFilename(sourceLineNumbers, attrib, false, true); |
1004 | break; | 1010 | break; |
@@ -1104,6 +1110,12 @@ namespace WixToolset.Util | |||
1104 | case "After": | 1110 | case "After": |
1105 | this.ParseCommonSearchAttributes(sourceLineNumbers, attrib, ref id, ref variable, ref condition, ref after); | 1111 | this.ParseCommonSearchAttributes(sourceLineNumbers, attrib, ref id, ref variable, ref condition, ref after); |
1106 | break; | 1112 | break; |
1113 | case "DisableFileRedirection": | ||
1114 | if (this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib) == YesNoType.Yes) | ||
1115 | { | ||
1116 | attributes |= WixFileSearchAttributes.DisableFileRedirection; | ||
1117 | } | ||
1118 | break; | ||
1107 | case "Path": | 1119 | case "Path": |
1108 | path = this.ParseHelper.GetAttributeLongFilename(sourceLineNumbers, attrib, false, true); | 1120 | path = this.ParseHelper.GetAttributeLongFilename(sourceLineNumbers, attrib, false, true); |
1109 | break; | 1121 | break; |