diff options
| author | Sean Hall <r.sean.hall@gmail.com> | 2018-12-16 21:19:24 -0600 |
|---|---|---|
| committer | Sean Hall <r.sean.hall@gmail.com> | 2018-12-16 21:20:40 -0600 |
| commit | 95a5a8f9efef02ddcec5b3f69be99a00d71a802a (patch) | |
| tree | f0a92b8e8e37e17af6053db11f1b8a7a532cd12c /src/ca/scaiis7.cpp | |
| parent | aec6e9a4b21accd2e8aeb2cb36ad1cdc8f308f79 (diff) | |
| download | wix-95a5a8f9efef02ddcec5b3f69be99a00d71a802a.tar.gz wix-95a5a8f9efef02ddcec5b3f69be99a00d71a802a.tar.bz2 wix-95a5a8f9efef02ddcec5b3f69be99a00d71a802a.zip | |
Import implementation of IisCA from old repo's scasched/scaexec.
Diffstat (limited to 'src/ca/scaiis7.cpp')
| -rw-r--r-- | src/ca/scaiis7.cpp | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/src/ca/scaiis7.cpp b/src/ca/scaiis7.cpp new file mode 100644 index 00000000..f0f4a629 --- /dev/null +++ b/src/ca/scaiis7.cpp | |||
| @@ -0,0 +1,74 @@ | |||
| 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 | #include "precomp.h" | ||
| 4 | |||
| 5 | #define COST_IIS_WRITEKEY 10 | ||
| 6 | |||
| 7 | HRESULT ScaIIS7ConfigTransaction(LPCWSTR wzBackup) | ||
| 8 | { | ||
| 9 | HRESULT hr = S_OK; | ||
| 10 | |||
| 11 | hr = WcaDoDeferredAction(L"StartIIS7ConfigTransaction", wzBackup, COST_IIS_TRANSACTIONS); | ||
| 12 | ExitOnFailure(hr, "Failed to schedule StartIIS7ConfigTransaction"); | ||
| 13 | |||
| 14 | hr = WcaDoDeferredAction(L"RollbackIIS7ConfigTransaction", wzBackup, 0); // rollback cost is irrelevant | ||
| 15 | ExitOnFailure(hr, "Failed to schedule RollbackIIS7ConfigTransaction"); | ||
| 16 | |||
| 17 | hr = WcaDoDeferredAction(L"CommitIIS7ConfigTransaction", wzBackup, 0); // commit is free | ||
| 18 | ExitOnFailure(hr, "Failed to schedule StartIIS7ConfigTransaction"); | ||
| 19 | |||
| 20 | LExit: | ||
| 21 | return hr; | ||
| 22 | } | ||
| 23 | |||
| 24 | HRESULT ScaWriteConfigString(const LPCWSTR wzValue) | ||
| 25 | { | ||
| 26 | HRESULT hr = S_OK; | ||
| 27 | WCHAR* pwzCustomActionData = NULL; | ||
| 28 | |||
| 29 | hr = WcaWriteStringToCaData(wzValue, &pwzCustomActionData); | ||
| 30 | ExitOnFailure(hr, "Failed to add metabase delete key directive to CustomActionData"); | ||
| 31 | |||
| 32 | hr = ScaAddToIisConfiguration(pwzCustomActionData, COST_IIS_WRITEKEY); | ||
| 33 | ExitOnFailure(hr, "Failed to add ScaWriteMetabaseValue action data: %ls, cost: %d", pwzCustomActionData, COST_IIS_WRITEKEY); | ||
| 34 | |||
| 35 | LExit: | ||
| 36 | ReleaseStr(pwzCustomActionData); | ||
| 37 | |||
| 38 | return hr; | ||
| 39 | } | ||
| 40 | |||
| 41 | HRESULT ScaWriteConfigInteger(DWORD dwValue) | ||
| 42 | { | ||
| 43 | HRESULT hr = S_OK; | ||
| 44 | WCHAR* pwzCustomActionData = NULL; | ||
| 45 | |||
| 46 | hr = WcaWriteIntegerToCaData(dwValue, &pwzCustomActionData); | ||
| 47 | ExitOnFailure(hr, "Failed to add metabase delete key directive to CustomActionData"); | ||
| 48 | |||
| 49 | hr = ScaAddToIisConfiguration(pwzCustomActionData, COST_IIS_WRITEKEY); | ||
| 50 | ExitOnFailure(hr, "Failed to add ScaWriteMetabaseValue action data: %ls, cost: %d", pwzCustomActionData, COST_IIS_WRITEKEY); | ||
| 51 | |||
| 52 | LExit: | ||
| 53 | ReleaseStr(pwzCustomActionData); | ||
| 54 | |||
| 55 | return hr; | ||
| 56 | } | ||
| 57 | |||
| 58 | HRESULT ScaWriteConfigID(IIS_CONFIG_ACTION emID) | ||
| 59 | { | ||
| 60 | HRESULT hr = S_OK; | ||
| 61 | WCHAR* pwzCustomActionData = NULL; | ||
| 62 | |||
| 63 | hr = WcaWriteIntegerToCaData(emID, &pwzCustomActionData); | ||
| 64 | ExitOnFailure(hr, "Failed to add metabase delete key directive to CustomActionData"); | ||
| 65 | |||
| 66 | hr = ScaAddToIisConfiguration(pwzCustomActionData, COST_IIS_WRITEKEY); | ||
| 67 | ExitOnFailure(hr, "Failed to add ScaWriteMetabaseValue action data: %ls, cost: %d", pwzCustomActionData, COST_IIS_WRITEKEY); | ||
| 68 | |||
| 69 | LExit: | ||
| 70 | ReleaseStr(pwzCustomActionData); | ||
| 71 | |||
| 72 | return hr; | ||
| 73 | } | ||
| 74 | |||
