From 5fa8720c9bf312a3254efbb814c8079656afad6e Mon Sep 17 00:00:00 2001 From: Jamie Reece Wilson Date: Sat, 24 Jun 2023 20:59:57 +0100 Subject: [PATCH] [-] Win32: Unlink Wer.lib. Write to the registry instead. --- Aurora.json | 1 - Source/Debug/ExceptionWatcher.Win32.cpp | 25 ++++++++++++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/Aurora.json b/Aurora.json index 1a5b6f0e..bb02754a 100644 --- a/Aurora.json +++ b/Aurora.json @@ -62,7 +62,6 @@ "Dbghelp.lib", "ws2_32.lib", "Ntdll.lib", - "Wer.lib", "wintrust.lib", "Winmm.lib", "Iphlpapi.lib" diff --git a/Source/Debug/ExceptionWatcher.Win32.cpp b/Source/Debug/ExceptionWatcher.Win32.cpp index 7de83747..e4a9b869 100644 --- a/Source/Debug/ExceptionWatcher.Win32.cpp +++ b/Source/Debug/ExceptionWatcher.Win32.cpp @@ -27,7 +27,9 @@ #include #include -#include +#if 0 + #include +#endif static thread_local int gDebugLocked = 0; @@ -512,6 +514,7 @@ namespace Aurora::Debug static void DisableWindowsErrorReporting() { + #if 0 // Windows has this annoying watchdog that triggers when your main loop doesnt respond after a while // It's aggressive in its approach, giving the users a choice to forcefully terminate as soon as they spam click a busy app, // or never at all. latterly, its not uncommon for the app to not come back up, bc win32. @@ -527,6 +530,26 @@ namespace Aurora::Debug // This isn't what we want, but it's probably what the user wants // MSFT is such a loving company, they'll do almost nothing to ensure they wont steal all your data WerAddExcludedApplication(AuLocale::ConvertFromUTF8(procName).c_str(), false); + #else + + // This implementation doesn't require a single IAT entry to a pointless dll + AuString procName; + if (!Process::GetProcName(procName)) + { + return; + } + + auto procNameWide = AuLocale::ConvertFromUTF8(procName); + + HKEY hKey; + if (::RegOpenKeyExW(HKEY_CURRENT_USER, L"SOFTWARE\\Microsoft\\Windows\\Windows Error Reporting\\ExcludedApplications", 0, KEY_WRITE, &hKey) == ERROR_SUCCESS) + { + DWORD bioluminescenceReductionFactor { 1 }; + (void)::RegSetValueExW(hKey, procNameWide.c_str(), 0, REG_DWORD, (const BYTE *)&bioluminescenceReductionFactor, sizeof(DWORD)); + ::RegCloseKey(hKey); + } + + #endif } void InitWin32()