mirror of
https://github.com/xiaozhou233/JuiceAgent.git
synced 2026-12-05 21:15:56 +08:00
Fix: avoid running agent/loader logic on plain System.load
This commit is contained in:
1 parent
c5acf2aba0
commit
092110672a
6 files changed
+22
-9
No files matched your search
@@ -3,13 +3,19 @@
|
||||
#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");
|
||||
|
||||
// lpReserved carries the runtime directory from the reflective loader
|
||||
const char* runtime_dir = (const char*)lpReserved;
|
||||
spdlog::info("DllMain: DLL_PROCESS_ATTACH, runtime_dir: {}", runtime_dir);
|
||||
|
||||
@@ -18,7 +24,9 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved) {
|
||||
}
|
||||
|
||||
case DLL_PROCESS_DETACH: {
|
||||
spdlog::info("DllMain: DLL_PROCESS_DETACH");
|
||||
if (g_loaded_via_injection) {
|
||||
spdlog::info("DllMain: DLL_PROCESS_DETACH");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user