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
|
// 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 ScaWriteWebError7(
__in_z LPCWSTR wzWebName,
__in_z LPCWSTR wzRoot,
SCA_WEB_ERROR* psweList
)
{
HRESULT hr = S_OK;
hr = ScaWriteConfigID(IIS_WEBERROR_BEGIN);
ExitOnFailure(hr, "Fail to write webError begin ID");
hr = ScaWriteConfigString(wzWebName);
ExitOnFailure(hr, "Fail to write webError Web Key");
hr = ScaWriteConfigString(wzRoot);
ExitOnFailure(hr, "Fail to write webError Vdir key");
// Loop through the HTTP headers
for (SCA_WEB_ERROR* pswe = psweList; pswe; pswe = pswe->psweNext)
{
hr = ScaWriteConfigID(IIS_WEBERROR);
ExitOnFailure(hr, "Fail to write webError ID");
hr = ScaWriteConfigInteger(pswe->iErrorCode);
ExitOnFailure(hr, "Fail to write webError code");
hr = ScaWriteConfigInteger(pswe->iSubCode);
ExitOnFailure(hr, "Fail to write webError subcode");
//just write one
if (*(pswe->wzFile))
{
hr = ScaWriteConfigString(pswe->wzFile);
ExitOnFailure(hr, "Fail to write webError file");
hr = ScaWriteConfigInteger(0);
ExitOnFailure(hr, "Fail to write webError file code");
}
else if (*(pswe->wzURL))
{
hr = ScaWriteConfigString(pswe->wzURL);
ExitOnFailure(hr, "Fail to write webError URL");
hr = ScaWriteConfigInteger(1);
ExitOnFailure(hr, "Fail to write webError URL code");
}
}
hr = ScaWriteConfigID(IIS_WEBERROR_END);
ExitOnFailure(hr, "Fail to write httpHeader end ID");
LExit:
return hr;
}
//static HRESULT AddWebErrorToList(SCA_WEB_ERROR** ppsweList)
//{
// HRESULT hr = S_OK;
//
// SCA_WEB_ERROR* pswe = static_cast<SCA_WEB_ERROR*>(MemAlloc(sizeof(SCA_WEB_ERROR), TRUE));
// ExitOnNull(pswe, hr, E_OUTOFMEMORY, "failed to allocate memory for new web error list element");
//
// pswe->psweNext = *ppsweList;
// *ppsweList = pswe;
//
//LExit:
// return hr;
//}
HRESULT ScaWebErrorCheckList7(SCA_WEB_ERROR* psweList)
{
if (!psweList)
{
return S_OK;
}
while (psweList)
{
WcaLog(LOGMSG_STANDARD, "WebError code: %d subcode: %d for parent: %ls not used!", psweList->iErrorCode, psweList->iSubCode, psweList->wzParentValue);
psweList = psweList->psweNext;
}
return E_FAIL;
}
|