mirror of
https://github.com/xiaozhou233/JuiceAgent.git
synced 2026-12-05 13:05:53 +08:00
Impl: Inject JuiceLoaderAPI
This commit is contained in:
1 parent
e5ac60d476
commit
c5817a3b06
1 file changed
+10
@@ -6,6 +6,8 @@
|
||||
namespace libloader
|
||||
{
|
||||
void entrypoint(const char* runtime_dir) {
|
||||
|
||||
// Load Config
|
||||
config::Config cfg(runtime_dir);
|
||||
if (!cfg.is_valid()) {
|
||||
PLOGE << "Invalid config";
|
||||
@@ -14,11 +16,19 @@ namespace libloader
|
||||
InjectionInfo info = cfg.get_injection_info();
|
||||
config::print_injection_info(info);
|
||||
|
||||
// Attach to JVM
|
||||
jvm::Jvm jvm;
|
||||
|
||||
if (!jvm.attach()) {
|
||||
PLOGE << "Attach failed";
|
||||
return;
|
||||
}
|
||||
|
||||
// Inject JuiceLoaderAPI.jar
|
||||
jint status = jvm.get_jvmti()->AddToSystemClassLoaderSearch(info.JuiceAgentAPIJarPath.c_str());
|
||||
if (status != JNI_OK) {
|
||||
PLOGE << "AddToSystemClassLoaderSearch failed: " << status;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace libloader
|
||||
Reference in new issue
Block a user