mirror of
https://github.com/xiaozhou233/JuiceAgent.git
synced 2026-12-05 13:05:53 +08:00
Impl: retransform
This commit is contained in:
1 parent
5e7972779f
commit
f73265ac3e
5 files changed
+185
-1
No files matched your search
@@ -42,4 +42,23 @@ void JNICALL ClassFileLoadHook(
|
||||
PLOGI << "Captured class: " << name << " (length: " << class_data_len << ")";
|
||||
}
|
||||
}
|
||||
|
||||
/* =========================
|
||||
* 2. Apply patches
|
||||
* ========================= */
|
||||
if (pendingRetransform.contains(name)) {
|
||||
auto& bytes = pendingRetransform[name];
|
||||
|
||||
unsigned char* new_buf = nullptr;
|
||||
jvmti_env->Allocate(bytes.size(), &new_buf);
|
||||
|
||||
memcpy(new_buf, bytes.data(), bytes.size());
|
||||
|
||||
*new_class_data_len = (jint)bytes.size();
|
||||
*new_classbytes = new_buf;
|
||||
|
||||
pendingRetransform.erase(name);
|
||||
|
||||
PLOGI << "Retransformed: " << name << " (new length: " << bytes.size() << ")";
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user