main
cpp 106 lines 2.69 KB
Raw
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 static HRESULT ScaWebSvcExtInstall(
6 const SCA_WEBSVCEXT* psWseList
7 );
8
9 static HRESULT ScaWebSvcExtUninstall(
10 const SCA_WEBSVCEXT* psWseList
11 );
12
13 // functions
14 // Commit does both install and uninstall
15 HRESULT __stdcall ScaWebSvcExtCommit7(
16 __in SCA_WEBSVCEXT* psWseList
17 )
18 {
19 HRESULT hr = S_OK;
20
21 if (!psWseList)
22 {
23 WcaLog(LOGMSG_VERBOSE, "Skipping ScaWebSvcExtCommit() because there are no web service extensions in the list");
24 ExitFunction();
25 }
26
27 // Make changes to local copy of metabase
28 while (psWseList)
29 {
30 if (WcaIsInstalling(psWseList->isInstalled, psWseList->isAction))
31 {
32 hr = ScaWebSvcExtInstall(psWseList);
33 ExitOnFailure(hr, "Failed to install Web Service extension");
34 }
35 else if (WcaIsUninstalling(psWseList->isInstalled, psWseList->isAction))
36 {
37 hr = ScaWebSvcExtUninstall(psWseList);
38 ExitOnFailure(hr, "Failed to uninstall Web Service extension");
39 }
40
41 psWseList = psWseList->psWseNext;
42 }
43
44
45 LExit:
46
47 return hr;
48 }
49
50
51 static HRESULT ScaWebSvcExtInstall(
52 const SCA_WEBSVCEXT* psWseList
53 )
54 {
55 HRESULT hr = S_OK;
56 int iAllow;
57
58 //Write CAData actions
59 hr = ScaWriteConfigID(IIS_WEB_SVC_EXT);
60 ExitOnFailure(hr, "failed add web svc ext ID");
61 hr = ScaWriteConfigID(IIS_CREATE);
62 ExitOnFailure(hr, "failed add web svc ext action");
63
64 // write File path
65 hr = ScaWriteConfigString(psWseList->wzFile);
66 ExitOnFailure(hr, "failed add web svc ext file path");
67
68 // write allowed
69 // unDeleatable n/a in IIS7
70 iAllow = (psWseList->iAttributes & 1);
71 hr = ScaWriteConfigInteger(iAllow);
72 ExitOnFailure(hr, "failed add web svc ext Allowed");
73
74 //write group
75 hr = ScaWriteConfigString(psWseList->wzGroup);
76 ExitOnFailure(hr, "failed add web svc ext group");
77
78 //write description
79 hr = ScaWriteConfigString(psWseList->wzDescription);
80 ExitOnFailure(hr, "failed add web svc ext description");
81
82 LExit:
83
84 return hr;
85 }
86
87
88 static HRESULT ScaWebSvcExtUninstall(
89 const SCA_WEBSVCEXT* psWseList
90 )
91 {
92 HRESULT hr = S_OK;
93
94 //Write CAData actions
95 hr = ScaWriteConfigID(IIS_WEB_SVC_EXT);
96 ExitOnFailure(hr, "failed add web svc ext ID");
97 hr = ScaWriteConfigID(IIS_DELETE);
98 ExitOnFailure(hr, "failed add web svc ext action");
99
100 // write File path (Key)
101 hr = ScaWriteConfigString(psWseList->wzFile);
102 ExitOnFailure(hr, "failed add web svc ext file path");
103
104 LExit:
105 return hr;
106 }