当前位置:网站首页>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 看看这段代码的本质含义:

边栏推荐
- Returns a zero-length array or empty collection, do not return null
- Routing interception of WeChat applet
- multithreaded lock
- Thymeleaf是什么?该如何使用。
- 架构实战营模块八作业
- Unity 之 音频类型和编码格式介绍
- C language parsing json string (json object is converted to string)
- sqlite3 simple operation
- 利用反射实现一个管理对象信息的简单框架
- The principle of ReentrantLock (to be continued)
猜你喜欢

基于STM32 环形队列来实现串口接收数据

ResNet的基础:残差块的原理

STM32 full series development firmware installation guide under Arduino framework

Implementing a Simple Framework for Managing Object Information Using Reflection

Introduction to Audio Types and Encoding Formats in Unity

程序员如何学习开源项目,这篇文章告诉你
Cache and Database Consistency Solutions

Shell 脚本 快速入门到实战 -02

leetcode:6135. 图中的最长环【内向基环树 + 最长环板子 + 时间戳】

Qualcomm cDSP simple programming example (to query Qualcomm cDSP usage, signature), RK3588 npu usage query
随机推荐
NVIDIA已经开始测试AD106和AD107 GPU核心的显卡产品
&lt;artifactId&gt;ojdbc8&lt;/artifactId&gt;「建议收藏」
Linux environment redis cluster to build "recommended collection"
Transfer Learning - Domain Adaptation
财务盈利、偿债能力指标
Basic configuration of OSPFv3
Apache EventMesh distributed event-driven multi-runtime
How can we improve the real yourself, become an excellent architect?
Qualcomm cDSP simple programming example (to query Qualcomm cDSP usage, signature), RK3588 npu usage query
multithreaded lock
spark reports an error OutOfMemory "recommended collection"
The principle of ReentrantLock (to be continued)
Shell 脚本 快速入门到实战 -02
flowable workflow all business concepts
PCB stackup design
全网一触即发,自媒体人的内容分发全能助手——融媒宝
Short-circuit characteristics and protection of SiC MOSFETs
Verilog implements a divide-by-9 with a duty cycle of 5/18
Mobile web development 02
What's wrong with the sql syntax in my sql