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

commit 5c05a29d3d3f7507e86879f887fe7b990f665555
Author:     Mark Jansen <[email protected]>
AuthorDate: Sun Jan 6 17:51:55 2019 +0100
Commit:     Mark Jansen <[email protected]>
CommitDate: Mon Feb 25 20:00:34 2019 +0100

    [APPHELP] Implement ShimDumpCache and ShimFlushCache
    These functions simply call into the Base* functions,
    having a prototype that is compatible with rundll32
    CORE-11301
---
 dll/appcompat/apphelp/apphelp.c      | 35 +++++++++++++++++++++++++++++++++++
 dll/appcompat/apphelp/apphelp.spec   |  4 ++--
 dll/win32/kernel32/client/appcache.c | 18 ++++++++++++------
 ntoskrnl/ps/apphelp.c                |  1 +
 4 files changed, 50 insertions(+), 8 deletions(-)

diff --git a/dll/appcompat/apphelp/apphelp.c b/dll/appcompat/apphelp/apphelp.c
index 1e1a65b67b..ceb71a8e16 100644
--- a/dll/appcompat/apphelp/apphelp.c
+++ b/dll/appcompat/apphelp/apphelp.c
@@ -292,3 +292,38 @@ BOOL WINAPI SdbUnregisterDatabase(_In_ GUID *pguidDB)
     return FALSE;
 }
 
+
+/* kernel32.dll */
+BOOL WINAPI BaseDumpAppcompatCache(VOID);
+BOOL WINAPI BaseFlushAppcompatCache(VOID);
+
+
+/**
+ * @name ShimDumpCache
+ * Dump contents of the shim cache.
+ *
+ * @param hwnd          Unused, pass 0
+ * @param hInstance     Unused, pass 0
+ * @param lpszCmdLine   Unused, pass 0
+ * @param nCmdShow      Unused, pass 0
+ * @return 
+ */
+BOOL WINAPI ShimDumpCache(HWND hwnd, HINSTANCE hInstance, LPCSTR lpszCmdLine, 
int nCmdShow)
+{
+    return BaseDumpAppcompatCache();
+}
+
+/**
+* @name ShimFlushCache
+* Flush the shim cache. Call this after installing a new shim database
+*
+* @param hwnd          Unused, pass 0
+* @param hInstance     Unused, pass 0
+* @param lpszCmdLine   Unused, pass 0
+* @param nCmdShow      Unused, pass 0
+* @return 
+*/
+BOOL WINAPI ShimFlushCache(HWND hwnd, HINSTANCE hInstance, LPCSTR lpszCmdLine, 
int nCmdShow)
+{
+    return BaseFlushAppcompatCache();
+}
diff --git a/dll/appcompat/apphelp/apphelp.spec 
b/dll/appcompat/apphelp/apphelp.spec
index 83735803f6..af6582f90c 100644
--- a/dll/appcompat/apphelp/apphelp.spec
+++ b/dll/appcompat/apphelp/apphelp.spec
@@ -173,7 +173,7 @@
 @ stub SE_LdrEntryRemoved
 @ stub SetPermLayers
 @ cdecl ShimDbgPrint(long str str)
-@ stub ShimDumpCache
-@ stub ShimFlushCache
+@ stdcall ShimDumpCache(ptr ptr wstr long)
+@ stdcall ShimFlushCache(ptr ptr wstr long)
 @ stdcall SetPermLayerState(wstr wstr long long long)
 @ stdcall SdbRegisterDatabaseEx(wstr long ptr)
diff --git a/dll/win32/kernel32/client/appcache.c 
b/dll/win32/kernel32/client/appcache.c
index 302984ae99..81ffaefc3b 100644
--- a/dll/win32/kernel32/client/appcache.c
+++ b/dll/win32/kernel32/client/appcache.c
@@ -309,23 +309,29 @@ BasepCheckBadapp(IN HANDLE FileHandle,
 }
 
 /*
- * @unimplemented
+ * @implemented
  */
-VOID
+BOOL
 WINAPI
 BaseDumpAppcompatCache(VOID)
 {
-    STUB;
+    NTSTATUS Status;
+
+    Status = NtApphelpCacheControl(ApphelpCacheServiceDump, NULL);
+    return NT_SUCCESS(Status);
 }
 
 /*
- * @unimplemented
+ * @implemented
  */
-VOID
+BOOL
 WINAPI
 BaseFlushAppcompatCache(VOID)
 {
-    STUB;
+    NTSTATUS Status;
+
+    Status = NtApphelpCacheControl(ApphelpCacheServiceFlush, NULL);
+    return NT_SUCCESS(Status);
 }
 
 /*
diff --git a/ntoskrnl/ps/apphelp.c b/ntoskrnl/ps/apphelp.c
index 7692c7ab2e..7d9516e22b 100644
--- a/ntoskrnl/ps/apphelp.c
+++ b/ntoskrnl/ps/apphelp.c
@@ -764,6 +764,7 @@ NtApphelpCacheControl(
             }
             break;
         case ApphelpCacheServiceFlush:
+            /* FIXME: Check for admin or system here. */
             Status = ApphelpCacheFlush();
             break;
         case ApphelpCacheServiceDump:

Reply via email to