Index: /trunk/src/VBox/HostDrivers/Support/win/SUPR3HardenedMain-win.cpp
===================================================================
--- /trunk/src/VBox/HostDrivers/Support/win/SUPR3HardenedMain-win.cpp	(revision 52527)
+++ /trunk/src/VBox/HostDrivers/Support/win/SUPR3HardenedMain-win.cpp	(revision 52528)
@@ -137,4 +137,6 @@
     /** The verification result. */
     int                     rc;
+    /** Used for shutting up errors after a while. */
+    uint32_t volatile       cErrorHits;
     /** The validation flags (for WinVerifyTrust retry). */
     uint32_t                fFlags;
@@ -231,5 +233,6 @@
 *******************************************************************************/
 static NTSTATUS supR3HardenedScreenImage(HANDLE hFile, bool fImage, PULONG pfAccess, PULONG pfProtect,
-                                         bool *pfCallRealApi, const char *pszCaller, bool fAvoidWinVerifyTrust);
+                                         bool *pfCallRealApi, const char *pszCaller, bool fAvoidWinVerifyTrust,
+                                         bool *pfQuietFailure);
 
 #ifdef RT_ARCH_AMD64
@@ -514,7 +517,8 @@
         pEntry->pNextTodoWvt    = NULL;
         pEntry->hFile           = hFile;
+        pEntry->uHash           = supR3HardenedWinVerifyCacheHashPath(pUniStr);
         pEntry->rc              = rc;
-        pEntry->uHash           = supR3HardenedWinVerifyCacheHashPath(pUniStr);
         pEntry->fFlags          = fFlags;
+        pEntry->cErrorHits      = 0;
         pEntry->fWinVerifyTrust = fWinVerifyTrust;
         pEntry->cbPath          = pUniStr->Length;
@@ -874,5 +878,5 @@
                     bool  fCallRealApi = false;
                     rcNt = supR3HardenedScreenImage(hFile, true /*fImage*/, &fAccess, &fProtect, &fCallRealApi,
-                                                    "Imports", false /*fAvoidWinVerifyTrust*/);
+                                                    "Imports", false /*fAvoidWinVerifyTrust*/, NULL /*pfQuietFailure*/);
                     NtClose(hFile);
                 }
@@ -1097,7 +1101,10 @@
 
 static NTSTATUS supR3HardenedScreenImage(HANDLE hFile, bool fImage, PULONG pfAccess, PULONG pfProtect,
-                                         bool *pfCallRealApi, const char *pszCaller, bool fAvoidWinVerifyTrust)
+                                         bool *pfCallRealApi, const char *pszCaller, bool fAvoidWinVerifyTrust,
+                                         bool *pfQuietFailure)
 {
     *pfCallRealApi = false;
+    if (pfQuietFailure)
+        *pfQuietFailure = false;
 
     /*
@@ -1161,5 +1168,5 @@
                              pszCaller, pCacheHit->rc, pCacheHit->wszPath));
         }
-        else
+        else if (pCacheHit->cErrorHits < 16)
             SUP_DPRINTF(("supR3HardenedScreenImage/%s: cache hit (%Rrc) on %ls%s\n",
                          pszCaller, pCacheHit->rc, pCacheHit->wszPath, pCacheHit->fWinVerifyTrust ? "" : " [lacks WinVerifyTrust]"));
@@ -1171,7 +1178,14 @@
             return STATUS_SUCCESS;
         }
-        supR3HardenedError(VINF_SUCCESS, false,
-                           "supR3HardenedScreenImage/%s: cached rc=%Rrc fImage=%d fProtect=%#x fAccess=%#x %ls\n",
-                           pszCaller, pCacheHit->rc, fImage, *pfProtect, *pfAccess, uBuf.UniStr.Buffer);
+
+        uint32_t cErrorHits = ASMAtomicIncU32(&pCacheHit->cErrorHits);
+        if (   cErrorHits < 8
+            || RT_IS_POWER_OF_TWO(cErrorHits))
+            supR3HardenedError(VINF_SUCCESS, false,
+                               "supR3HardenedScreenImage/%s: cached rc=%Rrc fImage=%d fProtect=%#x fAccess=%#x cErrorHits=%u %ls\n",
+                               pszCaller, pCacheHit->rc, fImage, *pfProtect, *pfAccess, cErrorHits, uBuf.UniStr.Buffer);
+        else if (pfQuietFailure)
+            *pfQuietFailure = true;
+
         return STATUS_TRUST_FAILURE;
     }
@@ -1421,5 +1435,6 @@
     bool  fCallRealApi;
     //SUP_DPRINTF(("supR3HardenedWinVerifyCachePreload: scanning %ls\n", pwszName));
-    supR3HardenedScreenImage(hFile, false, &fAccess, &fProtect, &fCallRealApi, "preload", false /*fAvoidWinVerifyTrust*/);
+    supR3HardenedScreenImage(hFile, false, &fAccess, &fProtect, &fCallRealApi, "preload", false /*fAvoidWinVerifyTrust*/,
+                             NULL /*pfQuietFailure*/);
     //SUP_DPRINTF(("supR3HardenedWinVerifyCachePreload: done %ls\n", pwszName));
 
@@ -1459,5 +1474,5 @@
             //SUP_DPRINTF(("supR3HardenedMonitor_NtCreateSection: 1\n"));
             NTSTATUS rcNt = supR3HardenedScreenImage(hFile, fImage, &fAccess, &fProtect, &fCallRealApi,
-                                                     "NtCreateSection", true /*fAvoidWinVerifyTrust*/);
+                                                     "NtCreateSection", true /*fAvoidWinVerifyTrust*/, NULL /*pfQuietFailure*/);
             //SUP_DPRINTF(("supR3HardenedMonitor_NtCreateSection: 2 rcNt=%#x fCallRealApi=%#x\n", rcNt, fCallRealApi));
 
@@ -1653,11 +1668,16 @@
             ULONG fProtect = 0;
             bool  fCallRealApi = false;
+            bool  fQuietFailure = false;
             rcNt = supR3HardenedScreenImage(hFile, true /*fImage*/, &fAccess, &fProtect, &fCallRealApi,
-                                            "LdrLoadDll", false /*fAvoidWinVerifyTrust*/);
+                                            "LdrLoadDll", false /*fAvoidWinVerifyTrust*/, &fQuietFailure);
             NtClose(hFile);
             if (!NT_SUCCESS(rcNt))
             {
-                supR3HardenedError(VINF_SUCCESS, false, "supR3HardenedMonitor_LdrLoadDll: rejecting '%ls': rcNt=%#x\n", wszPath, rcNt);
-                SUP_DPRINTF(("supR3HardenedMonitor_LdrLoadDll: returns rcNt=%#x '%ls'\n", rcNt, wszPath));
+                if (!fQuietFailure)
+                {
+                    supR3HardenedError(VINF_SUCCESS, false, "supR3HardenedMonitor_LdrLoadDll: rejecting '%ls': rcNt=%#x\n",
+                                       wszPath, rcNt);
+                    SUP_DPRINTF(("supR3HardenedMonitor_LdrLoadDll: returns rcNt=%#x '%ls'\n", rcNt, wszPath));
+                }
                 return rcNt;
             }
