diff options
Diffstat (limited to 'src/ext/Iis/ca/scaiis7.cpp')
-rw-r--r-- | src/ext/Iis/ca/scaiis7.cpp | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/src/ext/Iis/ca/scaiis7.cpp b/src/ext/Iis/ca/scaiis7.cpp new file mode 100644 index 00000000..aaf307d7 --- /dev/null +++ b/src/ext/Iis/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(CUSTOM_ACTION_DECORATION(L"StartIIS7ConfigTransaction"), wzBackup, COST_IIS_TRANSACTIONS); | ||
12 | ExitOnFailure(hr, "Failed to schedule StartIIS7ConfigTransaction"); | ||
13 | |||
14 | hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION(L"RollbackIIS7ConfigTransaction"), wzBackup, 0); // rollback cost is irrelevant | ||
15 | ExitOnFailure(hr, "Failed to schedule RollbackIIS7ConfigTransaction"); | ||
16 | |||
17 | hr = WcaDoDeferredAction(CUSTOM_ACTION_DECORATION(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 | |||