diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2020-07-10 21:25:44 +1000 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2020-07-10 22:10:26 +1000 |
commit | f866ab77f8fd0790f4d6628f54dcdf0bd66fccb6 (patch) | |
tree | b3705d3655e678003d4fce590e7c5cb1c836778e | |
parent | af43f098d7d7cc0fe21c7d7b0fe991763e9cae07 (diff) | |
download | wix-f866ab77f8fd0790f4d6628f54dcdf0bd66fccb6.tar.gz wix-f866ab77f8fd0790f4d6628f54dcdf0bd66fccb6.tar.bz2 wix-f866ab77f8fd0790f4d6628f54dcdf0bd66fccb6.zip |
Change the DetectSHA2Support element to WindowsFeatureSearch. This will make it easier to add support for other Windows features in the future.
-rw-r--r-- | src/be/detectsha2support.cpp | 8 | ||||
-rw-r--r-- | src/be/detectsha2support.h | 2 | ||||
-rw-r--r-- | src/be/utilsearch.cpp | 33 | ||||
-rw-r--r-- | src/be/utilsearch.h | 15 | ||||
-rw-r--r-- | src/test/WixToolsetTest.Util/TestData/BundleWithSearches/Bundle.wxs | 6 | ||||
-rw-r--r-- | src/test/WixToolsetTest.Util/UtilExtensionFixture.cs | 2 | ||||
-rw-r--r-- | src/wixext/Symbols/UtilSymbolDefinitions.cs | 10 | ||||
-rw-r--r-- | src/wixext/Symbols/WixDetectSHA2SupportSymbol.cs | 33 | ||||
-rw-r--r-- | src/wixext/Symbols/WixWindowsFeatureSearchSymbol.cs | 47 | ||||
-rw-r--r-- | src/wixext/UtilCompiler.cs | 50 | ||||
-rw-r--r-- | src/wixext/util.xsd | 62 |
11 files changed, 176 insertions, 92 deletions
diff --git a/src/be/detectsha2support.cpp b/src/be/detectsha2support.cpp index f1f3637e..90e349cd 100644 --- a/src/be/detectsha2support.cpp +++ b/src/be/detectsha2support.cpp | |||
@@ -3,7 +3,7 @@ | |||
3 | #include "precomp.h" | 3 | #include "precomp.h" |
4 | 4 | ||
5 | // https://gist.github.com/navossoc/7572c7d82243e9f818989e2765e7793a | 5 | // https://gist.github.com/navossoc/7572c7d82243e9f818989e2765e7793a |
6 | HRESULT DetectSHA2Support( | 6 | HRESULT DetectSHA2CodeSigning( |
7 | __out BOOL* pfSupported | 7 | __out BOOL* pfSupported |
8 | ) | 8 | ) |
9 | { | 9 | { |
@@ -38,7 +38,7 @@ LExit: | |||
38 | return hr; | 38 | return hr; |
39 | } | 39 | } |
40 | 40 | ||
41 | HRESULT UtilPerformDetectSHA2Support( | 41 | HRESULT UtilPerformDetectSHA2CodeSigning( |
42 | __in LPCWSTR wzVariable, | 42 | __in LPCWSTR wzVariable, |
43 | __in UTIL_SEARCH* /*pSearch*/, | 43 | __in UTIL_SEARCH* /*pSearch*/, |
44 | __in IBundleExtensionEngine* pEngine | 44 | __in IBundleExtensionEngine* pEngine |
@@ -47,8 +47,8 @@ HRESULT UtilPerformDetectSHA2Support( | |||
47 | HRESULT hr = S_OK; | 47 | HRESULT hr = S_OK; |
48 | BOOL fSupported = FALSE; | 48 | BOOL fSupported = FALSE; |
49 | 49 | ||
50 | hr = DetectSHA2Support(&fSupported); | 50 | hr = DetectSHA2CodeSigning(&fSupported); |
51 | ExitOnFailure(hr, "DetectSHA2Support failed."); | 51 | ExitOnFailure(hr, "DetectSHA2CodeSigning failed."); |
52 | 52 | ||
53 | hr = pEngine->SetVariableNumeric(wzVariable, fSupported ? 1 : 0); | 53 | hr = pEngine->SetVariableNumeric(wzVariable, fSupported ? 1 : 0); |
54 | ExitOnFailure(hr, "Failed to set variable '%ls'", wzVariable); | 54 | ExitOnFailure(hr, "Failed to set variable '%ls'", wzVariable); |
diff --git a/src/be/detectsha2support.h b/src/be/detectsha2support.h index 7f1f6031..c38a3d59 100644 --- a/src/be/detectsha2support.h +++ b/src/be/detectsha2support.h | |||
@@ -1,7 +1,7 @@ | |||
1 | #pragma once | 1 | #pragma once |
2 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | 2 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. |
3 | 3 | ||
4 | HRESULT UtilPerformDetectSHA2Support( | 4 | HRESULT UtilPerformDetectSHA2CodeSigning( |
5 | __in LPCWSTR wzVariable, | 5 | __in LPCWSTR wzVariable, |
6 | __in UTIL_SEARCH* pSearch, | 6 | __in UTIL_SEARCH* pSearch, |
7 | __in IBundleExtensionEngine* pEngine | 7 | __in IBundleExtensionEngine* pEngine |
diff --git a/src/be/utilsearch.cpp b/src/be/utilsearch.cpp index 4e9d86a1..7cd2ea09 100644 --- a/src/be/utilsearch.cpp +++ b/src/be/utilsearch.cpp | |||
@@ -13,9 +13,10 @@ STDMETHODIMP UtilSearchParseFromXml( | |||
13 | IXMLDOMNode* pixnNode = NULL; | 13 | IXMLDOMNode* pixnNode = NULL; |
14 | DWORD cNodes = 0; | 14 | DWORD cNodes = 0; |
15 | BSTR bstrNodeName = NULL; | 15 | BSTR bstrNodeName = NULL; |
16 | LPWSTR scz = NULL; | ||
16 | 17 | ||
17 | // Select Util search nodes. | 18 | // Select Util search nodes. |
18 | hr = XmlSelectNodes(pixnBundleExtension, L"WixDetectSHA2Support", &pixnNodes); | 19 | hr = XmlSelectNodes(pixnBundleExtension, L"WixWindowsFeatureSearch", &pixnNodes); |
19 | ExitOnFailure(hr, "Failed to select Util search nodes."); | 20 | ExitOnFailure(hr, "Failed to select Util search nodes."); |
20 | 21 | ||
21 | // Get Util search node count. | 22 | // Get Util search node count. |
@@ -46,9 +47,23 @@ STDMETHODIMP UtilSearchParseFromXml( | |||
46 | ExitOnFailure(hr, "Failed to get @Id."); | 47 | ExitOnFailure(hr, "Failed to get @Id."); |
47 | 48 | ||
48 | // Read type specific attributes. | 49 | // Read type specific attributes. |
49 | if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, bstrNodeName, -1, L"WixDetectSHA2Support", -1)) | 50 | if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, bstrNodeName, -1, L"WixWindowsFeatureSearch", -1)) |
50 | { | 51 | { |
51 | pSearch->Type = UTIL_SEARCH_TYPE_DETECT_SHA2_SUPPORT; | 52 | pSearch->Type = UTIL_SEARCH_TYPE_WINDOWS_FEATURE_SEARCH; |
53 | |||
54 | // @Type | ||
55 | hr = XmlGetAttributeEx(pixnNode, L"Type", &scz); | ||
56 | ExitOnFailure(hr, "Failed to get @Type."); | ||
57 | |||
58 | if (CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, scz, -1, L"sha2CodeSigning", -1)) | ||
59 | { | ||
60 | pSearch->WindowsFeatureSearch.type = UTIL_WINDOWS_FEATURE_SEARCH_TYPE_SHA2_CODE_SIGNING; | ||
61 | } | ||
62 | else | ||
63 | { | ||
64 | hr = E_INVALIDARG; | ||
65 | ExitOnFailure(hr, "Invalid value for @Type: %ls", scz); | ||
66 | } | ||
52 | } | 67 | } |
53 | else | 68 | else |
54 | { | 69 | { |
@@ -62,6 +77,7 @@ STDMETHODIMP UtilSearchParseFromXml( | |||
62 | } | 77 | } |
63 | 78 | ||
64 | LExit: | 79 | LExit: |
80 | ReleaseStr(scz); | ||
65 | ReleaseBSTR(bstrNodeName); | 81 | ReleaseBSTR(bstrNodeName); |
66 | ReleaseObject(pixnNode); | 82 | ReleaseObject(pixnNode); |
67 | ReleaseObject(pixnNodes); | 83 | ReleaseObject(pixnNodes); |
@@ -100,8 +116,15 @@ STDMETHODIMP UtilSearchExecute( | |||
100 | 116 | ||
101 | switch (pSearch->Type) | 117 | switch (pSearch->Type) |
102 | { | 118 | { |
103 | case UTIL_SEARCH_TYPE_DETECT_SHA2_SUPPORT: | 119 | case UTIL_SEARCH_TYPE_WINDOWS_FEATURE_SEARCH: |
104 | hr = UtilPerformDetectSHA2Support(wzVariable, pSearch, pEngine); | 120 | switch (pSearch->WindowsFeatureSearch.type) |
121 | { | ||
122 | case UTIL_WINDOWS_FEATURE_SEARCH_TYPE_SHA2_CODE_SIGNING: | ||
123 | hr = UtilPerformDetectSHA2CodeSigning(wzVariable, pSearch, pEngine); | ||
124 | break; | ||
125 | default: | ||
126 | hr = E_UNEXPECTED; | ||
127 | } | ||
105 | break; | 128 | break; |
106 | default: | 129 | default: |
107 | hr = E_UNEXPECTED; | 130 | hr = E_UNEXPECTED; |
diff --git a/src/be/utilsearch.h b/src/be/utilsearch.h index 1e0ca96d..deeab1f7 100644 --- a/src/be/utilsearch.h +++ b/src/be/utilsearch.h | |||
@@ -7,7 +7,13 @@ | |||
7 | enum UTIL_SEARCH_TYPE | 7 | enum UTIL_SEARCH_TYPE |
8 | { | 8 | { |
9 | UTIL_SEARCH_TYPE_NONE, | 9 | UTIL_SEARCH_TYPE_NONE, |
10 | UTIL_SEARCH_TYPE_DETECT_SHA2_SUPPORT, | 10 | UTIL_SEARCH_TYPE_WINDOWS_FEATURE_SEARCH, |
11 | }; | ||
12 | |||
13 | enum UTIL_WINDOWS_FEATURE_SEARCH_TYPE | ||
14 | { | ||
15 | UTIL_WINDOWS_FEATURE_SEARCH_TYPE_NONE, | ||
16 | UTIL_WINDOWS_FEATURE_SEARCH_TYPE_SHA2_CODE_SIGNING, | ||
11 | }; | 17 | }; |
12 | 18 | ||
13 | 19 | ||
@@ -18,6 +24,13 @@ typedef struct _UTIL_SEARCH | |||
18 | LPWSTR sczId; | 24 | LPWSTR sczId; |
19 | 25 | ||
20 | UTIL_SEARCH_TYPE Type; | 26 | UTIL_SEARCH_TYPE Type; |
27 | union | ||
28 | { | ||
29 | struct | ||
30 | { | ||
31 | UTIL_WINDOWS_FEATURE_SEARCH_TYPE type; | ||
32 | } WindowsFeatureSearch; | ||
33 | }; | ||
21 | } UTIL_SEARCH; | 34 | } UTIL_SEARCH; |
22 | 35 | ||
23 | typedef struct _UTIL_SEARCHES | 36 | typedef struct _UTIL_SEARCHES |
diff --git a/src/test/WixToolsetTest.Util/TestData/BundleWithSearches/Bundle.wxs b/src/test/WixToolsetTest.Util/TestData/BundleWithSearches/Bundle.wxs index 56eba137..c8f7205f 100644 --- a/src/test/WixToolsetTest.Util/TestData/BundleWithSearches/Bundle.wxs +++ b/src/test/WixToolsetTest.Util/TestData/BundleWithSearches/Bundle.wxs | |||
@@ -1,11 +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"> | 2 | <Bundle Name="!(loc.BundleName)" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="047730a5-30fe-4a62-a520-da9381b8226a"> |
3 | <BootstrapperApplication SourceFile="fakeba.dll" /> | 3 | <BootstrapperApplication SourceFile="fakeba.dll" /> |
4 | 4 | ||
5 | <util:RegistrySearchRef Id="RegistrySearchId" /> | 5 | <util:RegistrySearchRef Id="RegistrySearchId" /> |
6 | <util:ProductSearchRef Id="ProductSearchId" /> | 6 | <util:ProductSearchRef Id="ProductSearchId" /> |
7 | <util:FileSearchRef Id="FileSearchId" /> | 7 | <util:FileSearchRef Id="FileSearchId" /> |
8 | <util:DetectSHA2SupportRef Id="DetectSHA2SupportId" /> | 8 | <util:WindowsFeatureSearchRef Id="DetectSHA2SupportId" /> |
9 | 9 | ||
10 | <Chain> | 10 | <Chain> |
11 | <MsiPackage SourceFile="test.msi"> | 11 | <MsiPackage SourceFile="test.msi"> |
@@ -33,6 +33,6 @@ | |||
33 | </Fragment> | 33 | </Fragment> |
34 | 34 | ||
35 | <Fragment> | 35 | <Fragment> |
36 | <util:DetectSHA2Support Id="DetectSHA2SupportId" Variable="IsSHA2Supported" /> | 36 | <util:WindowsFeatureSearch Id="DetectSHA2SupportId" Variable="IsSHA2Supported" Feature="sha2CodeSigning" /> |
37 | </Fragment> | 37 | </Fragment> |
38 | </Wix> | 38 | </Wix> |
diff --git a/src/test/WixToolsetTest.Util/UtilExtensionFixture.cs b/src/test/WixToolsetTest.Util/UtilExtensionFixture.cs index aa03d068..78a9f967 100644 --- a/src/test/WixToolsetTest.Util/UtilExtensionFixture.cs +++ b/src/test/WixToolsetTest.Util/UtilExtensionFixture.cs | |||
@@ -172,7 +172,7 @@ namespace WixToolsetTest.Util | |||
172 | var bundleExtensionDatas = extractResult.SelectBundleExtensionDataNodes("/be:BundleExtensionData/be:BundleExtension[@Id='Wix4UtilBundleExtension_X86']"); | 172 | var bundleExtensionDatas = extractResult.SelectBundleExtensionDataNodes("/be:BundleExtensionData/be:BundleExtension[@Id='Wix4UtilBundleExtension_X86']"); |
173 | Assert.Equal(1, bundleExtensionDatas.Count); | 173 | Assert.Equal(1, bundleExtensionDatas.Count); |
174 | Assert.Equal("<BundleExtension Id='Wix4UtilBundleExtension_X86'>" + | 174 | Assert.Equal("<BundleExtension Id='Wix4UtilBundleExtension_X86'>" + |
175 | "<WixDetectSHA2Support Id='DetectSHA2SupportId' />" + | 175 | "<WixWindowsFeatureSearch Id='DetectSHA2SupportId' Type='sha2CodeSigning' />" + |
176 | "</BundleExtension>", bundleExtensionDatas[0].GetTestXml()); | 176 | "</BundleExtension>", bundleExtensionDatas[0].GetTestXml()); |
177 | 177 | ||
178 | var utilSearches = extractResult.SelectManifestNodes("/burn:BurnManifest/*[self::burn:ExtensionSearch or self::burn:FileSearch or self::burn:MsiProductSearch or self::burn:RegistrySearch]"); | 178 | var utilSearches = extractResult.SelectManifestNodes("/burn:BurnManifest/*[self::burn:ExtensionSearch or self::burn:FileSearch or self::burn:MsiProductSearch or self::burn:RegistrySearch]"); |
diff --git a/src/wixext/Symbols/UtilSymbolDefinitions.cs b/src/wixext/Symbols/UtilSymbolDefinitions.cs index ae9c4c81..5f062676 100644 --- a/src/wixext/Symbols/UtilSymbolDefinitions.cs +++ b/src/wixext/Symbols/UtilSymbolDefinitions.cs | |||
@@ -20,12 +20,12 @@ namespace WixToolset.Util | |||
20 | User, | 20 | User, |
21 | UserGroup, | 21 | UserGroup, |
22 | WixCloseApplication, | 22 | WixCloseApplication, |
23 | WixDetectSHA2Support, | ||
24 | WixFormatFiles, | 23 | WixFormatFiles, |
25 | WixInternetShortcut, | 24 | WixInternetShortcut, |
26 | WixRemoveFolderEx, | 25 | WixRemoveFolderEx, |
27 | WixRestartResource, | 26 | WixRestartResource, |
28 | WixTouchFile, | 27 | WixTouchFile, |
28 | WixWindowsFeatureSearch, | ||
29 | XmlConfig, | 29 | XmlConfig, |
30 | XmlFile, | 30 | XmlFile, |
31 | } | 31 | } |
@@ -84,9 +84,6 @@ namespace WixToolset.Util | |||
84 | case UtilSymbolDefinitionType.WixCloseApplication: | 84 | case UtilSymbolDefinitionType.WixCloseApplication: |
85 | return UtilSymbolDefinitions.WixCloseApplication; | 85 | return UtilSymbolDefinitions.WixCloseApplication; |
86 | 86 | ||
87 | case UtilSymbolDefinitionType.WixDetectSHA2Support: | ||
88 | return UtilSymbolDefinitions.WixDetectSHA2Support; | ||
89 | |||
90 | case UtilSymbolDefinitionType.WixFormatFiles: | 87 | case UtilSymbolDefinitionType.WixFormatFiles: |
91 | return UtilSymbolDefinitions.WixFormatFiles; | 88 | return UtilSymbolDefinitions.WixFormatFiles; |
92 | 89 | ||
@@ -102,6 +99,9 @@ namespace WixToolset.Util | |||
102 | case UtilSymbolDefinitionType.WixTouchFile: | 99 | case UtilSymbolDefinitionType.WixTouchFile: |
103 | return UtilSymbolDefinitions.WixTouchFile; | 100 | return UtilSymbolDefinitions.WixTouchFile; |
104 | 101 | ||
102 | case UtilSymbolDefinitionType.WixWindowsFeatureSearch: | ||
103 | return UtilSymbolDefinitions.WixWindowsFeatureSearch; | ||
104 | |||
105 | case UtilSymbolDefinitionType.XmlConfig: | 105 | case UtilSymbolDefinitionType.XmlConfig: |
106 | return UtilSymbolDefinitions.XmlConfig; | 106 | return UtilSymbolDefinitions.XmlConfig; |
107 | 107 | ||
@@ -115,7 +115,7 @@ namespace WixToolset.Util | |||
115 | 115 | ||
116 | static UtilSymbolDefinitions() | 116 | static UtilSymbolDefinitions() |
117 | { | 117 | { |
118 | WixDetectSHA2Support.AddTag(BurnConstants.BundleExtensionSearchSymbolDefinitionTag); | 118 | WixWindowsFeatureSearch.AddTag(BurnConstants.BundleExtensionSearchSymbolDefinitionTag); |
119 | } | 119 | } |
120 | } | 120 | } |
121 | } | 121 | } |
diff --git a/src/wixext/Symbols/WixDetectSHA2SupportSymbol.cs b/src/wixext/Symbols/WixDetectSHA2SupportSymbol.cs deleted file mode 100644 index b518ba3b..00000000 --- a/src/wixext/Symbols/WixDetectSHA2SupportSymbol.cs +++ /dev/null | |||
@@ -1,33 +0,0 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | namespace WixToolset.Util | ||
4 | { | ||
5 | using WixToolset.Data; | ||
6 | using WixToolset.Util.Symbols; | ||
7 | |||
8 | public static partial class UtilSymbolDefinitions | ||
9 | { | ||
10 | public static readonly IntermediateSymbolDefinition WixDetectSHA2Support = new IntermediateSymbolDefinition( | ||
11 | UtilSymbolDefinitionType.WixDetectSHA2Support.ToString(), | ||
12 | new IntermediateFieldDefinition[0], | ||
13 | typeof(WixDetectSHA2SupportSymbol)); | ||
14 | } | ||
15 | } | ||
16 | |||
17 | namespace WixToolset.Util.Symbols | ||
18 | { | ||
19 | using WixToolset.Data; | ||
20 | |||
21 | public class WixDetectSHA2SupportSymbol : IntermediateSymbol | ||
22 | { | ||
23 | public WixDetectSHA2SupportSymbol() : base(UtilSymbolDefinitions.WixDetectSHA2Support, null, null) | ||
24 | { | ||
25 | } | ||
26 | |||
27 | public WixDetectSHA2SupportSymbol(SourceLineNumber sourceLineNumber, Identifier id = null) : base(UtilSymbolDefinitions.WixDetectSHA2Support, sourceLineNumber, id) | ||
28 | { | ||
29 | } | ||
30 | |||
31 | public IntermediateField this[GroupSymbolFields index] => this.Fields[(int)index]; | ||
32 | } | ||
33 | } | ||
diff --git a/src/wixext/Symbols/WixWindowsFeatureSearchSymbol.cs b/src/wixext/Symbols/WixWindowsFeatureSearchSymbol.cs new file mode 100644 index 00000000..9a43692c --- /dev/null +++ b/src/wixext/Symbols/WixWindowsFeatureSearchSymbol.cs | |||
@@ -0,0 +1,47 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | namespace WixToolset.Util | ||
4 | { | ||
5 | using WixToolset.Data; | ||
6 | using WixToolset.Util.Symbols; | ||
7 | |||
8 | public static partial class UtilSymbolDefinitions | ||
9 | { | ||
10 | public static readonly IntermediateSymbolDefinition WixWindowsFeatureSearch = new IntermediateSymbolDefinition( | ||
11 | UtilSymbolDefinitionType.WixWindowsFeatureSearch.ToString(), | ||
12 | new[] | ||
13 | { | ||
14 | new IntermediateFieldDefinition(nameof(WixWindowsFeatureSearchSymbolFields.Type), IntermediateFieldType.String), | ||
15 | }, | ||
16 | typeof(WixWindowsFeatureSearchSymbol)); | ||
17 | } | ||
18 | } | ||
19 | |||
20 | namespace WixToolset.Util.Symbols | ||
21 | { | ||
22 | using WixToolset.Data; | ||
23 | |||
24 | public enum WixWindowsFeatureSearchSymbolFields | ||
25 | { | ||
26 | Type, | ||
27 | } | ||
28 | |||
29 | public class WixWindowsFeatureSearchSymbol : IntermediateSymbol | ||
30 | { | ||
31 | public WixWindowsFeatureSearchSymbol() : base(UtilSymbolDefinitions.WixWindowsFeatureSearch, null, null) | ||
32 | { | ||
33 | } | ||
34 | |||
35 | public WixWindowsFeatureSearchSymbol(SourceLineNumber sourceLineNumber, Identifier id = null) : base(UtilSymbolDefinitions.WixWindowsFeatureSearch, sourceLineNumber, id) | ||
36 | { | ||
37 | } | ||
38 | |||
39 | public IntermediateField this[WixWindowsFeatureSearchSymbolFields index] => this.Fields[(int)index]; | ||
40 | |||
41 | public string Type | ||
42 | { | ||
43 | get => this.Fields[(int)WixWindowsFeatureSearchSymbolFields.Type].AsString(); | ||
44 | set => this.Set((int)WixWindowsFeatureSearchSymbolFields.Type, value); | ||
45 | } | ||
46 | } | ||
47 | } | ||
diff --git a/src/wixext/UtilCompiler.cs b/src/wixext/UtilCompiler.cs index a5745b6c..79dbbc6d 100644 --- a/src/wixext/UtilCompiler.cs +++ b/src/wixext/UtilCompiler.cs | |||
@@ -235,8 +235,6 @@ namespace WixToolset.Util | |||
235 | break; | 235 | break; |
236 | case "ComponentSearch": | 236 | case "ComponentSearch": |
237 | case "ComponentSearchRef": | 237 | case "ComponentSearchRef": |
238 | case "DetectSHA2Support": | ||
239 | case "DetectSHA2SupportRef": | ||
240 | case "DirectorySearch": | 238 | case "DirectorySearch": |
241 | case "DirectorySearchRef": | 239 | case "DirectorySearchRef": |
242 | case "FileSearch": | 240 | case "FileSearch": |
@@ -245,6 +243,8 @@ namespace WixToolset.Util | |||
245 | case "ProductSearchRef": | 243 | case "ProductSearchRef": |
246 | case "RegistrySearch": | 244 | case "RegistrySearch": |
247 | case "RegistrySearchRef": | 245 | case "RegistrySearchRef": |
246 | case "WindowsFeatureSearch": | ||
247 | case "WindowsFeatureSearchRef": | ||
248 | // These will eventually be supported under Module/Product, but are not yet. | 248 | // These will eventually be supported under Module/Product, but are not yet. |
249 | if (parentElement.Name.LocalName == "Bundle" || parentElement.Name.LocalName == "Fragment") | 249 | if (parentElement.Name.LocalName == "Bundle" || parentElement.Name.LocalName == "Fragment") |
250 | { | 250 | { |
@@ -258,12 +258,6 @@ namespace WixToolset.Util | |||
258 | case "ComponentSearchRef": | 258 | case "ComponentSearchRef": |
259 | this.ParseComponentSearchRefElement(intermediate, section, element); | 259 | this.ParseComponentSearchRefElement(intermediate, section, element); |
260 | break; | 260 | break; |
261 | case "DetectSHA2Support": | ||
262 | this.ParseDetectSHA2SupportElement(intermediate, section, element); | ||
263 | break; | ||
264 | case "DetectSHA2SupportRef": | ||
265 | this.ParseDetectSHA2SupportRefElement(intermediate, section, element); | ||
266 | break; | ||
267 | case "DirectorySearch": | 261 | case "DirectorySearch": |
268 | this.ParseDirectorySearchElement(intermediate, section, element); | 262 | this.ParseDirectorySearchElement(intermediate, section, element); |
269 | break; | 263 | break; |
@@ -288,6 +282,12 @@ namespace WixToolset.Util | |||
288 | case "RegistrySearchRef": | 282 | case "RegistrySearchRef": |
289 | this.ParseWixSearchRefElement(intermediate, section, element); | 283 | this.ParseWixSearchRefElement(intermediate, section, element); |
290 | break; | 284 | break; |
285 | case "WindowsFeatureSearch": | ||
286 | this.ParseWindowsFeatureSearchElement(intermediate, section, element); | ||
287 | break; | ||
288 | case "WindowsFeatureSearchRef": | ||
289 | this.ParseWindowsFeatureSearchRefElement(intermediate, section, element); | ||
290 | break; | ||
291 | } | 291 | } |
292 | } | 292 | } |
293 | else | 293 | else |
@@ -508,16 +508,17 @@ namespace WixToolset.Util | |||
508 | } | 508 | } |
509 | 509 | ||
510 | /// <summary> | 510 | /// <summary> |
511 | /// Parses a DetectSHA2Support element. | 511 | /// Parses a WindowsFeatureSearch element. |
512 | /// </summary> | 512 | /// </summary> |
513 | /// <param name="element">Element to parse.</param> | 513 | /// <param name="element">Element to parse.</param> |
514 | private void ParseDetectSHA2SupportElement(Intermediate intermediate, IntermediateSection section, XElement element) | 514 | private void ParseWindowsFeatureSearchElement(Intermediate intermediate, IntermediateSection section, XElement element) |
515 | { | 515 | { |
516 | var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element); | 516 | var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element); |
517 | Identifier id = null; | 517 | Identifier id = null; |
518 | string variable = null; | 518 | string variable = null; |
519 | string condition = null; | 519 | string condition = null; |
520 | string after = null; | 520 | string after = null; |
521 | string feature = null; | ||
521 | 522 | ||
522 | foreach (var attrib in element.Attributes()) | 523 | foreach (var attrib in element.Attributes()) |
523 | { | 524 | { |
@@ -531,6 +532,17 @@ namespace WixToolset.Util | |||
531 | case "After": | 532 | case "After": |
532 | this.ParseCommonSearchAttributes(sourceLineNumbers, attrib, ref id, ref variable, ref condition, ref after); | 533 | this.ParseCommonSearchAttributes(sourceLineNumbers, attrib, ref id, ref variable, ref condition, ref after); |
533 | break; | 534 | break; |
535 | case "Feature": | ||
536 | feature = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib); | ||
537 | switch (feature) | ||
538 | { | ||
539 | case "sha2CodeSigning": | ||
540 | break; | ||
541 | default: | ||
542 | this.Messaging.Write(ErrorMessages.IllegalAttributeValue(sourceLineNumbers, element.Name.LocalName, "Feature", feature, "sha2CodeSigning")); | ||
543 | break; | ||
544 | } | ||
545 | break; | ||
534 | default: | 546 | default: |
535 | this.ParseHelper.UnexpectedAttribute(element, attrib); | 547 | this.ParseHelper.UnexpectedAttribute(element, attrib); |
536 | break; | 548 | break; |
@@ -544,7 +556,12 @@ namespace WixToolset.Util | |||
544 | 556 | ||
545 | if (id == null) | 557 | if (id == null) |
546 | { | 558 | { |
547 | id = this.ParseHelper.CreateIdentifier("wds2s", variable, condition, after); | 559 | id = this.ParseHelper.CreateIdentifier("wwfs", variable, condition, after); |
560 | } | ||
561 | |||
562 | if (feature == null) | ||
563 | { | ||
564 | this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, element.Name.LocalName, "Feature")); | ||
548 | } | 565 | } |
549 | 566 | ||
550 | this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element); | 567 | this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element); |
@@ -559,15 +576,18 @@ namespace WixToolset.Util | |||
559 | 576 | ||
560 | if (!this.Messaging.EncounteredError) | 577 | if (!this.Messaging.EncounteredError) |
561 | { | 578 | { |
562 | section.AddSymbol(new WixDetectSHA2SupportSymbol(sourceLineNumbers, id)); | 579 | section.AddSymbol(new WixWindowsFeatureSearchSymbol(sourceLineNumbers, id) |
580 | { | ||
581 | Type = feature, | ||
582 | }); | ||
563 | } | 583 | } |
564 | } | 584 | } |
565 | 585 | ||
566 | /// <summary> | 586 | /// <summary> |
567 | /// Parses a DetectSHA2SupportRef element | 587 | /// Parses a WindowsFeatureSearchRef element |
568 | /// </summary> | 588 | /// </summary> |
569 | /// <param name="element">Element to parse.</param> | 589 | /// <param name="element">Element to parse.</param> |
570 | private void ParseDetectSHA2SupportRefElement(Intermediate intermediate, IntermediateSection section, XElement element) | 590 | private void ParseWindowsFeatureSearchRefElement(Intermediate intermediate, IntermediateSection section, XElement element) |
571 | { | 591 | { |
572 | var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element); | 592 | var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(element); |
573 | 593 | ||
@@ -579,7 +599,7 @@ namespace WixToolset.Util | |||
579 | { | 599 | { |
580 | case "Id": | 600 | case "Id": |
581 | var refId = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib); | 601 | var refId = this.ParseHelper.GetAttributeIdentifierValue(sourceLineNumbers, attrib); |
582 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, UtilSymbolDefinitions.WixDetectSHA2Support, refId); | 602 | this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, UtilSymbolDefinitions.WixWindowsFeatureSearch, refId); |
583 | break; | 603 | break; |
584 | default: | 604 | default: |
585 | this.ParseHelper.UnexpectedAttribute(element, attrib); | 605 | this.ParseHelper.UnexpectedAttribute(element, attrib); |
diff --git a/src/wixext/util.xsd b/src/wixext/util.xsd index bb7a1e39..b6f0365b 100644 --- a/src/wixext/util.xsd +++ b/src/wixext/util.xsd | |||
@@ -174,30 +174,6 @@ | |||
174 | <xs:attribute name="Id" type="xs:string" use="required" /> | 174 | <xs:attribute name="Id" type="xs:string" use="required" /> |
175 | </xs:complexType> | 175 | </xs:complexType> |
176 | </xs:element> | 176 | </xs:element> |
177 | <xs:element name="DetectSHA2Support"> | ||
178 | <xs:annotation> | ||
179 | <xs:documentation>Detects support for SHA2.</xs:documentation> | ||
180 | <xs:appinfo> | ||
181 | <xse:parent namespace="http://wixtoolset.org/schemas/v4/wxs" ref="Bundle" /> | ||
182 | <xse:parent namespace="http://wixtoolset.org/schemas/v4/wxs" ref="Fragment" /> | ||
183 | </xs:appinfo> | ||
184 | </xs:annotation> | ||
185 | <xs:complexType> | ||
186 | <xs:attributeGroup ref="SearchCommonAttributes" /> | ||
187 | </xs:complexType> | ||
188 | </xs:element> | ||
189 | <xs:element name="DetectSHA2SupportRef"> | ||
190 | <xs:annotation> | ||
191 | <xs:documentation>References a DetectSHA2Support.</xs:documentation> | ||
192 | <xs:appinfo> | ||
193 | <xse:parent namespace="http://wixtoolset.org/schemas/v4/wxs" ref="Bundle" /> | ||
194 | <xse:parent namespace="http://wixtoolset.org/schemas/v4/wxs" ref="Fragment" /> | ||
195 | </xs:appinfo> | ||
196 | </xs:annotation> | ||
197 | <xs:complexType> | ||
198 | <xs:attribute name="Id" type="xs:string" use="required" /> | ||
199 | </xs:complexType> | ||
200 | </xs:element> | ||
201 | <xs:element name="DirectorySearch"> | 177 | <xs:element name="DirectorySearch"> |
202 | <xs:annotation> | 178 | <xs:annotation> |
203 | <xs:documentation>Describes a directory search.</xs:documentation> | 179 | <xs:documentation>Describes a directory search.</xs:documentation> |
@@ -1389,6 +1365,44 @@ | |||
1389 | </xs:attribute> | 1365 | </xs:attribute> |
1390 | </xs:complexType> | 1366 | </xs:complexType> |
1391 | </xs:element> | 1367 | </xs:element> |
1368 | <xs:element name="WindowsFeatureSearch"> | ||
1369 | <xs:annotation> | ||
1370 | <xs:documentation>Detects the existence of a Windows feature.</xs:documentation> | ||
1371 | <xs:appinfo> | ||
1372 | <xse:parent namespace="http://wixtoolset.org/schemas/v4/wxs" ref="Bundle" /> | ||
1373 | <xse:parent namespace="http://wixtoolset.org/schemas/v4/wxs" ref="Fragment" /> | ||
1374 | </xs:appinfo> | ||
1375 | </xs:annotation> | ||
1376 | <xs:complexType> | ||
1377 | <xs:attributeGroup ref="SearchCommonAttributes" /> | ||
1378 | <xs:attribute name="Feature" use="required"> | ||
1379 | <xs:annotation> | ||
1380 | <xs:documentation>The feature to detect.</xs:documentation> | ||
1381 | </xs:annotation> | ||
1382 | <xs:simpleType> | ||
1383 | <xs:restriction base="xs:NMTOKEN"> | ||
1384 | <xs:enumeration value="sha2CodeSigning"> | ||
1385 | <xs:annotation> | ||
1386 | <xs:documentation>The oldest OS with this feature is Win7 SP1 with KB3033929.</xs:documentation> | ||
1387 | </xs:annotation> | ||
1388 | </xs:enumeration> | ||
1389 | </xs:restriction> | ||
1390 | </xs:simpleType> | ||
1391 | </xs:attribute> | ||
1392 | </xs:complexType> | ||
1393 | </xs:element> | ||
1394 | <xs:element name="WindowsFeatureSearchRef"> | ||
1395 | <xs:annotation> | ||
1396 | <xs:documentation>References a WindowsFeatureSearch.</xs:documentation> | ||
1397 | <xs:appinfo> | ||
1398 | <xse:parent namespace="http://wixtoolset.org/schemas/v4/wxs" ref="Bundle" /> | ||
1399 | <xse:parent namespace="http://wixtoolset.org/schemas/v4/wxs" ref="Fragment" /> | ||
1400 | </xs:appinfo> | ||
1401 | </xs:annotation> | ||
1402 | <xs:complexType> | ||
1403 | <xs:attribute name="Id" type="xs:string" use="required" /> | ||
1404 | </xs:complexType> | ||
1405 | </xs:element> | ||
1392 | <xs:element name="XmlFile"> | 1406 | <xs:element name="XmlFile"> |
1393 | <xs:annotation> | 1407 | <xs:annotation> |
1394 | <xs:documentation> | 1408 | <xs:documentation> |