From a5b5ed5bd39fca3f46de4a85b3876778424fd689 Mon Sep 17 00:00:00 2001 From: Mark Jansen Date: Tue, 15 Aug 2017 12:37:25 +0000 Subject: [PATCH] [ACPPAGE] Do not allow shims to be applied to files in System32/WinSxs. CORE-13618 svn path=/trunk/; revision=75552 --- .../dll/shellext/acppage/CLayerUIPropPage.cpp | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/reactos/dll/shellext/acppage/CLayerUIPropPage.cpp b/reactos/dll/shellext/acppage/CLayerUIPropPage.cpp index 12bd72ce7f8..66a01237dc4 100644 --- a/reactos/dll/shellext/acppage/CLayerUIPropPage.cpp +++ b/reactos/dll/shellext/acppage/CLayerUIPropPage.cpp @@ -158,6 +158,27 @@ HRESULT CLayerUIPropPage::InitFile(PCWSTR Filename) } return InitFile(Buffer); } + + CString tmp; + if (tmp.GetEnvironmentVariable(L"SystemRoot")) + { + tmp += L"\\System32"; + if (ExpandedFilename.GetLength() >= tmp.GetLength() && + ExpandedFilename.Left(tmp.GetLength()).MakeLower() == tmp.MakeLower()) + { + ACDBG(L"Ignoring System32: %s\r\n", (PCWSTR)ExpandedFilename); + return E_FAIL; + } + tmp.GetEnvironmentVariable(L"SystemRoot"); + tmp += L"\\WinSxs"; + if (ExpandedFilename.GetLength() >= tmp.GetLength() && + ExpandedFilename.Left(tmp.GetLength()).MakeLower() == tmp.MakeLower()) + { + ACDBG(L"Ignoring WinSxs: %s\r\n", (PCWSTR)ExpandedFilename); + return E_FAIL; + } + } + for (size_t n = 0; g_AllowedExtensions[n]; ++n) { if (!wcsicmp(g_AllowedExtensions[n], pwszExt))