From 488fbc0c1f6aee38a8af94f765e15faa47c55abd Mon Sep 17 00:00:00 2001 From: Maschell Date: Sun, 28 Apr 2024 18:15:02 +0200 Subject: [PATCH] Only check heap in debug mode --- wumsloader/src/utils/hooks.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/wumsloader/src/utils/hooks.cpp b/wumsloader/src/utils/hooks.cpp index c51f088..faa632c 100644 --- a/wumsloader/src/utils/hooks.cpp +++ b/wumsloader/src/utils/hooks.cpp @@ -2,9 +2,11 @@ #include "globals.h" #include "module/ModuleData.h" #include "utils/logger.h" +#include #include #include +#ifdef DEBUG static const char **hook_names = (const char *[]){ "WUMS_HOOK_INIT_WUT_MALLOC", "WUMS_HOOK_FINI_WUT_MALLOC", @@ -26,6 +28,7 @@ static const char **hook_names = (const char *[]){ "WUMS_HOOK_RELOCATIONS_DONE", "WUMS_HOOK_APPLICATION_REQUESTS_EXIT", "WUMS_HOOK_DEINIT"}; +#endif void CallHook(const std::vector> &modules, wums_hook_type_t type, bool condition) { if (condition) { @@ -46,8 +49,6 @@ void CallHook(const std::shared_ptr &module, wums_hook_type_t type, } } -extern "C" bool MEMCheckExpHeap(void *heap, bool logProblems); - void CallHook(const std::shared_ptr &module, wums_hook_type_t type) { bool foundHook = false; for (auto &curHook : module->getHookDataList()) { @@ -92,11 +93,10 @@ void CallHook(const std::shared_ptr &module, wums_hook_type_t type) break; } } - - if (foundHook && !MEMCheckExpHeap(MEMGetBaseHeapHandle(MEM_BASE_HEAP_MEM2), true)) { - DEBUG_FUNCTION_LINE_ERR("MEM2 default heap is corrupted while calling hook %s for module %s", hook_names[type], module->getExportName().c_str()); #ifdef DEBUG + if (foundHook && !MEMCheckExpHeap(MEMGetBaseHeapHandle(MEM_BASE_HEAP_MEM2), MEM_EXP_HEAP_CHECK_FLAGS_LOG_ERRORS)) { + DEBUG_FUNCTION_LINE_ERR("MEM2 default heap is corrupted while calling hook %s for module %s", hook_names[type], module->getExportName().c_str()); OSFatal("WUMSLoader: MEM2 default heap is corrupted. \n Please restart the console."); -#endif } +#endif } \ No newline at end of file