[ACPPAGE] Do not allow shims to be applied to files in System32/WinSxs.
authorMark Jansen <mark.jansen@reactos.org>
Tue, 15 Aug 2017 12:37:25 +0000 (12:37 +0000)
committerMark Jansen <mark.jansen@reactos.org>
Tue, 15 Aug 2017 12:37:25 +0000 (12:37 +0000)
CORE-13618

svn path=/trunk/; revision=75552

reactos/dll/shellext/acppage/CLayerUIPropPage.cpp

index 12bd72c..66a0123 100644 (file)
@@ -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))