Dex文件中数据结构

类型

含义

u1

等同于uint8_t,表示1字节无符号数

u2

等同于uint16_t,表示2字节的无符号数

u4

等同于uint32_t,表示4字节的无符号数

u8

等同于uint64_t,表示8字节的无符号数

sleb128

有符号LEB128,可变长度1~5字节

uleb128

无符号LEB128,可变长度1~5字节

uleb128p1

无符号LEB128值加1,可变长度1~5字节

sleb128,uleb128,uleb128p1是DEX文件中特有的数据类型

每个LEB128由1~5个字节组成,所有字节组合在一起表示一个32位的数据,

每个字节只有7位为有效位,如果第一个字节的最高位为1,则LEB128使用第二个字节,以此类推。如果读取5个字节后下一个字节的最高位仍为1则该dex文件无效,Dalvik虚拟机在验证dex时会返回失败

Dex文件整体结构

Dex由多个结构体组合而成,一个dex有7部份。

DexHeader结构体占用0x70个字节

DexFile源码文件 dalvik\libdex\DexFile.h

 /*
* Structure representing a DEX file.
*
* Code should regard DexFile as opaque, using the API calls provided here
* to access specific structures.
*/
struct DexFile {
/* directly-mapped "opt" header */
const DexOptHeader* pOptHeader; /* pointers to directly-mapped structs and arrays in base DEX */
const DexHeader* pHeader;
const DexStringId* pStringIds;
const DexTypeId* pTypeIds;
const DexFieldId* pFieldIds;
const DexMethodId* pMethodIds;
const DexProtoId* pProtoIds;
const DexClassDef* pClassDefs;
const DexLink* pLinkData; /*
* These are mapped out of the "auxillary" section, and may not be
* included in the file.
*/
const DexClassLookup* pClassLookup;
const void* pRegisterMapPool; // RegisterMapClassPool /* points to start of DEX file data */
const u1* baseAddr; /* track memory overhead for auxillary structures */
int overhead; /* additional app-specific data structures associated with the DEX */
//void* auxData;
};

最新文章

  1. Windows 10 新特性 -- Bing Maps 3D地图开发入门(一)
  2. c# nullable类型有什么用
  3. Windows 8.1/2012R2在脱机模式下安装.NET Framework 3.5
  4. POJ 3321 Apple Tree(后根遍历将树转化成序列,用树状数组维护)
  5. Mac + IDEA + JRebel破解方法.
  6. (转载)Cocos2dx-OpenGL ES2.0教程:纹理贴图(6)
  7. PreparedStatement是如何大幅度提高性能的
  8. 切换到mint了,纪念一下
  9. 我和ASP.NET MVC有个约会
  10. 带拦截器配置的 struts.xml文件
  11. [Codeforces1132G]Greedy Subsequences——线段树+单调栈
  12. 【转】python 退出程序的方式
  13. [开源 .NET 跨平台 Crawler 数据采集 爬虫框架: DotnetSpider] [四] JSON数据解析
  14. 迷你音乐播放器v1.0正式上线!
  15. WPF编程 ,TextBlock 显示百分数值的一种简单方法。
  16. MongoDB(课时11 嵌套集合)
  17. dubbo核心流程一览
  18. easyui datagrid 异步加载数据时滚动条有时会自动滚到最底部的问题
  19. node起server--axios做前端请求----进行CORS--跨域请求
  20. ECSHOP和SHOPEX快递单号查询中通插件V8.6专版

热门文章

  1. 拷贝插件 copy-webpack-plugin
  2. restql 学习二 几种查询模式
  3. TensorFlow分布式训练MNIST分类器
  4. iptables 数据走向流程
  5. 配置keepalived支持nginx高可用
  6. 【技术博客】Postman接口测试教程 - 环境、附加验证、文件上传测试
  7. [Gamma]Scrum Meeting#7
  8. PHP处理SOAP
  9. jenkins更新为国内源
  10. pytest 学习笔记一 入门篇