1 // copyright (c) 2019-2021 hors<horsicq@gmail.com> 2 // 3 // Permission is hereby granted, free of charge, to any person obtaining a copy 4 // of this software and associated documentation files (the "Software"), to deal 5 // in the Software without restriction, including without limitation the rights 6 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 // copies of the Software, and to permit persons to whom the Software is 8 // furnished to do so, subject to the following conditions: 9 10 // The above copyright notice and this permission notice shall be included in all 11 // copies or substantial portions of the Software. 12 13 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 // SOFTWARE. 20 // 21 #ifndef XDEX_DEF_H 22 #define XDEX_DEF_H 23 24 #include <QtGlobal> 25 26 namespace XDEX_DEF 27 { 28 struct HEADER 29 { 30 quint32 magic; // always LE 31 quint32 version; // always LE 32 quint32 checksum; 33 quint8 signature[20]; 34 quint32 file_size; 35 quint32 header_size; 36 quint32 endian_tag; // always LE 37 quint32 link_size; 38 quint32 link_off; 39 quint32 map_off; 40 quint32 string_ids_size; 41 quint32 string_ids_off; 42 quint32 type_ids_size; 43 quint32 type_ids_off; 44 quint32 proto_ids_size; 45 quint32 proto_ids_off; 46 quint32 field_ids_size; 47 quint32 field_ids_off; 48 quint32 method_ids_size; 49 quint32 method_ids_off; 50 quint32 class_defs_size; 51 quint32 class_defs_off; 52 quint32 data_size; 53 quint32 data_off; 54 }; 55 56 struct MAP_ITEM 57 { 58 quint16 nType; 59 quint32 nCount; 60 quint32 nOffset; 61 }; 62 63 struct STRING_ITEM_ID 64 { 65 quint32 string_data_off; 66 }; 67 68 struct TYPE_ITEM_ID 69 { 70 quint32 descriptor_idx; 71 }; 72 73 struct PROTO_ITEM_ID 74 { 75 quint32 shorty_idx; 76 quint32 return_type_idx; 77 quint32 parameters_off; 78 }; 79 80 struct FIELD_ITEM_ID 81 { 82 quint16 class_idx; 83 quint16 type_idx; 84 quint32 name_idx; 85 }; 86 87 struct METHOD_ITEM_ID 88 { 89 quint16 class_idx; 90 quint16 proto_idx; 91 quint32 name_idx; 92 }; 93 94 struct CLASS_ITEM_DEF 95 { 96 quint32 class_idx; 97 quint32 access_flags; 98 quint32 superclass_idx; 99 quint32 interfaces_off; 100 quint32 source_file_idx; 101 quint32 annotations_off; 102 quint32 class_data_off; 103 quint32 static_values_off; 104 }; 105 106 const quint16 TYPE_HEADER_ITEM =0x0000; 107 const quint16 TYPE_STRING_ID_ITEM =0x0001; 108 const quint16 TYPE_TYPE_ID_ITEM =0x0002; 109 const quint16 TYPE_PROTO_ID_ITEM =0x0003; 110 const quint16 TYPE_FIELD_ID_ITEM =0x0004; 111 const quint16 TYPE_METHOD_ID_ITEM =0x0005; 112 const quint16 TYPE_CLASS_DEF_ITEM =0x0006; 113 const quint16 TYPE_CALL_SITE_ID_ITEM =0x0007; 114 const quint16 TYPE_METHOD_HANDLE_ITEM =0x0008; 115 const quint16 TYPE_MAP_LIST =0x1000; 116 const quint16 TYPE_TYPE_LIST =0x1001; 117 const quint16 TYPE_ANNOTATION_SET_REF_LIST =0x1002; 118 const quint16 TYPE_ANNOTATION_SET_ITEM =0x1003; 119 const quint16 TYPE_CLASS_DATA_ITEM =0x2000; 120 const quint16 TYPE_CODE_ITEM =0x2001; 121 const quint16 TYPE_STRING_DATA_ITEM =0x2002; 122 const quint16 TYPE_DEBUG_INFO_ITEM =0x2003; 123 const quint16 TYPE_ANNOTATION_ITEM =0x2004; 124 const quint16 TYPE_ENCODED_ARRAY_ITEM =0x2005; 125 const quint16 TYPE_ANNOTATIONS_DIRECTORY_ITEM =0x2006; 126 const quint16 TYPE_HIDDENAPI_CLASS_DATA_ITEM =0xF000; 127 } 128 #endif // XDEX_DEF_H 129