From 4082ae7f94346a8db77638ab8f0e06513a53c73a Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Sat, 4 Jul 2020 19:06:57 -0400 Subject: Add per-platform custom action support. --- src/ca/caDecor.h | 13 +++++++ src/ca/caSuffix.h | 11 ------ src/ca/iisca.vcxproj | 46 ++++++++++++++++-------- src/ca/precomp.h | 2 +- src/ca/scacert.cpp | 14 ++++---- src/ca/scacertexec.cpp | 2 +- src/ca/scahttpheader.cpp | 2 +- src/ca/scaiis.cpp | 6 ++-- src/ca/scaiis7.cpp | 6 ++-- src/ca/scasched.cpp | 8 ++--- src/wixext/IIsCompiler.cs | 7 ++-- src/wixlib/IIsExtension_Platform.wxi | 70 ++++++++++++++++++------------------ src/wixlib/IIsExtension_arm.wxs | 8 +++++ src/wixlib/IIsExtension_arm64.wxs | 8 +++++ src/wixlib/IIsExtension_x64.wxs | 8 +++++ src/wixlib/caDecor.wxi | 40 +++++++++++++++++++++ src/wixlib/caSuffix.wxi | 28 --------------- src/wixlib/iis.wixproj | 5 ++- 18 files changed, 172 insertions(+), 112 deletions(-) create mode 100644 src/ca/caDecor.h delete mode 100644 src/ca/caSuffix.h create mode 100644 src/wixlib/IIsExtension_arm.wxs create mode 100644 src/wixlib/IIsExtension_arm64.wxs create mode 100644 src/wixlib/IIsExtension_x64.wxs create mode 100644 src/wixlib/caDecor.wxi delete mode 100644 src/wixlib/caSuffix.wxi (limited to 'src') diff --git a/src/ca/caDecor.h b/src/ca/caDecor.h new file mode 100644 index 00000000..da274650 --- /dev/null +++ b/src/ca/caDecor.h @@ -0,0 +1,13 @@ +#pragma once +// 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. + + +#if defined(_M_ARM64) +#define CUSTOM_ACTION_DECORATION(f) L"Wix4" f L"_A64" +#elif defined(_M_AMD64) +#define CUSTOM_ACTION_DECORATION(f) L"Wix4" f L"_X64" +#elif defined(_M_ARM) +#define CUSTOM_ACTION_DECORATION(f) L"Wix4" f L"_ARM" +#else +#define CUSTOM_ACTION_DECORATION(f) L"Wix4" f L"_X86" +#endif diff --git a/src/ca/caSuffix.h b/src/ca/caSuffix.h deleted file mode 100644 index 303a99e9..00000000 --- a/src/ca/caSuffix.h +++ /dev/null @@ -1,11 +0,0 @@ -#pragma once -// 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. - - -#if defined _WIN64 -#define PLATFORM_DECORATION(f) f L"_64" -#elif defined ARM -#define PLATFORM_DECORATION(f) f L"_ARM" -#else -#define PLATFORM_DECORATION(f) f -#endif diff --git a/src/ca/iisca.vcxproj b/src/ca/iisca.vcxproj index 893130ed..4361b658 100644 --- a/src/ca/iisca.vcxproj +++ b/src/ca/iisca.vcxproj @@ -1,6 +1,5 @@ - @@ -14,25 +13,50 @@ Release Win32 + + Debug + x64 + + + Release + x64 + + + Debug + ARM + + + Release + ARM + + + Debug + ARM64 + + + Release + ARM64 + {CB3FB8C4-14BF-4EA6-9F01-7FB258E5AEF3} DynamicLibrary iisca - v141 + v142 Unicode iisca.def WiX Toolset Iis CustomAction + 10.0 - + - + crypt32.lib;msi.lib;Ws2_32.lib - + Create @@ -76,9 +100,6 @@ - - - @@ -119,15 +140,12 @@ - - - - + - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. @@ -135,4 +153,4 @@ - + \ No newline at end of file diff --git a/src/ca/precomp.h b/src/ca/precomp.h index c797ce82..85ee0890 100644 --- a/src/ca/precomp.h +++ b/src/ca/precomp.h @@ -63,4 +63,4 @@ #include "scassl7.h" #include "scaexecIIS7.h" -#include "caSuffix.h" +#include "caDecor.h" diff --git a/src/ca/scacert.cpp b/src/ca/scacert.cpp index 90db6375..cf979ee7 100644 --- a/src/ca/scacert.cpp +++ b/src/ca/scacert.cpp @@ -165,7 +165,7 @@ static HRESULT ConfigureCertificates( BYTE* pbCertificate = NULL; DWORD cbCertificate = 0; - DWORD cbPFXPassword = 0; + DWORD_PTR cbPFXPassword = 0; // Bail quickly if the Certificate table isn't around. if (S_OK != WcaTableExists(L"Certificate")) @@ -273,7 +273,7 @@ static HRESULT ConfigureCertificates( // Pick the right action to run based on what store we're uninstalling from. if (CERT_SYSTEM_STORE_LOCAL_MACHINE == dwStoreLocation) { - wzAction = L"DeleteMachineCertificate"; + wzAction = CUSTOM_ACTION_DECORATION(L"DeleteMachineCertificate"); if (pbCertificate) { wzRollbackAction = L"RollbackDeleteMachineCertificate"; @@ -281,7 +281,7 @@ static HRESULT ConfigureCertificates( } else { - wzAction = L"DeleteUserCertificate"; + wzAction = CUSTOM_ACTION_DECORATION(L"DeleteUserCertificate"); if (pbCertificate) { wzRollbackAction = L"RollbackDeleteUserCertificate"; @@ -304,13 +304,13 @@ static HRESULT ConfigureCertificates( // Pick the right action to run based on what store we're installing into. if (CERT_SYSTEM_STORE_LOCAL_MACHINE == dwStoreLocation) { - wzAction = L"AddMachineCertificate"; - wzRollbackAction = L"RollbackAddMachineCertificate"; + wzAction = CUSTOM_ACTION_DECORATION(L"AddMachineCertificate"); + wzRollbackAction = CUSTOM_ACTION_DECORATION(L"RollbackAddMachineCertificate"); } else { - wzAction = L"AddUserCertificate"; - wzRollbackAction = L"RollbackAddUserCertificate"; + wzAction = CUSTOM_ACTION_DECORATION(L"AddUserCertificate"); + wzRollbackAction = CUSTOM_ACTION_DECORATION(L"RollbackAddUserCertificate"); } dwCost = COST_CERT_ADD; } diff --git a/src/ca/scacertexec.cpp b/src/ca/scacertexec.cpp index ff87f485..4bb4ef95 100644 --- a/src/ca/scacertexec.cpp +++ b/src/ca/scacertexec.cpp @@ -148,7 +148,7 @@ static HRESULT ExecuteCertificateOperation( LPWSTR pwzFilePath = NULL; BYTE* pbData = NULL; DWORD cbData = 0; - DWORD cbPFXPassword = 0; + DWORD_PTR cbPFXPassword = 0; BOOL fUserStoreLocation = (CERT_SYSTEM_STORE_CURRENT_USER == dwStoreLocation); HCERTSTORE hCertStore = NULL; diff --git a/src/ca/scahttpheader.cpp b/src/ca/scahttpheader.cpp index a8fea796..1e134cea 100644 --- a/src/ca/scahttpheader.cpp +++ b/src/ca/scahttpheader.cpp @@ -159,7 +159,7 @@ HRESULT ScaWriteHttpHeader( LPWSTR pwz = NULL; LPWSTR pwzHeaders = NULL; LPWSTR pwzNewHeader = NULL; - DWORD dwFoundHeaderIndex = 0; + DWORD_PTR dwFoundHeaderIndex = 0; LPCWSTR wzFoundHeader = NULL; BOOL fOldValueFound = FALSE; diff --git a/src/ca/scaiis.cpp b/src/ca/scaiis.cpp index a29af1db..958051ed 100644 --- a/src/ca/scaiis.cpp +++ b/src/ca/scaiis.cpp @@ -12,13 +12,13 @@ HRESULT ScaMetabaseTransaction(__in_z LPCWSTR wzBackup) // TODO: These functions have been reported to hang IIS (O11:51709). They may have been fixed in IIS6, but if not, need to be re-written the hard way - hr = WcaDoDeferredAction(L"StartMetabaseTransaction", wzBackup, COST_IIS_TRANSACTIONS); + hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION(L"StartMetabaseTransaction"), wzBackup, COST_IIS_TRANSACTIONS); ExitOnFailure(hr, "Failed to schedule StartMetabaseTransaction"); - hr = WcaDoDeferredAction(L"RollbackMetabaseTransaction", wzBackup, 0); // rollback cost is irrelevant + hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION(L"RollbackMetabaseTransaction"), wzBackup, 0); // rollback cost is irrelevant ExitOnFailure(hr, "Failed to schedule RollbackMetabaseTransaction"); - hr = WcaDoDeferredAction(L"CommitMetabaseTransaction", wzBackup, 0); // commit is free + hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION(L"CommitMetabaseTransaction"), wzBackup, 0); // commit is free ExitOnFailure(hr, "Failed to schedule StartMetabaseTransaction"); LExit: diff --git a/src/ca/scaiis7.cpp b/src/ca/scaiis7.cpp index f0f4a629..aaf307d7 100644 --- a/src/ca/scaiis7.cpp +++ b/src/ca/scaiis7.cpp @@ -8,13 +8,13 @@ HRESULT ScaIIS7ConfigTransaction(LPCWSTR wzBackup) { HRESULT hr = S_OK; - hr = WcaDoDeferredAction(L"StartIIS7ConfigTransaction", wzBackup, COST_IIS_TRANSACTIONS); + hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION(L"StartIIS7ConfigTransaction"), wzBackup, COST_IIS_TRANSACTIONS); ExitOnFailure(hr, "Failed to schedule StartIIS7ConfigTransaction"); - hr = WcaDoDeferredAction(L"RollbackIIS7ConfigTransaction", wzBackup, 0); // rollback cost is irrelevant + hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION(L"RollbackIIS7ConfigTransaction"), wzBackup, 0); // rollback cost is irrelevant ExitOnFailure(hr, "Failed to schedule RollbackIIS7ConfigTransaction"); - hr = WcaDoDeferredAction(L"CommitIIS7ConfigTransaction", wzBackup, 0); // commit is free + hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION(L"CommitIIS7ConfigTransaction"), wzBackup, 0); // commit is free ExitOnFailure(hr, "Failed to schedule StartIIS7ConfigTransaction"); LExit: diff --git a/src/ca/scasched.cpp b/src/ca/scasched.cpp index cdece45d..de021275 100644 --- a/src/ca/scasched.cpp +++ b/src/ca/scasched.cpp @@ -331,7 +331,7 @@ extern "C" UINT __stdcall ConfigureIIs( // This must remain trace only, CA data may contain password WcaLog(LOGMSG_TRACEONLY, "Custom Action Data for ConfigureIIS7Exec will be: %ls", pwzCustomActionData); - hr = WcaDoDeferredAction(L"ConfigureIIs7Exec", pwzCustomActionData, ConfigureIIsCost); + hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION(L"ConfigureIIs7Exec"), pwzCustomActionData, ConfigureIIsCost); ExitOnFailure(hr, "Failed to schedule ConfigureIIs7Exec custom action"); ReleaseNullStr(pwzCustomActionData); @@ -340,7 +340,7 @@ extern "C" UINT __stdcall ConfigureIIs( hr = WcaWriteStringToCaData(pwzScriptKey, &pwzCustomActionData); ExitOnFailure(hr, "Failed to add script key to CustomActionData."); - hr = WcaDoDeferredAction(L"WriteIIS7ConfigChanges", pwzCustomActionData, WriteIIS7ConfigChangesCost); + hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION(L"WriteIIS7ConfigChanges"), pwzCustomActionData, WriteIIS7ConfigChangesCost); ExitOnFailure(hr, "Failed to schedule WriteMetabaseChanges custom action"); } else @@ -348,7 +348,7 @@ extern "C" UINT __stdcall ConfigureIIs( // This must remain trace only, CA data may contain password WcaLog(LOGMSG_TRACEONLY, "Custom Action Data for ConfigureIISExec will be: %ls", pwzCustomActionData); - hr = WcaDoDeferredAction(L"ConfigureIIsExec", pwzCustomActionData, ConfigureIIsCost); + hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION(L"ConfigureIIsExec"), pwzCustomActionData, ConfigureIIsCost); ExitOnFailure(hr, "Failed to schedule ConfigureIISExec custom action"); ReleaseNullStr(pwzCustomActionData); @@ -357,7 +357,7 @@ extern "C" UINT __stdcall ConfigureIIs( hr = WcaWriteStringToCaData(pwzScriptKey, &pwzCustomActionData); ExitOnFailure(hr, "Failed to add script key to CustomActionData."); - hr = WcaDoDeferredAction(L"WriteMetabaseChanges", pwzCustomActionData, WriteMetabaseChangesCost); + hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION(L"WriteMetabaseChanges"), pwzCustomActionData, WriteMetabaseChangesCost); ExitOnFailure(hr, "Failed to schedule WriteMetabaseChanges custom action"); } diff --git a/src/wixext/IIsCompiler.cs b/src/wixext/IIsCompiler.cs index 6f0cdd5e..a221e78a 100644 --- a/src/wixext/IIsCompiler.cs +++ b/src/wixext/IIsCompiler.cs @@ -8,6 +8,7 @@ namespace WixToolset.Iis using System.Xml.Linq; using WixToolset.Data; using WixToolset.Extensibility; + using WixToolset.Extensibility.Data; using WixToolset.Iis.Symbols; /// @@ -287,8 +288,8 @@ namespace WixToolset.Iis this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, element); // Reference InstallCertificates and UninstallCertificates since nothing will happen without them - this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, SymbolDefinitions.CustomAction, "InstallCertificates"); - this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, SymbolDefinitions.CustomAction, "UninstallCertificates"); + this.ParseHelper.CreateCustomActionReference(sourceLineNumbers, section, "InstallCertificates", this.Context.Platform, CustomActionPlatforms.X86 | CustomActionPlatforms.X64 | CustomActionPlatforms.ARM | CustomActionPlatforms.ARM64); + this.ParseHelper.CreateCustomActionReference(sourceLineNumbers, section, "UninstallCertificates", this.Context.Platform, CustomActionPlatforms.X86 | CustomActionPlatforms.X64 | CustomActionPlatforms.ARM | CustomActionPlatforms.ARM64); this.ParseHelper.EnsureTable(section, sourceLineNumbers, IisTableDefinitions.CertificateHash); // Certificate CustomActions require the CertificateHash table if (!this.Messaging.EncounteredError) @@ -2603,7 +2604,7 @@ namespace WixToolset.Iis private void AddReferenceToConfigureIIs(IntermediateSection section, SourceLineNumber sourceLineNumbers) { - this.ParseHelper.CreateSimpleReference(section, sourceLineNumbers, SymbolDefinitions.CustomAction, "ConfigureIIs"); + this.ParseHelper.CreateCustomActionReference(sourceLineNumbers, section, "ConfigureIIs", this.Context.Platform, CustomActionPlatforms.X86 | CustomActionPlatforms.X64 | CustomActionPlatforms.ARM | CustomActionPlatforms.ARM64); } } } diff --git a/src/wixlib/IIsExtension_Platform.wxi b/src/wixlib/IIsExtension_Platform.wxi index ad53f0c1..dd9646df 100644 --- a/src/wixlib/IIsExtension_Platform.wxi +++ b/src/wixlib/IIsExtension_Platform.wxi @@ -3,40 +3,40 @@ - - + + - !(loc.ConfigureIIs) - !(loc.ConfigureIIsExec) - !(loc.StartMetabaseTransaction) - !(loc.RollbackMetabaseTransaction) - !(loc.CommitMetabaseTransaction) - !(loc.WriteMetabaseChanges) + !(loc.ConfigureIIs) + !(loc.ConfigureIIsExec) + !(loc.StartMetabaseTransaction) + !(loc.RollbackMetabaseTransaction) + !(loc.CommitMetabaseTransaction) + !(loc.WriteMetabaseChanges) - !(loc.ConfigureIIs7Exec) - !(loc.StartIIS7ConfigTransaction) - !(loc.RollbackIIS7ConfigTransaction) - !(loc.CommitIIS7ConfigTransaction) - !(loc.WriteIIS7ConfigChanges) + !(loc.ConfigureIIs7Exec) + !(loc.StartIIS7ConfigTransaction) + !(loc.RollbackIIS7ConfigTransaction) + !(loc.CommitIIS7ConfigTransaction) + !(loc.WriteIIS7ConfigChanges) - - - - - - + + + + + + - - - - - + + + + + - NOT SKIPCONFIGUREIIS AND VersionNT > 400 + NOT SKIPCONFIGUREIIS AND VersionNT > 400 @@ -45,18 +45,18 @@ - - + + - - - - + + + + - - - - + + + + VersionNT > 400 diff --git a/src/wixlib/IIsExtension_arm.wxs b/src/wixlib/IIsExtension_arm.wxs new file mode 100644 index 00000000..fff4e48e --- /dev/null +++ b/src/wixlib/IIsExtension_arm.wxs @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/src/wixlib/IIsExtension_arm64.wxs b/src/wixlib/IIsExtension_arm64.wxs new file mode 100644 index 00000000..62ce8053 --- /dev/null +++ b/src/wixlib/IIsExtension_arm64.wxs @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/src/wixlib/IIsExtension_x64.wxs b/src/wixlib/IIsExtension_x64.wxs new file mode 100644 index 00000000..26ef8625 --- /dev/null +++ b/src/wixlib/IIsExtension_x64.wxs @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/src/wixlib/caDecor.wxi b/src/wixlib/caDecor.wxi new file mode 100644 index 00000000..1d00df8f --- /dev/null +++ b/src/wixlib/caDecor.wxi @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/wixlib/caSuffix.wxi b/src/wixlib/caSuffix.wxi deleted file mode 100644 index a56a2393..00000000 --- a/src/wixlib/caSuffix.wxi +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/wixlib/iis.wixproj b/src/wixlib/iis.wixproj index 3ebfc2f4..689b3508 100644 --- a/src/wixlib/iis.wixproj +++ b/src/wixlib/iis.wixproj @@ -8,7 +8,10 @@ - + + + + -- cgit v1.2.3-55-g6feb