From c134594328bd63fb19b88239694523f04108030e Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Mon, 6 Jul 2020 12:34:48 -0400 Subject: Add per-platform custom action support. --- src/ca/caDecor.h | 13 +++++++++++++ src/ca/precomp.h | 2 ++ src/ca/scadb.cpp | 6 +++--- src/ca/scasqlstr.cpp | 4 ++-- src/ca/sqlca.vcxproj | 26 +++++++++++++++++++++++++- 5 files changed, 45 insertions(+), 6 deletions(-) create mode 100644 src/ca/caDecor.h (limited to 'src/ca') 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/precomp.h b/src/ca/precomp.h index 08454d3a..266d543c 100644 --- a/src/ca/precomp.h +++ b/src/ca/precomp.h @@ -24,3 +24,5 @@ #include "sca.h" #include "scacost.h" #include "scasqlstr.h" + +#include "caDecor.h" diff --git a/src/ca/scadb.cpp b/src/ca/scadb.cpp index 9f9efca2..68f7b10b 100644 --- a/src/ca/scadb.cpp +++ b/src/ca/scadb.cpp @@ -385,7 +385,7 @@ static HRESULT SchedCreateDatabase( hr = SqlDatabaseExists(psd->wzServer, psd->wzInstance, psd->wzDatabase, psd->fUseIntegratedAuth, psd->scau.wzName, psd->scau.wzPassword, NULL); if (S_FALSE == hr) { - hr = WcaDoDeferredAction(L"RollbackCreateDatabase", pwzCustomActionData, COST_SQL_CREATEDB); + hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION(L"RollbackCreateDatabase"), pwzCustomActionData, COST_SQL_CREATEDB); ExitOnFailure(hr, "Failed to schedule RollbackCreateDatabase action"); } @@ -444,7 +444,7 @@ static HRESULT SchedCreateDatabase( } // schedule the CreateDatabase action - hr = WcaDoDeferredAction(L"CreateDatabase", pwzCustomActionData, COST_SQL_CREATEDB); + hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION(L"CreateDatabase"), pwzCustomActionData, COST_SQL_CREATEDB); ExitOnFailure(hr, "Failed to schedule CreateDatabase action"); LExit: @@ -491,7 +491,7 @@ HRESULT SchedDropDatabase( hr = WcaWriteStringToCaData(wzPassword, &pwzCustomActionData); ExitOnFailure(hr, "Failed to add user password to CustomActionData"); - hr = WcaDoDeferredAction(L"DropDatabase", pwzCustomActionData, COST_SQL_DROPDB); + hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION(L"DropDatabase"), pwzCustomActionData, COST_SQL_DROPDB); ExitOnFailure(hr, "Failed to schedule DropDatabase action"); LExit: diff --git a/src/ca/scasqlstr.cpp b/src/ca/scasqlstr.cpp index 3108e307..6ac526a6 100644 --- a/src/ca/scasqlstr.cpp +++ b/src/ca/scasqlstr.cpp @@ -654,7 +654,7 @@ static HRESULT ExecuteStrings( { Assert(pwzCustomActionData && *pwzCustomActionData && uiCost); - hr = WcaDoDeferredAction(1 == iOldRollback ? L"RollbackExecuteSqlStrings" : L"ExecuteSqlStrings", pwzCustomActionData, uiCost); + hr = WcaDoDeferredAction(1 == iOldRollback ? CUSTOM_ACTION_DECORATION(L"RollbackExecuteSqlStrings") : CUSTOM_ACTION_DECORATION(L"ExecuteSqlStrings"), pwzCustomActionData, uiCost); ExitOnFailure(hr, "failed to schedule ExecuteSqlStrings action, rollback: %d", iOldRollback); iOldRollback = iRollback; @@ -714,7 +714,7 @@ static HRESULT ExecuteStrings( if (pwzCustomActionData && *pwzCustomActionData) { Assert(pwzCustomActionData && *pwzCustomActionData && uiCost); - hr = WcaDoDeferredAction(1 == iRollback ? L"RollbackExecuteSqlStrings" : L"ExecuteSqlStrings", pwzCustomActionData, uiCost); + hr = WcaDoDeferredAction(1 == iRollback ? CUSTOM_ACTION_DECORATION(L"RollbackExecuteSqlStrings") : CUSTOM_ACTION_DECORATION(L"ExecuteSqlStrings"), pwzCustomActionData, uiCost); ExitOnFailure(hr, "Failed to schedule ExecuteSqlStrings action"); *pwzCustomActionData = L'\0'; diff --git a/src/ca/sqlca.vcxproj b/src/ca/sqlca.vcxproj index 3c8c1a6c..e1c5beea 100644 --- a/src/ca/sqlca.vcxproj +++ b/src/ca/sqlca.vcxproj @@ -14,13 +14,37 @@ Release Win32 + + Debug + x64 + + + Release + x64 + + + Debug + ARM + + + Release + ARM + + + Debug + ARM64 + + + Release + ARM64 + {4DCA6E4B-A1F1-4450-BC2D-94AC20F31935} DynamicLibrary sqlca - v141 + v142 Unicode sqlca.def WiX Toolset Sql CustomAction -- cgit v1.2.3-55-g6feb