[APPHELP] Implement ShimDumpCache and ShimFlushCache
authorMark Jansen <mark.jansen@reactos.org>
Sun, 6 Jan 2019 16:51:55 +0000 (17:51 +0100)
committerMark Jansen <mark.jansen@reactos.org>
Mon, 25 Feb 2019 19:00:34 +0000 (20:00 +0100)
These functions simply call into the Base* functions,
having a prototype that is compatible with rundll32
CORE-11301

dll/appcompat/apphelp/apphelp.c
dll/appcompat/apphelp/apphelp.spec
dll/win32/kernel32/client/appcache.c
ntoskrnl/ps/apphelp.c

index 1e1a65b..ceb71a8 100644 (file)
@@ -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();
+}
index 8373580..af6582f 100644 (file)
 @ 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)
index 302984a..81ffaef 100644 (file)
@@ -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);
 }
 
 /*
index 7692c7a..7d9516e 100644 (file)
@@ -764,6 +764,7 @@ NtApphelpCacheControl(
             }
             break;
         case ApphelpCacheServiceFlush:
+            /* FIXME: Check for admin or system here. */
             Status = ApphelpCacheFlush();
             break;
         case ApphelpCacheServiceDump: