源代码:

int _tmain(int argc, _TCHAR* argv[])
{
struct v1 {
int a;
short b;
char c;
int d;
double e;
};
v1* heap_struct = (v1*)malloc(sizeof(v1));
heap_struct->a = ;
heap_struct->b = ;
heap_struct->c = ;
heap_struct->d = ;
heap_struct->e = ;
return ; }

逆向分析:

结构体中的数据字段是通过名称访问的,但编译器将名称访问转换为数字偏移
所以在反汇编中难以区别
堆分配结构体

push                  ; Size
call ds:__imp__malloc
add esp,
cmp esi, esp
call j___RTC_CheckEsp
mov [ebp+heap_struct], eax
mov eax, [ebp+heap_struct]
mov dword ptr [eax],
mov eax,
mov ecx, [ebp+heap_struct]
mov [ecx+], ax
mov eax, [ebp+heap_struct]
mov byte ptr [eax+],
mov eax, [ebp+heap_struct]
mov dword ptr [eax+],
mov eax, [ebp+heap_struct]
fld ds:__real@
fstp qword ptr [eax+10h]
原类型     大小             偏移
int (dword)
short ()
char (byte)
int (dword)
double (qword)

  为默认4字节对齐

总结:全局和栈分配方式中的结构体 与  普通变量相似 难以区分

最新文章

  1. tab+tab
  2. 1125mysqbinlog日志
  3. BZOJ4260: Codechef REBXOR
  4. linq to sql 扩展方法
  5. struts2与spring集成时action的class属性值意义
  6. Http报头Accept与Content-Type的差别
  7. SSE图像算法优化系列十:简单的一个肤色检测算法的SSE优化。
  8. Ocelot概述
  9. Linux 网卡聚合
  10. 【Core】在mvc使用EF
  11. C code example for strdup
  12. 【转】Linux 移动或重命名文件/目录-mv 的10个实用例子
  13. 基于数据库构建分布式的ID生成方案
  14. Lintcode: Majority Number II 解题报告
  15. selenium之数据驱动框架应用WPS个人中心自动签到
  16. hadoo异常——org.apache.hadoop.security.UserGroupInformation: PriviledgedActionException
  17. 【MediaElement】WPF视频播放器【2】
  18. C语言错误处理方法、C++异常处理方法(throw, try, catch)简介
  19. 一键生成ssl自签名证书脚本
  20. 理解Python的装饰器

热门文章

  1. HDU 3400 Line belt (三分嵌套)
  2. GXU - 7D - 区间求和 - 前缀和
  3. HTML5 为 <input> 增加的属性 ; 为 <form> 增加的如需属性
  4. 基于XML的AOP配置
  5. Educational Codeforces Round 64 (Rated for Div. 2)D(并查集,图)
  6. java加密MD5实现及密码验证
  7. 七层登录——VB.NET版
  8. C#正则表达式快速入门
  9. thinkphp5加密解密
  10. java poi操作创建xslx或xsl文件,存本地和进行网络传输两种方式集成