mirror of
https://github.com/xiaozhou233/JuiceAgent.git
synced 2026-12-05 13:05:53 +08:00
BugFix and Update: C++ 20
This commit is contained in:
1 parent
ad69f9d11a
commit
9aa77848d7
4 files changed
+30
-2
No files matched your search
@@ -14,5 +14,32 @@ void JNICALL ClassFileLoadHook(
|
||||
unsigned char** new_classbytes) {
|
||||
// Delete this log when the hook is stable, or it will cause performance issues
|
||||
std::cout << "ClassFileLoadHook: " << name << std::endl;
|
||||
if (!name) {
|
||||
PLOGW << "name is null";
|
||||
return;
|
||||
}
|
||||
|
||||
/* =========================
|
||||
* 1. Capture original bytes
|
||||
* ========================= */
|
||||
std::lock_guard<std::mutex> lock(classDataMutex);
|
||||
if (classToCapture.contains(name)) {
|
||||
if (!classFileDataMap.contains(name)) {
|
||||
ClassFileData data;
|
||||
|
||||
data.className = name;
|
||||
data.bytecode.assign(classbytes, classbytes + class_data_len);
|
||||
// Experimental: class/classloader/protection_domain references (to be used in future features, e.g. dynamic patching)
|
||||
data.clazz = class_being_redefined;
|
||||
data.classloader = loader;
|
||||
data.protection_domain = protection_domain;
|
||||
|
||||
|
||||
classFileDataMap[name] = std::move(data);
|
||||
|
||||
classToCapture.erase(name);
|
||||
|
||||
PLOGI << "Captured class: " << name << " (length: " << class_data_len << ")";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user