fix(runtime): suppress CRT assert dialogs

This commit is contained in:
Jacobwasbeast
2026-03-10 21:37:20 -05:00
parent 4a48472b99
commit ce1397b532

View File

@@ -1,5 +1,6 @@
#include <Windows.h>
#include <bcrypt.h>
#include <crtdbg.h>
#include <cstdio>
#include <fstream>
#include <iomanip>
@@ -17,6 +18,11 @@
static HMODULE g_hModule = nullptr;
static int __cdecl SuppressCrtAssert(int, char*, int*)
{
return 1;
}
static std::string GetDllDirectory(HMODULE hModule)
{
char path[MAX_PATH] = {0};
@@ -296,6 +302,8 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserv
std::string baseDir = GetDllDirectory(hModule);
LogUtil::SetBaseDir(baseDir.c_str());
CrashHandler::Install(hModule);
_CrtSetReportMode(_CRT_ASSERT, 0);
_CrtSetReportHook(SuppressCrtAssert);
}
CreateThread(nullptr, 0, InitThread, nullptr, 0, nullptr);