首页
社区
课程
招聘
[分享]int 在 Stack 所占的空間
发表于: 2010-11-9 14:28 3058

[分享]int 在 Stack 所占的空間

2010-11-9 14:28
3058
Test Code :
// VarWidth.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include
using namespace std;

int AddFunc(int x, int y) {
int a = 0, b = 0, c = 0;

cout << "x addr : " << &x << endl;
cout << "y addr : " << &y << endl;

cout << "a addr : " << &a << endl;
cout << "b addr : " << &b << endl;
cout << "c addr : " << &c << endl;

__asm{
mov eax, dword ptr[esp+4]
mov ebx, dword ptr[esp+8]
add eax, ebx
}
return 0;
}

int main(int argc, char* argv[])
{
int iRet = 0;
int x = 1, y = 2;
iRet = AddFunc(x, y);
// printf("Hello World!\n");
return 0;
}


Default 情況下 :





Default 情況下 V$.net Debug Version 會用掉 12 Bytes, 如果 Debug / Release 都只要 4 Bytes 的話(例如直接用 esp + offset Access Variable)可以 follow 這一篇 : cf3K9s2c8@1M7q4)9K6b7g2)9J5c8W2)9J5c8Y4N6%4N6#2)9J5k6h3g2Y4k6$3S2W2j5h3c8U0j5h3k6W2i4K6u0W2j5$3!0E0i4K6u0r3M7$3!0X3N6s2N6S2M7X3g2Q4x3V1k6S2M7%4m8F1k6i4c8Q4x3V1j5J5z5e0p5%4z5o6t1I4y4g2)9J5c8X3q4F1i4K6u0V1K9h3&6@1i4K6u0V1N6r3S2S2N6q4)9J5k6r3W2K6i4K6u0V1y4q4)9J5k6r3u0&6N6r3g2K6i4K6u0V1K9h3&6Q4x3X3c8F1j5i4c8A6N6X3g2Q4x3X3c8S2L8X3c8Q4x3X3b7I4x3W2)9J5k6r3u0&6N6r3g2K6i4K6u0V1K9h3&6Q4x3X3c8F1k6i4c8Q4x3X3c8Z5N6h3S2Q4x3X3g2S2M7%4m8^5

PS : gcc.2 --> gcc 4.2

[培训]科锐逆向工程师培训第53期2025年7月8日开班!

收藏
免费 0
支持
分享
最新回复 (0)
游客
登录 | 注册 方可回帖
返回