From 95a5a8f9efef02ddcec5b3f69be99a00d71a802a Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Sun, 16 Dec 2018 21:19:24 -0600 Subject: Import implementation of IisCA from old repo's scasched/scaexec. --- src/ca/scamimemap7.cpp | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 src/ca/scamimemap7.cpp (limited to 'src/ca/scamimemap7.cpp') diff --git a/src/ca/scamimemap7.cpp b/src/ca/scamimemap7.cpp new file mode 100644 index 00000000..f6689720 --- /dev/null +++ b/src/ca/scamimemap7.cpp @@ -0,0 +1,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(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; +//} -- cgit v1.2.3-55-g6feb