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

// prototypes
HRESULT ScaWriteMimeMap7(
    __in_z LPCWSTR wzWebName,
    __in_z LPCWSTR wzRootOfWeb,
    SCA_MIMEMAP* psmmList
    )
{
    HRESULT hr = S_OK;
    SCA_MIMEMAP* psmm;

    //create the mimemap list for this vdir application
    //all go to same web/root location tag
    hr = ScaWriteConfigID(IIS_MIMEMAP_BEGIN);
    ExitOnFailure(hr, "Failed to write mimemap begin id");
    hr = ScaWriteConfigString(wzWebName);                //site name key
    ExitOnFailure(hr, "Failed to write mimemap web key");
    hr = ScaWriteConfigString(wzRootOfWeb);               //app path key
    ExitOnFailure(hr, "Failed to write mimemap app key");

    psmm = psmmList;

    while (psmm)
    {
        //create the Extension for this vdir application
        hr = ScaWriteConfigID(IIS_MIMEMAP);
        ExitOnFailure(hr, "Failed to write mimemap id");

        if (*psmm->wzExtension)
        {
            hr = ScaWriteConfigString(psmm->wzExtension);
        }
        else   // blank means "*" (all)
        {
            hr = ScaWriteConfigString(L"*");
        }
        ExitOnFailure(hr, "Failed to write mimemap extension");

        hr = ScaWriteConfigString(psmm->wzMimeType);
        ExitOnFailure(hr, "Failed to write mimemap type");

        psmm = psmm->psmmNext;
    }

    hr = ScaWriteConfigID(IIS_MIMEMAP_END);
    ExitOnFailure(hr, "Failed to write mimemap end id");

LExit:
    return hr;
}


//static HRESULT AddMimeMapToList(SCA_MIMEMAP** ppsmmList)
//{
//    HRESULT hr = S_OK;
//
//    SCA_MIMEMAP* psmm = static_cast<SCA_MIMEMAP*>(MemAlloc(sizeof(SCA_MIMEMAP), TRUE));
//    ExitOnNull(psmm, hr, E_OUTOFMEMORY, "failed to allocate memory for new mime map list element");
//
//    psmm->psmmNext = *ppsmmList;
//    *ppsmmList = psmm;
//
//LExit:
//    return hr;
//}