1 /* radare - LGPL - Copyright 2009-2010 nibble<.ds@gmail.com> */ 2 3 #include <r_types.h> 4 #include "mach0_specs.h" 5 6 #ifndef _INCLUDE_R_BIN_DYLDCACHE_H_ 7 #define _INCLUDE_R_BIN_DYLDCACHE_H_ 8 9 struct r_bin_dyldcache_obj_t { 10 const char *file; 11 int size; 12 int nlibs; 13 struct cache_header hdr; 14 RBuffer* b; 15 }; 16 17 struct r_bin_dyldcache_lib_t { 18 char path[1024]; 19 int size; 20 ut64 offset; 21 RBuffer *b; 22 int last; 23 }; 24 25 26 struct dyld_cache_mapping_info { 27 ut64 address; 28 ut64 size; 29 ut64 fileOffset; 30 ut32 maxProt; 31 ut32 initProt; 32 }; 33 34 struct dyld_cache_image_info { 35 ut64 address; 36 ut64 modTime; 37 ut64 inode; 38 ut32 pathFileOffset; 39 ut32 pad; 40 }; 41 42 struct dyld_cache_slide_info { 43 ut32 version; 44 ut32 toc_offset; 45 ut32 toc_count; 46 ut32 entries_offset; 47 ut32 entries_count; 48 ut32 entries_size; 49 }; 50 51 typedef struct _dyld_cache_local_symbols_info { 52 ut32 nlistOffset; 53 ut32 nlistCount; 54 ut32 stringsOffset; 55 ut32 stringsSize; 56 ut32 entriesOffset; 57 ut32 entriesCount; 58 } dyld_cache_local_symbols_info; 59 60 typedef struct _dyld_cache_local_symbols_entry { 61 ut32 dylibOffset; 62 ut32 nlistStartIndex; 63 ut32 nlistCount; 64 } dyld_cache_local_symbols_entry; 65 66 struct r_bin_dyldcache_lib_t *r_bin_dyldcache_extract(struct r_bin_dyldcache_obj_t* bin, int idx, int *nlib); 67 void *r_bin_dyldcache_free(struct r_bin_dyldcache_obj_t* bin); 68 struct r_bin_dyldcache_obj_t* r_bin_dyldcache_new(const char* file); 69 struct r_bin_dyldcache_obj_t* r_bin_dyldcache_from_bytes_new (const ut8* bytes, ut64 size); 70 void r_bin_dydlcache_get_libname(struct r_bin_dyldcache_lib_t *lib, char **libname); 71 72 #endif 73