From f2ce4e6a5a32b69a2daea834991226c1ff6c8eda Mon Sep 17 00:00:00 2001 From: xiaozhou233 Date: Sun, 16 Aug 2026 16:13:26 +0800 Subject: [PATCH] Fix: simplify DllMain attach logic and add pause to java-system-load test --- src/libloader/plantform/windows/DllMain.cpp | 13 ++----------- tests/java-system-load/run.bat | 1 + 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/libloader/plantform/windows/DllMain.cpp b/src/libloader/plantform/windows/DllMain.cpp index 15bb2e9..6a64530 100644 --- a/src/libloader/plantform/windows/DllMain.cpp +++ b/src/libloader/plantform/windows/DllMain.cpp @@ -3,30 +3,21 @@ #include "JuiceAgent/Logger.hpp" #include "Loader.hpp" -static bool g_loaded_via_injection = false; BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved) { switch (fdwReason) { case DLL_PROCESS_ATTACH: { - if (lpReserved == NULL) { - return TRUE; - } - - g_loaded_via_injection = true; - DisableThreadLibraryCalls(hinstDLL); Logger::init("libloader.log"); const char* runtime_dir = (const char*)lpReserved; - spdlog::info("DllMain: DLL_PROCESS_ATTACH, runtime_dir: {}", runtime_dir); + spdlog::info("DllMain: DLL_PROCESS_ATTACH, runtime_dir: {}", runtime_dir ? runtime_dir : "NULL"); JuiceAgent::Loader::entrypoint(runtime_dir); break; } case DLL_PROCESS_DETACH: { - if (g_loaded_via_injection) { - spdlog::info("DllMain: DLL_PROCESS_DETACH"); - } + spdlog::info("DllMain: DLL_PROCESS_DETACH"); break; } } diff --git a/tests/java-system-load/run.bat b/tests/java-system-load/run.bat index 7087958..ef3f095 100644 --- a/tests/java-system-load/run.bat +++ b/tests/java-system-load/run.bat @@ -8,4 +8,5 @@ if errorlevel 1 ( exit /b 1 ) +pause endlocal \ No newline at end of file