MCPcopy Create free account
hub / github.com/CodingGay/BlackDex / init

Function init

Bcore/src/main/cpp/DexDump.cpp:137–171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

135}
136
137void init(JNIEnv *env) {
138 const char *soName = ".*\\.so$";
139 xhook_register(soName, "kill", (void *) new_kill,
140 (void **) (&orig_kill));
141 xhook_register(soName, "killpg", (void *) new_killpg,
142 (void **) (&orig_killpg));
143 xhook_refresh(0);
144
145 jlongArray emptyCookie = VmCore::loadEmptyDex(env);
146 jsize arrSize = env->GetArrayLength(emptyCookie);
147 if (env->ExceptionCheck() == JNI_TRUE) {
148 return;
149 }
150 jlong *long_data = env->GetLongArrayElements(emptyCookie, nullptr);
151
152 for (int i = 0; i < arrSize; ++i) {
153 jlong cookie = long_data[i];
154 if (cookie == 0) {
155 continue;
156 }
157 auto dex = reinterpret_cast<char *>(cookie);
158 for (int ii = 0; ii < 10; ++ii) {
159 auto value = *(size_t *) (dex + ii * sizeof(size_t));
160 if (value == 1872) {
161 beginOffset = ii - 1;
162 // auto dexBegin = *(size_t *) (dex + beginOffset * sizeof(size_t));
163 // HexDump(reinterpret_cast<char *>(dexBegin), 10, 0);
164 env->ReleaseLongArrayElements(emptyCookie, long_data, 0);
165 return;
166 }
167 }
168 }
169 env->ReleaseLongArrayElements(emptyCookie, long_data, 0);
170 beginOffset = -1;
171}
172
173void fixCodeItem(JNIEnv *env, const art_lkchan::DexFile *dex_file_, size_t begin) {
174 for (size_t classdef_ctr = 0; classdef_ctr < dex_file_->NumClassDefs(); ++classdef_ctr) {

Callers 1

cookieDumpDexMethod · 0.70

Calls 2

xhook_registerFunction · 0.85
xhook_refreshFunction · 0.85

Tested by

no test coverage detected