|
|
@ -64,9 +64,10 @@ void DexDump::dumpDex(JNIEnv *env, jlong cookie, jstring dir) { |
|
|
|
auto dirC = env->GetStringUTFChars(dir, 0); |
|
|
|
auto dirC = env->GetStringUTFChars(dir, 0); |
|
|
|
|
|
|
|
|
|
|
|
auto dexSizeOffset = ((unsigned long ) begin) + 0x20; |
|
|
|
auto dexSizeOffset = ((unsigned long ) begin) + 0x20; |
|
|
|
size_t size = *(size_t *) dexSizeOffset; |
|
|
|
int size = *(size_t *) dexSizeOffset; |
|
|
|
|
|
|
|
|
|
|
|
auto buffer = malloc(size); |
|
|
|
auto buffer = malloc(size); |
|
|
|
|
|
|
|
if (buffer) { |
|
|
|
memcpy(buffer, reinterpret_cast<const void *>(begin), size); |
|
|
|
memcpy(buffer, reinterpret_cast<const void *>(begin), size); |
|
|
|
// fix magic
|
|
|
|
// fix magic
|
|
|
|
memcpy(buffer, magic, sizeof(magic)); |
|
|
|
memcpy(buffer, magic, sizeof(magic)); |
|
|
@ -84,4 +85,5 @@ void DexDump::dumpDex(JNIEnv *env, jlong cookie, jstring dir) { |
|
|
|
close(fd); |
|
|
|
close(fd); |
|
|
|
free(buffer); |
|
|
|
free(buffer); |
|
|
|
env->ReleaseStringUTFChars(dir, dirC); |
|
|
|
env->ReleaseStringUTFChars(dir, dirC); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|