00001 /* 00002 Copyright (C) 2010 Mark Gordon 00003 00004 This program is free software; you can redistribute it and/or modify it under 00005 the terms of the GNU General Public License as published by the Free Software 00006 Foundation; either version 2 of the License, or (at your option) any later 00007 version. 00008 00009 This program is distributed in the hope that it will be useful, but WITHOUT ANY 00010 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 00011 PARTICULAR PURPOSE. See the GNU General Public License for more details. 00012 00013 You should have received a copy of the GNU General Public License along with 00014 this program; if not, write to the Free Software Foundation, Inc., 59 Temple 00015 Place, Suite 330, Boston, MA 02111-1307 USA 00016 */ 00019 #ifndef __DXCUT_FILE_H 00020 #define __DXCUT_FILE_H 00021 #include <stdio.h> 00022 #include <dxcut/class.h> 00023 #ifdef __cplusplus 00024 extern "C" { 00025 #endif 00026 00029 typedef enum { 00031 DEX_FLAG_VERIFIED = 1, 00033 DEX_FLAG_BIG = 2, 00035 DEX_FLAG_FIELDS = 4, 00037 DEX_FLAG_INVOCATIONS = 8, 00038 } OdexFlags; 00039 00040 typedef struct { 00043 dx_ubyte* id; 00044 00047 dx_uint flags; 00048 00050 dx_uint odex_version; 00051 00052 // These fields come from the deps section. 00053 00055 dx_uint dex_mod_time; 00057 dx_uint dex_crc; 00059 dx_uint vm_version; 00061 ref_strstr* deps; 00064 dx_ubyte** dep_shas; 00065 00066 // These fields come from the aux section. 00067 00070 dx_uint aux_format; 00073 dx_uint has_class_lookup; 00076 dx_uint has_register_maps; 00079 dx_uint has_reducing_index_map; 00083 dx_uint has_expanding_index_map; 00084 } OdexData; 00085 00086 typedef struct { 00088 DexClass* classes; 00089 00092 OdexData* metadata; 00093 } DexFile; 00094 00098 extern 00099 DexFile* dxc_read_file(FILE* fin); 00100 00105 extern 00106 DexFile* dxc_read_buffer(void* buf, dx_uint size); 00107 00111 extern 00112 void dxc_write_file(DexFile* dex, FILE* fout); 00113 00117 extern 00118 void dxc_free_file(DexFile* dex); 00119 00123 extern 00124 void dxc_free_odex_data(OdexData* data); 00125 00126 #ifdef __cplusplus 00127 } 00128 #endif 00129 #endif // __DXCUT_FILE_H