当前位置:网站首页>IDA PRO中汇编结构体识别
IDA PRO中汇编结构体识别
2022-07-31 21:33:00 【不会写代码的丝丽】
概述
我们有如下一段代码:
#include<stdio.h>
struct My_Struct
{
char name[500];
int age;
int height;
};
struct My_Struct obtainStruct() {
struct My_Struct p = {
"sdsdsds",2,3 };
printf("%s\r\n", p.name);
printf("diff %d\r\n", (size_t)&p.age-(size_t)&p.name);
printf("%d\r\n", p.height);
return p;
}
int main()
{
struct My_Struct p =obtainStruct();
printf("%s\r\n", p.name);
printf("%d\r\n", p.age);
printf("%d\r\n", p.height);
return 0;
}


我们首先把一些call调用的函数名称加上
首先我们注意到个细节 栈区有两个变量默认名称分别为var_3fc和ArgList刚好相差508个字节。而这个字节大小正好是我们定义My_Struct结构体的大小。
另外这里都是 IDA提示都是负数并且都是基于EBP进行加减得到,所以这两个数都是本地变量,而不是函数调用传入的。
举个例子:
具体原因也比较简单:
你可以参阅以下图的栈图结构:
从上图可知 栈区临时定义的变量会在EBP之下,传入的参数会在EBP之上。EBP-xxx 可以得到临时变量 ,而EBP+可以得到传入参数等。
我们打开IDA PRO的结构体视图按下insert键插入一个新的自定义结构体

在上面右键可以添加相对应字段







我们最后利用IDA 看看这段代码的本质含义:

边栏推荐
- Socket回顾与I/0模型
- grep command written test questions
- Apache EventMesh distributed event-driven multi-runtime
- What's wrong with the sql syntax in my sql
- GAC Honda Safety Experience Camp: "Danger" is the best teacher
- Shell 脚本 快速入门到实战 -02
- leetcode 665. Non-decreasing Array
- Flink_CDC construction and simple use
- A shortcut to search for specific character content in idea
- The principle of ReentrantLock (to be continued)
猜你喜欢
Cache and Database Consistency Solutions

The whole network is on the verge of triggering, and the all-round assistant for content distribution from media people - Rongmeibao

AI automatic code writing plugin Copilot (co-pilot)

MATLAB program design and application 2.4 Common internal functions of MATLAB

AI 自动写代码插件 Copilot(副驾驶员)

The principle of ReentrantLock (to be continued)

第七章

Chapter VII

【论文精读】iNeRF

Go1.18 upgrade function - Fuzz test from scratch in Go language
随机推荐
高通cDSP简单编程例子(实现查询高通cDSP使用率、签名),RK3588 npu使用率查询
cas and spin locks (is lightweight locks spin locks)
【公开课预告】:超分辨率技术在视频画质增强领域的研究与应用
架构实战营模块八作业
架构实战营模块 8 作业
微信小程序的路由拦截
rj45对接头千兆(百兆以太网接口定义)
[PIMF] OpenHarmony Thesis Club - Inventory of the open source Hongmeng tripartite library [3]
Memblaze发布首款基于长存颗粒的企业级SSD,背后有何新价值?
Carbon教程之 基本语法入门大全 (教程)
角色妆容的实现
关注!海泰方圆加入《个人信息保护自律公约》
GAC Honda Safety Experience Camp: "Danger" is the best teacher
老牌音乐播放器 WinAmp 发布 5.9 RC1 版:迁移到 VS 2019 完全重建,兼容 Win11
grep命令 笔试题
matplotlib ax bar color Set the color, transparency, label legend of the ax bar
Returns a zero-length array or empty collection, do not return null
BM3 将链表中的节点每k个一组翻转
MATLAB program design and application 2.4 Common internal functions of MATLAB
STM32 full series development firmware installation guide under Arduino framework