aboutsummaryrefslogtreecommitdiff
path: root/src/ext/Iis/ca/scawebsvcext7.cpp
blob: dcf2f7f86c53bfe6785a8833a6e94f9c43e52ae2 (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
// 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"

static HRESULT ScaWebSvcExtInstall(
    const SCA_WEBSVCEXT* psWseList
    );

static HRESULT ScaWebSvcExtUninstall(
    const SCA_WEBSVCEXT* psWseList
    );

// functions
// Commit does both install and uninstall
HRESULT __stdcall ScaWebSvcExtCommit7(
    __in SCA_WEBSVCEXT* psWseList
    )
{
    HRESULT hr = S_OK;

    if (!psWseList)
    {
        WcaLog(LOGMSG_VERBOSE, "Skipping ScaWebSvcExtCommit() because there are no web service extensions in the list");
        ExitFunction();
    }

    // Make changes to local copy of metabase
    while (psWseList)
    {
        if (WcaIsInstalling(psWseList->isInstalled, psWseList->isAction))
        {
            hr = ScaWebSvcExtInstall(psWseList);
            ExitOnFailure(hr, "Failed to install Web Service extension");
        }
        else if (WcaIsUninstalling(psWseList->isInstalled, psWseList->isAction))
        {
            hr = ScaWebSvcExtUninstall(psWseList);
            ExitOnFailure(hr, "Failed to uninstall Web Service extension");
        }

        psWseList = psWseList->psWseNext;
    }


LExit:

    return hr;
}


static HRESULT ScaWebSvcExtInstall(
    const SCA_WEBSVCEXT* psWseList
    )
{
    HRESULT hr = S_OK;
    int iAllow;

    //Write CAData actions
    hr = ScaWriteConfigID(IIS_WEB_SVC_EXT);
    ExitOnFailure(hr, "failed add web svc ext ID");
    hr = ScaWriteConfigID(IIS_CREATE);
    ExitOnFailure(hr, "failed add web svc ext action");

    // write File path
    hr = ScaWriteConfigString(psWseList->wzFile);
    ExitOnFailure(hr, "failed add web svc ext file path");

    // write allowed
    // unDeleatable n/a in IIS7
    iAllow = (psWseList->iAttributes & 1);
    hr = ScaWriteConfigInteger(iAllow);
    ExitOnFailure(hr, "failed add web svc ext Allowed");

    //write group
    hr = ScaWriteConfigString(psWseList->wzGroup);
    ExitOnFailure(hr, "failed add web svc ext group");

    //write description
    hr = ScaWriteConfigString(psWseList->wzDescription);
    ExitOnFailure(hr, "failed add web svc ext description");

LExit:

    return hr;
}


static HRESULT ScaWebSvcExtUninstall(
    const SCA_WEBSVCEXT* psWseList
    )
{
    HRESULT hr = S_OK;

    //Write CAData actions
    hr = ScaWriteConfigID(IIS_WEB_SVC_EXT);
    ExitOnFailure(hr, "failed add web svc ext ID");
    hr = ScaWriteConfigID(IIS_DELETE);
    ExitOnFailure(hr, "failed add web svc ext action");

    // write File path (Key)
    hr = ScaWriteConfigString(psWseList->wzFile);
    ExitOnFailure(hr, "failed add web svc ext file path");

LExit:
    return hr;
}