Skip to content

Commit

Permalink
修复 android8.0闪退
Browse files Browse the repository at this point in the history
  • Loading branch information
WrBug committed Jan 7, 2019
1 parent bcaf5d9 commit 1b394cd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 20 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Android Studio 3.0

### 支持设备

大多数xposed环境的手机,暂不支持模拟器,(android8.0手机dump 64位应用会闪退,实际上已经dump成功)
大多数xposed环境的手机,暂不支持模拟器

### 分支

Expand Down
35 changes: 16 additions & 19 deletions app/src/main/cpp/util/deviceutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,13 @@ static void *new_arm64_open_common(uint8_t *base, size_t size, void *location,
void *error_meessage, void *verify_result) {
if (size < DEX_MIN_LEN) {
__android_log_print(ANDROID_LOG_ERROR, TAG, "size =%u", size);
return nullptr;
} else {
save_dex_file(base, size);
}
save_dex_file(base, size);
void *result = old_arm64_open_common(base, size, location, location_checksum,
oat_dex_file, verify, verify_checksum,
error_meessage,
verify_result);
oat_dex_file, verify, verify_checksum,
error_meessage,
verify_result);
return result;
}
/////////////////////
Expand All @@ -89,21 +89,20 @@ static void *new_arm64_open_common(uint8_t *base, size_t size, void *location,

/////////////////////
static void *(*old_arm64_open_memory)(uint8_t *base,
size_t size, void *location,
uint32_t location_checksum,
void *mem_map,
void *oat_dex_file, void *error_msg);
size_t size, void *location,
uint32_t location_checksum,
void *mem_map,
void *oat_dex_file, void *error_msg);

static void *
(new_arm64_open_memory)(uint8_t *base, size_t size, void *location,
uint32_t location_checksum, void *mem_map,
void *oat_dex_file, void *error_msg) {
if (size < DEX_MIN_LEN) {
return nullptr;
if (size > DEX_MIN_LEN) {
save_dex_file(base, size);
}
save_dex_file(base, size);
return (*old_arm64_open_memory)(base, size, location, location_checksum, mem_map,
oat_dex_file, error_msg);
oat_dex_file, error_msg);
}
/////////////////////

Expand All @@ -120,10 +119,9 @@ static void *
(new_nougat_open_memory)(void *DexFile_thiz, uint8_t *base, size_t size, void *location,
uint32_t location_checksum, void *mem_map,
void *oat_dex_file, void *error_msg) {
if (size < DEX_MIN_LEN) {
return nullptr;
if (size > DEX_MIN_LEN) {
save_dex_file(base, size);
}
save_dex_file(base, size);
return (*old_nougat_open_memory)(DexFile_thiz, base, size, location, location_checksum, mem_map,
oat_dex_file, error_msg);
}
Expand All @@ -140,10 +138,9 @@ static void *new_opencommon(void *DexFile_thiz, uint8_t *base, size_t size, void
uint32_t location_checksum, void *oat_dex_file, bool verify,
bool verify_checksum,
void *error_meessage, void *verify_result) {
if (size < DEX_MIN_LEN) {
return nullptr;
if (size > DEX_MIN_LEN) {
save_dex_file(base, size);
}
save_dex_file(base, size);
return (*old_opencommon)(DexFile_thiz, base, size, location, location_checksum,
oat_dex_file, verify, verify_checksum, error_meessage,
verify_result);
Expand Down

0 comments on commit 1b394cd

Please sign in to comment.