diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2022-04-27 16:54:28 -0500 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2022-04-28 14:23:08 -0500 |
commit | 681da11cfc9a266304b47b88843cb8a365015c63 (patch) | |
tree | d670f3a45d15d1fe43c8d5dee04b2dac548d8cf6 | |
parent | 7860559202d01cef07a9996d2c12606ac8d56221 (diff) | |
download | wix-681da11cfc9a266304b47b88843cb8a365015c63.tar.gz wix-681da11cfc9a266304b47b88843cb8a365015c63.tar.bz2 wix-681da11cfc9a266304b47b88843cb8a365015c63.zip |
Add ability to disable file system redirection for File/DirectorySearch
Fixes 5476
-rw-r--r-- | src/api/wix/WixToolset.Data/Symbols/WixFileSearchSymbol.cs | 17 | ||||
-rw-r--r-- | src/burn/engine/search.cpp | 114 | ||||
-rw-r--r-- | src/burn/engine/search.h | 1 | ||||
-rw-r--r-- | src/burn/test/BurnUnitTest/SearchTest.cpp | 12 | ||||
-rw-r--r-- | src/ext/Util/test/WixToolsetTest.Util/TestData/BundleWithSearches/Bundle.wxs | 5 | ||||
-rw-r--r-- | src/ext/Util/test/WixToolsetTest.Util/UtilExtensionFixture.cs | 26 | ||||
-rw-r--r-- | src/ext/Util/wixext/UtilCompiler.cs | 12 | ||||
-rw-r--r-- | src/wix/WixToolset.Core.Burn/Bind/LegacySearchFacade.cs | 5 |
8 files changed, 179 insertions, 13 deletions
diff --git a/src/api/wix/WixToolset.Data/Symbols/WixFileSearchSymbol.cs b/src/api/wix/WixToolset.Data/Symbols/WixFileSearchSymbol.cs index 4f8a370e..9c8e0843 100644 --- a/src/api/wix/WixToolset.Data/Symbols/WixFileSearchSymbol.cs +++ b/src/api/wix/WixToolset.Data/Symbols/WixFileSearchSymbol.cs | |||
@@ -54,6 +54,7 @@ namespace WixToolset.Data.Symbols | |||
54 | MaxSizeInclusive = 0x010, | 54 | MaxSizeInclusive = 0x010, |
55 | MinDateInclusive = 0x020, | 55 | MinDateInclusive = 0x020, |
56 | MaxDateInclusive = 0x040, | 56 | MaxDateInclusive = 0x040, |
57 | DisableFileRedirection = 0x080, | ||
57 | } | 58 | } |
58 | 59 | ||
59 | public enum WixFileSearchType | 60 | public enum WixFileSearchType |
@@ -246,5 +247,21 @@ namespace WixToolset.Data.Symbols | |||
246 | } | 247 | } |
247 | } | 248 | } |
248 | } | 249 | } |
250 | |||
251 | public bool DisableFileRedirection | ||
252 | { | ||
253 | get { return this.Attributes.HasFlag(WixFileSearchAttributes.DisableFileRedirection); } | ||
254 | set | ||
255 | { | ||
256 | if (value) | ||
257 | { | ||
258 | this.Attributes |= WixFileSearchAttributes.DisableFileRedirection; | ||
259 | } | ||
260 | else | ||
261 | { | ||
262 | this.Attributes &= ~WixFileSearchAttributes.DisableFileRedirection; | ||
263 | } | ||
264 | } | ||
265 | } | ||
249 | } | 266 | } |
250 | } | 267 | } |
diff --git a/src/burn/engine/search.cpp b/src/burn/engine/search.cpp index a57e703e..f521cdbd 100644 --- a/src/burn/engine/search.cpp +++ b/src/burn/engine/search.cpp | |||
@@ -139,6 +139,10 @@ extern "C" HRESULT SearchesParseFromXml( | |||
139 | hr = XmlGetAttributeEx(pixnNode, L"Path", &pSearch->FileSearch.sczPath); | 139 | hr = XmlGetAttributeEx(pixnNode, L"Path", &pSearch->FileSearch.sczPath); |
140 | ExitOnRequiredXmlQueryFailure(hr, "Failed to get @Path."); | 140 | ExitOnRequiredXmlQueryFailure(hr, "Failed to get @Path."); |
141 | 141 | ||
142 | // @DisableFileRedirection | ||
143 | hr = XmlGetYesNoAttribute(pixnNode, L"DisableFileRedirection", &pSearch->FileSearch.fDisableFileRedirection); | ||
144 | ExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get DisableFileRedirection attribute."); | ||
145 | |||
142 | // @Type | 146 | // @Type |
143 | hr = XmlGetAttributeEx(pixnNode, L"Type", &scz); | 147 | hr = XmlGetAttributeEx(pixnNode, L"Type", &scz); |
144 | ExitOnRequiredXmlQueryFailure(hr, "Failed to get @Type."); | 148 | ExitOnRequiredXmlQueryFailure(hr, "Failed to get @Type."); |
@@ -557,6 +561,49 @@ extern "C" void SearchesUninitialize( | |||
557 | 561 | ||
558 | // internal function definitions | 562 | // internal function definitions |
559 | 563 | ||
564 | #if !defined(_WIN64) | ||
565 | |||
566 | typedef struct _BURN_FILE_SEARCH | ||
567 | { | ||
568 | BURN_SEARCH* pSearch; | ||
569 | PROC_FILESYSTEMREDIRECTION pfsr; | ||
570 | } BURN_FILE_SEARCH; | ||
571 | |||
572 | static HRESULT FileSystemSearchStart( | ||
573 | __in BURN_FILE_SEARCH* pFileSearch | ||
574 | ) | ||
575 | { | ||
576 | HRESULT hr = S_OK; | ||
577 | |||
578 | if (pFileSearch->pSearch->FileSearch.fDisableFileRedirection) | ||
579 | { | ||
580 | hr = ProcDisableWowFileSystemRedirection(&pFileSearch->pfsr); | ||
581 | if (hr == E_NOTIMPL) | ||
582 | { | ||
583 | hr = S_FALSE; | ||
584 | } | ||
585 | ExitOnFailure(hr, "Failed to disable file system redirection."); | ||
586 | } | ||
587 | |||
588 | LExit: | ||
589 | return hr; | ||
590 | } | ||
591 | |||
592 | static void FileSystemSearchEnd( | ||
593 | __in BURN_FILE_SEARCH* pFileSearch | ||
594 | ) | ||
595 | { | ||
596 | HRESULT hr = S_OK; | ||
597 | |||
598 | hr = ProcRevertWowFileSystemRedirection(&pFileSearch->pfsr); | ||
599 | ExitOnFailure(hr, "Failed to revert file system redirection."); | ||
600 | |||
601 | LExit: | ||
602 | return; | ||
603 | } | ||
604 | |||
605 | #endif | ||
606 | |||
560 | static HRESULT DirectorySearchExists( | 607 | static HRESULT DirectorySearchExists( |
561 | __in BURN_SEARCH* pSearch, | 608 | __in BURN_SEARCH* pSearch, |
562 | __in BURN_VARIABLES* pVariables | 609 | __in BURN_VARIABLES* pVariables |
@@ -566,6 +613,15 @@ static HRESULT DirectorySearchExists( | |||
566 | LPWSTR sczPath = NULL; | 613 | LPWSTR sczPath = NULL; |
567 | BOOL fExists = FALSE; | 614 | BOOL fExists = FALSE; |
568 | 615 | ||
616 | #if !defined(_WIN64) | ||
617 | BURN_FILE_SEARCH bfs = { }; | ||
618 | |||
619 | bfs.pSearch = pSearch; | ||
620 | |||
621 | hr = FileSystemSearchStart(&bfs); | ||
622 | ExitOnFailure(hr, "Failed to initialize file search."); | ||
623 | #endif | ||
624 | |||
569 | // format path | 625 | // format path |
570 | hr = VariableFormatString(pVariables, pSearch->DirectorySearch.sczPath, &sczPath, NULL); | 626 | hr = VariableFormatString(pVariables, pSearch->DirectorySearch.sczPath, &sczPath, NULL); |
571 | ExitOnFailure(hr, "Failed to format variable string."); | 627 | ExitOnFailure(hr, "Failed to format variable string."); |
@@ -593,6 +649,10 @@ static HRESULT DirectorySearchExists( | |||
593 | ExitOnFailure(hr, "Failed to set variable."); | 649 | ExitOnFailure(hr, "Failed to set variable."); |
594 | 650 | ||
595 | LExit: | 651 | LExit: |
652 | #if !defined(_WIN64) | ||
653 | FileSystemSearchEnd(&bfs); | ||
654 | #endif | ||
655 | |||
596 | StrSecureZeroFreeString(sczPath); | 656 | StrSecureZeroFreeString(sczPath); |
597 | 657 | ||
598 | return hr; | 658 | return hr; |
@@ -606,6 +666,15 @@ static HRESULT DirectorySearchPath( | |||
606 | HRESULT hr = S_OK; | 666 | HRESULT hr = S_OK; |
607 | LPWSTR sczPath = NULL; | 667 | LPWSTR sczPath = NULL; |
608 | 668 | ||
669 | #if !defined(_WIN64) | ||
670 | BURN_FILE_SEARCH bfs = { }; | ||
671 | |||
672 | bfs.pSearch = pSearch; | ||
673 | |||
674 | hr = FileSystemSearchStart(&bfs); | ||
675 | ExitOnFailure(hr, "Failed to initialize file search."); | ||
676 | #endif | ||
677 | |||
609 | // format path | 678 | // format path |
610 | hr = VariableFormatString(pVariables, pSearch->DirectorySearch.sczPath, &sczPath, NULL); | 679 | hr = VariableFormatString(pVariables, pSearch->DirectorySearch.sczPath, &sczPath, NULL); |
611 | ExitOnFailure(hr, "Failed to format variable string."); | 680 | ExitOnFailure(hr, "Failed to format variable string."); |
@@ -634,6 +703,10 @@ static HRESULT DirectorySearchPath( | |||
634 | ExitOnFailure(hr, "Failed while searching directory search: %ls, for path: %ls", pSearch->sczKey, sczPath); | 703 | ExitOnFailure(hr, "Failed while searching directory search: %ls, for path: %ls", pSearch->sczKey, sczPath); |
635 | 704 | ||
636 | LExit: | 705 | LExit: |
706 | #if !defined(_WIN64) | ||
707 | FileSystemSearchEnd(&bfs); | ||
708 | #endif | ||
709 | |||
637 | StrSecureZeroFreeString(sczPath); | 710 | StrSecureZeroFreeString(sczPath); |
638 | 711 | ||
639 | return hr; | 712 | return hr; |
@@ -649,6 +722,15 @@ static HRESULT FileSearchExists( | |||
649 | LPWSTR sczPath = NULL; | 722 | LPWSTR sczPath = NULL; |
650 | BOOL fExists = FALSE; | 723 | BOOL fExists = FALSE; |
651 | 724 | ||
725 | #if !defined(_WIN64) | ||
726 | BURN_FILE_SEARCH bfs = { }; | ||
727 | |||
728 | bfs.pSearch = pSearch; | ||
729 | |||
730 | hr = FileSystemSearchStart(&bfs); | ||
731 | ExitOnFailure(hr, "Failed to initialize file search."); | ||
732 | #endif | ||
733 | |||
652 | // format path | 734 | // format path |
653 | hr = VariableFormatString(pVariables, pSearch->FileSearch.sczPath, &sczPath, NULL); | 735 | hr = VariableFormatString(pVariables, pSearch->FileSearch.sczPath, &sczPath, NULL); |
654 | ExitOnFailure(hr, "Failed to format variable string."); | 736 | ExitOnFailure(hr, "Failed to format variable string."); |
@@ -665,7 +747,7 @@ static HRESULT FileSearchExists( | |||
665 | } | 747 | } |
666 | else | 748 | else |
667 | { | 749 | { |
668 | ExitOnWin32Error(er, hr, "Failed get to file attributes. '%ls'", pSearch->DirectorySearch.sczPath); | 750 | ExitOnWin32Error(er, hr, "Failed get to file attributes. '%ls'", pSearch->FileSearch.sczPath); |
669 | } | 751 | } |
670 | } | 752 | } |
671 | else if (FILE_ATTRIBUTE_DIRECTORY != (dwAttributes & FILE_ATTRIBUTE_DIRECTORY)) | 753 | else if (FILE_ATTRIBUTE_DIRECTORY != (dwAttributes & FILE_ATTRIBUTE_DIRECTORY)) |
@@ -678,6 +760,10 @@ static HRESULT FileSearchExists( | |||
678 | ExitOnFailure(hr, "Failed to set variable."); | 760 | ExitOnFailure(hr, "Failed to set variable."); |
679 | 761 | ||
680 | LExit: | 762 | LExit: |
763 | #if !defined(_WIN64) | ||
764 | FileSystemSearchEnd(&bfs); | ||
765 | #endif | ||
766 | |||
681 | StrSecureZeroFreeString(sczPath); | 767 | StrSecureZeroFreeString(sczPath); |
682 | return hr; | 768 | return hr; |
683 | } | 769 | } |
@@ -692,6 +778,15 @@ static HRESULT FileSearchVersion( | |||
692 | LPWSTR sczPath = NULL; | 778 | LPWSTR sczPath = NULL; |
693 | VERUTIL_VERSION* pVersion = NULL; | 779 | VERUTIL_VERSION* pVersion = NULL; |
694 | 780 | ||
781 | #if !defined(_WIN64) | ||
782 | BURN_FILE_SEARCH bfs = { }; | ||
783 | |||
784 | bfs.pSearch = pSearch; | ||
785 | |||
786 | hr = FileSystemSearchStart(&bfs); | ||
787 | ExitOnFailure(hr, "Failed to initialize file search."); | ||
788 | #endif | ||
789 | |||
695 | // format path | 790 | // format path |
696 | hr = VariableFormatString(pVariables, pSearch->FileSearch.sczPath, &sczPath, NULL); | 791 | hr = VariableFormatString(pVariables, pSearch->FileSearch.sczPath, &sczPath, NULL); |
697 | ExitOnFailure(hr, "Failed to format path string."); | 792 | ExitOnFailure(hr, "Failed to format path string."); |
@@ -714,6 +809,10 @@ static HRESULT FileSearchVersion( | |||
714 | ExitOnFailure(hr, "Failed to set variable."); | 809 | ExitOnFailure(hr, "Failed to set variable."); |
715 | 810 | ||
716 | LExit: | 811 | LExit: |
812 | #if !defined(_WIN64) | ||
813 | FileSystemSearchEnd(&bfs); | ||
814 | #endif | ||
815 | |||
717 | StrSecureZeroFreeString(sczPath); | 816 | StrSecureZeroFreeString(sczPath); |
718 | ReleaseVerutilVersion(pVersion); | 817 | ReleaseVerutilVersion(pVersion); |
719 | return hr; | 818 | return hr; |
@@ -727,6 +826,15 @@ static HRESULT FileSearchPath( | |||
727 | HRESULT hr = S_OK; | 826 | HRESULT hr = S_OK; |
728 | LPWSTR sczPath = NULL; | 827 | LPWSTR sczPath = NULL; |
729 | 828 | ||
829 | #if !defined(_WIN64) | ||
830 | BURN_FILE_SEARCH bfs = { }; | ||
831 | |||
832 | bfs.pSearch = pSearch; | ||
833 | |||
834 | hr = FileSystemSearchStart(&bfs); | ||
835 | ExitOnFailure(hr, "Failed to initialize file search."); | ||
836 | #endif | ||
837 | |||
730 | // format path | 838 | // format path |
731 | hr = VariableFormatString(pVariables, pSearch->FileSearch.sczPath, &sczPath, NULL); | 839 | hr = VariableFormatString(pVariables, pSearch->FileSearch.sczPath, &sczPath, NULL); |
732 | ExitOnFailure(hr, "Failed to format variable string."); | 840 | ExitOnFailure(hr, "Failed to format variable string."); |
@@ -755,6 +863,10 @@ static HRESULT FileSearchPath( | |||
755 | ExitOnFailure(hr, "Failed while searching file search: %ls, for path: %ls", pSearch->sczKey, sczPath); | 863 | ExitOnFailure(hr, "Failed while searching file search: %ls, for path: %ls", pSearch->sczKey, sczPath); |
756 | 864 | ||
757 | LExit: | 865 | LExit: |
866 | #if !defined(_WIN64) | ||
867 | FileSystemSearchEnd(&bfs); | ||
868 | #endif | ||
869 | |||
758 | StrSecureZeroFreeString(sczPath); | 870 | StrSecureZeroFreeString(sczPath); |
759 | 871 | ||
760 | return hr; | 872 | return hr; |
diff --git a/src/burn/engine/search.h b/src/burn/engine/search.h index bc53f197..341fe1aa 100644 --- a/src/burn/engine/search.h +++ b/src/burn/engine/search.h | |||
@@ -88,6 +88,7 @@ typedef struct _BURN_SEARCH | |||
88 | { | 88 | { |
89 | BURN_FILE_SEARCH_TYPE Type; | 89 | BURN_FILE_SEARCH_TYPE Type; |
90 | LPWSTR sczPath; | 90 | LPWSTR sczPath; |
91 | BOOL fDisableFileRedirection; | ||
91 | } FileSearch; | 92 | } FileSearch; |
92 | struct | 93 | struct |
93 | { | 94 | { |
diff --git a/src/burn/test/BurnUnitTest/SearchTest.cpp b/src/burn/test/BurnUnitTest/SearchTest.cpp index 7efbca2d..a8e397c2 100644 --- a/src/burn/test/BurnUnitTest/SearchTest.cpp +++ b/src/burn/test/BurnUnitTest/SearchTest.cpp | |||
@@ -129,6 +129,9 @@ namespace Bootstrapper | |||
129 | L" <FileSearch Id='Search1' Type='exists' Path='[File1]' Variable='Variable1' />" | 129 | L" <FileSearch Id='Search1' Type='exists' Path='[File1]' Variable='Variable1' />" |
130 | L" <FileSearch Id='Search2' Type='exists' Path='[File2]' Variable='Variable2' />" | 130 | L" <FileSearch Id='Search2' Type='exists' Path='[File2]' Variable='Variable2' />" |
131 | L" <FileSearch Id='Search3' Type='version' Path='[File2]' Variable='Variable3' />" | 131 | L" <FileSearch Id='Search3' Type='version' Path='[File2]' Variable='Variable3' />" |
132 | L" <FileSearch Id='Search4' Type='exists' Path='[SystemFolder]\\consent.exe' Variable='Variable4' />" | ||
133 | L" <FileSearch Id='Search5' Type='exists' Path='[System64Folder]\\consent.exe' Variable='Variable5' DisableFileRedirection='no' />" | ||
134 | L" <FileSearch Id='Search6' Type='exists' Path='[System64Folder]\\consent.exe' Variable='Variable6' DisableFileRedirection='yes' />" | ||
132 | L"</Bundle>"; | 135 | L"</Bundle>"; |
133 | 136 | ||
134 | // load XML document | 137 | // load XML document |
@@ -145,6 +148,15 @@ namespace Bootstrapper | |||
145 | Assert::Equal(0ll, VariableGetNumericHelper(&variables, L"Variable1")); | 148 | Assert::Equal(0ll, VariableGetNumericHelper(&variables, L"Variable1")); |
146 | Assert::Equal(1ll, VariableGetNumericHelper(&variables, L"Variable2")); | 149 | Assert::Equal(1ll, VariableGetNumericHelper(&variables, L"Variable2")); |
147 | Assert::Equal<String^>(gcnew String(pVersion->sczVersion), VariableGetVersionHelper(&variables, L"Variable3")); | 150 | Assert::Equal<String^>(gcnew String(pVersion->sczVersion), VariableGetVersionHelper(&variables, L"Variable3")); |
151 | |||
152 | // Assume that consent.exe continues to only exist in 64-bit system folder. | ||
153 | Assert::Equal(0ll, VariableGetNumericHelper(&variables, L"Variable4")); | ||
154 | #if !defined(_WIN64) | ||
155 | Assert::Equal(0ll, VariableGetNumericHelper(&variables, L"Variable5")); | ||
156 | #else | ||
157 | Assert::Equal(1ll, VariableGetNumericHelper(&variables, L"Variable5")); | ||
158 | #endif | ||
159 | Assert::Equal(1ll, VariableGetNumericHelper(&variables, L"Variable6")); | ||
148 | } | 160 | } |
149 | finally | 161 | finally |
150 | { | 162 | { |
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; |
diff --git a/src/wix/WixToolset.Core.Burn/Bind/LegacySearchFacade.cs b/src/wix/WixToolset.Core.Burn/Bind/LegacySearchFacade.cs index c6b6e7ee..c9301fdc 100644 --- a/src/wix/WixToolset.Core.Burn/Bind/LegacySearchFacade.cs +++ b/src/wix/WixToolset.Core.Burn/Bind/LegacySearchFacade.cs | |||
@@ -98,6 +98,11 @@ namespace WixToolset.Core.Burn | |||
98 | throw new NotImplementedException(); | 98 | throw new NotImplementedException(); |
99 | } | 99 | } |
100 | 100 | ||
101 | if (searchSymbol.DisableFileRedirection) | ||
102 | { | ||
103 | writer.WriteAttributeString("DisableFileRedirection", "yes"); | ||
104 | } | ||
105 | |||
101 | writer.WriteEndElement(); | 106 | writer.WriteEndElement(); |
102 | } | 107 | } |
103 | 108 | ||