diff options
Diffstat (limited to 'src/ext/Iis/ca/scaweberr7.cpp')
-rw-r--r-- | src/ext/Iis/ca/scaweberr7.cpp | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/src/ext/Iis/ca/scaweberr7.cpp b/src/ext/Iis/ca/scaweberr7.cpp new file mode 100644 index 00000000..33c2f1bd --- /dev/null +++ b/src/ext/Iis/ca/scaweberr7.cpp | |||
@@ -0,0 +1,88 @@ | |||
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 ScaWriteWebError7( | ||
6 | __in_z LPCWSTR wzWebName, | ||
7 | __in_z LPCWSTR wzRoot, | ||
8 | SCA_WEB_ERROR* psweList | ||
9 | ) | ||
10 | { | ||
11 | HRESULT hr = S_OK; | ||
12 | |||
13 | hr = ScaWriteConfigID(IIS_WEBERROR_BEGIN); | ||
14 | ExitOnFailure(hr, "Fail to write webError begin ID"); | ||
15 | |||
16 | hr = ScaWriteConfigString(wzWebName); | ||
17 | ExitOnFailure(hr, "Fail to write webError Web Key"); | ||
18 | |||
19 | hr = ScaWriteConfigString(wzRoot); | ||
20 | ExitOnFailure(hr, "Fail to write webError Vdir key"); | ||
21 | |||
22 | // Loop through the HTTP headers | ||
23 | for (SCA_WEB_ERROR* pswe = psweList; pswe; pswe = pswe->psweNext) | ||
24 | { | ||
25 | hr = ScaWriteConfigID(IIS_WEBERROR); | ||
26 | ExitOnFailure(hr, "Fail to write webError ID"); | ||
27 | |||
28 | hr = ScaWriteConfigInteger(pswe->iErrorCode); | ||
29 | ExitOnFailure(hr, "Fail to write webError code"); | ||
30 | |||
31 | hr = ScaWriteConfigInteger(pswe->iSubCode); | ||
32 | ExitOnFailure(hr, "Fail to write webError subcode"); | ||
33 | |||
34 | //just write one | ||
35 | if (*(pswe->wzFile)) | ||
36 | { | ||
37 | hr = ScaWriteConfigString(pswe->wzFile); | ||
38 | ExitOnFailure(hr, "Fail to write webError file"); | ||
39 | hr = ScaWriteConfigInteger(0); | ||
40 | ExitOnFailure(hr, "Fail to write webError file code"); | ||
41 | } | ||
42 | else if (*(pswe->wzURL)) | ||
43 | { | ||
44 | hr = ScaWriteConfigString(pswe->wzURL); | ||
45 | ExitOnFailure(hr, "Fail to write webError URL"); | ||
46 | hr = ScaWriteConfigInteger(1); | ||
47 | ExitOnFailure(hr, "Fail to write webError URL code"); | ||
48 | } | ||
49 | } | ||
50 | |||
51 | hr = ScaWriteConfigID(IIS_WEBERROR_END); | ||
52 | ExitOnFailure(hr, "Fail to write httpHeader end ID"); | ||
53 | |||
54 | LExit: | ||
55 | return hr; | ||
56 | |||
57 | } | ||
58 | |||
59 | //static HRESULT AddWebErrorToList(SCA_WEB_ERROR** ppsweList) | ||
60 | //{ | ||
61 | // HRESULT hr = S_OK; | ||
62 | // | ||
63 | // SCA_WEB_ERROR* pswe = static_cast<SCA_WEB_ERROR*>(MemAlloc(sizeof(SCA_WEB_ERROR), TRUE)); | ||
64 | // ExitOnNull(pswe, hr, E_OUTOFMEMORY, "failed to allocate memory for new web error list element"); | ||
65 | // | ||
66 | // pswe->psweNext = *ppsweList; | ||
67 | // *ppsweList = pswe; | ||
68 | // | ||
69 | //LExit: | ||
70 | // return hr; | ||
71 | //} | ||
72 | |||
73 | HRESULT ScaWebErrorCheckList7(SCA_WEB_ERROR* psweList) | ||
74 | { | ||
75 | if (!psweList) | ||
76 | { | ||
77 | return S_OK; | ||
78 | } | ||
79 | |||
80 | while (psweList) | ||
81 | { | ||
82 | WcaLog(LOGMSG_STANDARD, "WebError code: %d subcode: %d for parent: %ls not used!", psweList->iErrorCode, psweList->iSubCode, psweList->wzParentValue); | ||
83 | psweList = psweList->psweNext; | ||
84 | } | ||
85 | |||
86 | return E_FAIL; | ||
87 | } | ||
88 | |||