aboutsummaryrefslogtreecommitdiff
path: root/src/ext/Iis/ca/scaproperty7.cpp
blob: d17eeb68f95f1c6a498ceaf2e39e49467b841aa0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
// 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.

#include "precomp.h"

HRESULT ScaPropertyInstall7(
    SCA_PROPERTY* pspList
    )
{
    HRESULT hr = S_OK;

    for (SCA_PROPERTY* psp = pspList; psp; psp = psp->pspNext)
    {
        // if we are installing the web site
        if (WcaIsInstalling(psp->isInstalled, psp->isAction))
        {
            hr = ScaWriteProperty7(psp);
            ExitOnFailure(hr, "failed to write Property '%ls' ", psp->wzProperty);
        }
    }

LExit:
    return hr;
}


HRESULT ScaPropertyUninstall7(
    SCA_PROPERTY* pspList
    )
{
    HRESULT hr = S_OK;

    for (SCA_PROPERTY* psp = pspList; psp; psp = psp->pspNext)
    {
        // if we are uninstalling the web site
        if (WcaIsUninstalling(psp->isInstalled, psp->isAction))
        {
            hr = ScaRemoveProperty7(psp);
            ExitOnFailure(hr, "Failed to remove Property '%ls'", psp->wzProperty);
        }
    }

LExit:
    return hr;
}


HRESULT ScaWriteProperty7(
    const SCA_PROPERTY* psp
    )
{
    HRESULT hr = S_OK;
    DWORD dwValue;
    LPWSTR wz = NULL;

    ExitOnNull(psp, hr, E_INVALIDARG, "Failed to write property because no property to write was given");
    //
    // Figure out what setting we're writing and write it
    //
    if (0 == wcscmp(psp->wzProperty, wzIISPROPERTY_IIS5_ISOLATION_MODE))
    {
        // IIs5IsolationMode not supported
        WcaLog(LOGMSG_VERBOSE, "Not supported by IIS7: IIs5IsolationMode, ignoring");
    }
    else if (0 == wcscmp(psp->wzProperty, wzIISPROPERTY_MAX_GLOBAL_BANDWIDTH))
    {
        dwValue = wcstoul(psp->wzValue, &wz, 10) * 1024; // remember, the value shown is in kilobytes, the value saved is in bytes
        hr = ScaWriteConfigID(IIS_PROPERTY);
        ExitOnFailure(hr, "failed to set Property ID");
        hr = ScaWriteConfigID(IIS_PROPERTY_MAXBAND);
        ExitOnFailure(hr, "failed to set Property MSXBAND ID");
        hr = ScaWriteConfigInteger(dwValue);
        ExitOnFailure(hr, "failed to set Property MSXBAND value");
    }
    else if (0 == wcscmp(psp->wzProperty, wzIISPROPERTY_LOG_IN_UTF8))
    {
        dwValue = 1;
        hr = ScaWriteConfigID(IIS_PROPERTY);
        ExitOnFailure(hr, "failed to set Property ID");
        hr = ScaWriteConfigID(IIS_PROPERTY_LOGUTF8);
        ExitOnFailure(hr, "failed to set Property LOG ID");
        hr = ScaWriteConfigInteger(dwValue);
        ExitOnFailure(hr, "failed to set Property Log value");
    }
    else if (0 == wcscmp(psp->wzProperty, wzIISPROPERTY_ETAG_CHANGENUMBER))
    {
        //EtagChangenumber not supported
        WcaLog(LOGMSG_VERBOSE, "Not supported by IIS7: EtagChangenumber, ignoring");
    }

LExit:
    return hr;
}

HRESULT ScaRemoveProperty7(
    __in SCA_PROPERTY* /*psp*/
    )
{

    // NOP function for now
    //The two global values being set by WebProperty:
    //    <iis:WebProperty Id="MaxGlobalBandwidth" Value="1024" />
    //    <iis:WebProperty Id ="LogInUTF8" />
    // should should not be removed on uninstall.

    HRESULT hr = S_OK;

    return hr;
}