diff options
Diffstat (limited to 'src/ext/Iis/ca/scaproperty7.cpp')
-rw-r--r-- | src/ext/Iis/ca/scaproperty7.cpp | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/src/ext/Iis/ca/scaproperty7.cpp b/src/ext/Iis/ca/scaproperty7.cpp new file mode 100644 index 00000000..d17eeb68 --- /dev/null +++ b/src/ext/Iis/ca/scaproperty7.cpp | |||
@@ -0,0 +1,108 @@ | |||
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 | HRESULT ScaPropertyInstall7( | ||
6 | SCA_PROPERTY* pspList | ||
7 | ) | ||
8 | { | ||
9 | HRESULT hr = S_OK; | ||
10 | |||
11 | for (SCA_PROPERTY* psp = pspList; psp; psp = psp->pspNext) | ||
12 | { | ||
13 | // if we are installing the web site | ||
14 | if (WcaIsInstalling(psp->isInstalled, psp->isAction)) | ||
15 | { | ||
16 | hr = ScaWriteProperty7(psp); | ||
17 | ExitOnFailure(hr, "failed to write Property '%ls' ", psp->wzProperty); | ||
18 | } | ||
19 | } | ||
20 | |||
21 | LExit: | ||
22 | return hr; | ||
23 | } | ||
24 | |||
25 | |||
26 | HRESULT ScaPropertyUninstall7( | ||
27 | SCA_PROPERTY* pspList | ||
28 | ) | ||
29 | { | ||
30 | HRESULT hr = S_OK; | ||
31 | |||
32 | for (SCA_PROPERTY* psp = pspList; psp; psp = psp->pspNext) | ||
33 | { | ||
34 | // if we are uninstalling the web site | ||
35 | if (WcaIsUninstalling(psp->isInstalled, psp->isAction)) | ||
36 | { | ||
37 | hr = ScaRemoveProperty7(psp); | ||
38 | ExitOnFailure(hr, "Failed to remove Property '%ls'", psp->wzProperty); | ||
39 | } | ||
40 | } | ||
41 | |||
42 | LExit: | ||
43 | return hr; | ||
44 | } | ||
45 | |||
46 | |||
47 | HRESULT ScaWriteProperty7( | ||
48 | const SCA_PROPERTY* psp | ||
49 | ) | ||
50 | { | ||
51 | HRESULT hr = S_OK; | ||
52 | DWORD dwValue; | ||
53 | LPWSTR wz = NULL; | ||
54 | |||
55 | ExitOnNull(psp, hr, E_INVALIDARG, "Failed to write property because no property to write was given"); | ||
56 | // | ||
57 | // Figure out what setting we're writing and write it | ||
58 | // | ||
59 | if (0 == wcscmp(psp->wzProperty, wzIISPROPERTY_IIS5_ISOLATION_MODE)) | ||
60 | { | ||
61 | // IIs5IsolationMode not supported | ||
62 | WcaLog(LOGMSG_VERBOSE, "Not supported by IIS7: IIs5IsolationMode, ignoring"); | ||
63 | } | ||
64 | else if (0 == wcscmp(psp->wzProperty, wzIISPROPERTY_MAX_GLOBAL_BANDWIDTH)) | ||
65 | { | ||
66 | dwValue = wcstoul(psp->wzValue, &wz, 10) * 1024; // remember, the value shown is in kilobytes, the value saved is in bytes | ||
67 | hr = ScaWriteConfigID(IIS_PROPERTY); | ||
68 | ExitOnFailure(hr, "failed to set Property ID"); | ||
69 | hr = ScaWriteConfigID(IIS_PROPERTY_MAXBAND); | ||
70 | ExitOnFailure(hr, "failed to set Property MSXBAND ID"); | ||
71 | hr = ScaWriteConfigInteger(dwValue); | ||
72 | ExitOnFailure(hr, "failed to set Property MSXBAND value"); | ||
73 | } | ||
74 | else if (0 == wcscmp(psp->wzProperty, wzIISPROPERTY_LOG_IN_UTF8)) | ||
75 | { | ||
76 | dwValue = 1; | ||
77 | hr = ScaWriteConfigID(IIS_PROPERTY); | ||
78 | ExitOnFailure(hr, "failed to set Property ID"); | ||
79 | hr = ScaWriteConfigID(IIS_PROPERTY_LOGUTF8); | ||
80 | ExitOnFailure(hr, "failed to set Property LOG ID"); | ||
81 | hr = ScaWriteConfigInteger(dwValue); | ||
82 | ExitOnFailure(hr, "failed to set Property Log value"); | ||
83 | } | ||
84 | else if (0 == wcscmp(psp->wzProperty, wzIISPROPERTY_ETAG_CHANGENUMBER)) | ||
85 | { | ||
86 | //EtagChangenumber not supported | ||
87 | WcaLog(LOGMSG_VERBOSE, "Not supported by IIS7: EtagChangenumber, ignoring"); | ||
88 | } | ||
89 | |||
90 | LExit: | ||
91 | return hr; | ||
92 | } | ||
93 | |||
94 | HRESULT ScaRemoveProperty7( | ||
95 | __in SCA_PROPERTY* /*psp*/ | ||
96 | ) | ||
97 | { | ||
98 | |||
99 | // NOP function for now | ||
100 | //The two global values being set by WebProperty: | ||
101 | // <iis:WebProperty Id="MaxGlobalBandwidth" Value="1024" /> | ||
102 | // <iis:WebProperty Id ="LogInUTF8" /> | ||
103 | // should should not be removed on uninstall. | ||
104 | |||
105 | HRESULT hr = S_OK; | ||
106 | |||
107 | return hr; | ||
108 | } | ||