MCPcopy Create free account
hub / github.com/WrBug/dumpDex / save_dex_file

Function save_dex_file

app/src/main/cpp/util/fileutils.cpp:20–42  ·  view source on GitHub ↗

保存dex文件

Source from the content-addressed store, hash-verified

18
19//保存dex文件
20void save_dex_file(u_int8_t *data, size_t length) {
21 char dname[1024];
22 get_file_name(dname, sizeof(dname), length);
23 void *p = fopen(dname, "r");
24 if (p != NULL) {
25 __android_log_print(ANDROID_LOG_INFO, TAG, "%s file exist", dname);
26 return;
27 }
28 __android_log_print(ANDROID_LOG_INFO, TAG, "dump dex file name is : %s", dname);
29 __android_log_print(ANDROID_LOG_INFO, TAG, "start dump");
30 int dex = open(dname, O_CREAT | O_WRONLY, 0644);
31 if (dex < 0) {
32 __android_log_print(ANDROID_LOG_ERROR, TAG, "open or create file error");
33 return;
34 }
35 int ret = (int) write(dex, data, length);
36 if (ret < 0) {
37 __android_log_print(ANDROID_LOG_ERROR, TAG, "write file error");
38 } else {
39 __android_log_print(ANDROID_LOG_INFO, TAG, "dump dex file success `%s`", dname);
40 }
41 close(dex);
42}
43
44
45void init_package_name(char *package_name) {

Callers 4

new_arm64_open_commonFunction · 0.85
(new_arm64_open_memory)Function · 0.85
(new_nougat_open_memory)Function · 0.85
new_opencommonFunction · 0.85

Calls 1

get_file_nameFunction · 0.85

Tested by

no test coverage detected