| 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 | // prototypes |
| 6 | HRESULT ScaWriteMimeMap7( |
| 7 | __in_z LPCWSTR wzWebName, |
| 8 | __in_z LPCWSTR wzRootOfWeb, |
| 9 | SCA_MIMEMAP* psmmList |
| 10 | ) |
| 11 | { |
| 12 | HRESULT hr = S_OK; |
| 13 | SCA_MIMEMAP* psmm; |
| 14 | |
| 15 | //create the mimemap list for this vdir application |
| 16 | //all go to same web/root location tag |
| 17 | hr = ScaWriteConfigID(IIS_MIMEMAP_BEGIN); |
| 18 | ExitOnFailure(hr, "Failed to write mimemap begin id"); |
| 19 | hr = ScaWriteConfigString(wzWebName); //site name key |
| 20 | ExitOnFailure(hr, "Failed to write mimemap web key"); |
| 21 | hr = ScaWriteConfigString(wzRootOfWeb); //app path key |
| 22 | ExitOnFailure(hr, "Failed to write mimemap app key"); |
| 23 | |
| 24 | psmm = psmmList; |
| 25 | |
| 26 | while (psmm) |
| 27 | { |
| 28 | //create the Extension for this vdir application |
| 29 | hr = ScaWriteConfigID(IIS_MIMEMAP); |
| 30 | ExitOnFailure(hr, "Failed to write mimemap id"); |
| 31 | |
| 32 | if (*psmm->wzExtension) |
| 33 | { |
| 34 | hr = ScaWriteConfigString(psmm->wzExtension); |
| 35 | } |
| 36 | else // blank means "*" (all) |
| 37 | { |
| 38 | hr = ScaWriteConfigString(L"*"); |
| 39 | } |
| 40 | ExitOnFailure(hr, "Failed to write mimemap extension"); |
| 41 | |
| 42 | hr = ScaWriteConfigString(psmm->wzMimeType); |
| 43 | ExitOnFailure(hr, "Failed to write mimemap type"); |
| 44 | |
| 45 | psmm = psmm->psmmNext; |
| 46 | } |
| 47 | |
| 48 | hr = ScaWriteConfigID(IIS_MIMEMAP_END); |
| 49 | ExitOnFailure(hr, "Failed to write mimemap end id"); |
| 50 | |
| 51 | LExit: |
| 52 | return hr; |
| 53 | } |
| 54 | |
| 55 | |
| 56 | //static HRESULT AddMimeMapToList(SCA_MIMEMAP** ppsmmList) |
| 57 | //{ |
| 58 | // HRESULT hr = S_OK; |
| 59 | // |
| 60 | // SCA_MIMEMAP* psmm = static_cast<SCA_MIMEMAP*>(MemAlloc(sizeof(SCA_MIMEMAP), TRUE)); |
| 61 | // ExitOnNull(psmm, hr, E_OUTOFMEMORY, "failed to allocate memory for new mime map list element"); |
| 62 | // |
| 63 | // psmm->psmmNext = *ppsmmList; |
| 64 | // *ppsmmList = psmm; |
| 65 | // |
| 66 | //LExit: |
| 67 | // return hr; |
| 68 | //} |