https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5c7ce469bb5abbd5c7fd2e0a5648ca78580618e1

commit 5c7ce469bb5abbd5c7fd2e0a5648ca78580618e1
Author:     Mark Jansen <mark.jan...@reactos.org>
AuthorDate: Sat Jan 27 17:41:58 2018 +0100
Commit:     Mark Jansen <mark.jan...@reactos.org>
CommitDate: Mon Jan 29 22:05:17 2018 +0100

    [ACPPAGE] Hide shims handled by the main ui.
---
 dll/shellext/acppage/CLayerStringList.hpp | 28 ++++++++++++++--------------
 dll/shellext/acppage/CLayerUIPropPage.cpp | 22 ++++++++++++++++++++++
 dll/shellext/acppage/precomp.h            |  2 ++
 3 files changed, 38 insertions(+), 14 deletions(-)

diff --git a/dll/shellext/acppage/CLayerStringList.hpp 
b/dll/shellext/acppage/CLayerStringList.hpp
index 204ec40f52..af8c04fe95 100644
--- a/dll/shellext/acppage/CLayerStringList.hpp
+++ b/dll/shellext/acppage/CLayerStringList.hpp
@@ -36,24 +36,24 @@ public:
         while (celt && m_layer)
         {
             TAGID nameid = SdbFindFirstTag(m_db, m_layer, TAG_NAME);
-            if (!nameid)
-                return S_FALSE;
-
-            LPWSTR name = SdbGetStringTagPtr(m_db, nameid);
-            if (!name)
-                return S_FALSE;
-
-            ULONG Size = wcslen(name) + 1;
+            if (nameid)
+            {
+                LPWSTR name = SdbGetStringTagPtr(m_db, nameid);
+                if (name && !IsBuiltinLayer(name))
+                {
+                    ULONG Size = wcslen(name) + 1;
 
-            *rgelt = (LPOLESTR)::CoTaskMemAlloc(Size * sizeof(WCHAR));
-            StringCchCopyW(*rgelt, Size, name);
+                    *rgelt = (LPOLESTR)::CoTaskMemAlloc(Size * sizeof(WCHAR));
+                    StringCchCopyW(*rgelt, Size, name);
 
-            if (pceltFetched)
-                (*pceltFetched)++;
+                    if (pceltFetched)
+                        (*pceltFetched)++;
 
+                    celt--;
+                    rgelt++;
+                }
+            }
             m_layer = SdbFindNextTag(m_db, m_root, m_layer);
-            celt--;
-            rgelt++;
         }
         return celt ? S_FALSE : S_OK;
     }
diff --git a/dll/shellext/acppage/CLayerUIPropPage.cpp 
b/dll/shellext/acppage/CLayerUIPropPage.cpp
index 116c8621b0..bbd4c3d837 100644
--- a/dll/shellext/acppage/CLayerUIPropPage.cpp
+++ b/dll/shellext/acppage/CLayerUIPropPage.cpp
@@ -67,6 +67,28 @@ static const WCHAR* g_AllowedExtensions[] = {
     0
 };
 
+BOOL IsBuiltinLayer(PCWSTR Name)
+{
+    size_t n;
+
+    for (n = 0; g_Layers[n].Name; ++n)
+    {
+        if (!wcsicmp(g_Layers[n].Name, Name))
+        {
+            return TRUE;
+        }
+    }
+
+    for (n = 0; g_CompatModes[n].Name; ++n)
+    {
+        if (!wcsicmp(g_CompatModes[n].Name, Name))
+        {
+            return TRUE;
+        }
+    }
+    return FALSE;
+}
+
 
 void ACDBG_FN(PCSTR FunctionName, PCWSTR Format, ...)
 {
diff --git a/dll/shellext/acppage/precomp.h b/dll/shellext/acppage/precomp.h
index 21dd0c159c..5fd81bda48 100644
--- a/dll/shellext/acppage/precomp.h
+++ b/dll/shellext/acppage/precomp.h
@@ -28,6 +28,8 @@ extern LONG g_ModuleRefCnt;
 
 EXTERN_C BOOL WINAPI GetExeFromLnk(PCWSTR pszLnk, PWSTR pszExe, size_t 
cchSize);
 
+BOOL IsBuiltinLayer(PCWSTR Name);
+
 #include "resource.h"
 #include "CLayerStringList.hpp"
 #include "CLayerUIPropPage.hpp"

Reply via email to