静态 局部 全局变量 反汇编
2013-06-14 15:17
155 查看
#include <Windows.h> #include <tchar.h> #include <stdio.h> int g_ivarone = 1; int g_ivartwo = 2; int g_ivarthree = 3; static int s_ivarfour = 4; int _tmain(int agrc, _TCHAR* agrv[]) { 00415ED0 push ebp 00415ED1 mov ebp,esp 00415ED3 sub esp,0E4h 00415ED9 push ebx 00415EDA push esi 00415EDB push edi 00415EDC lea edi,[ebp-0E4h] 00415EE2 mov ecx,39h 00415EE7 mov eax,0CCCCCCCCh 00415EEC rep stos dword ptr [edi] static int s_ivarfive = 5; static int s_ivarsix = 6; int ivarone = 1; 00415EEE mov dword ptr [ivarone],1 int ivartwo = 2; 00415EF5 mov dword ptr [ivartwo],2 int ivarthree = 3; 00415EFC mov dword ptr [ivarthree],3 printf("0x%08x\n", &g_ivarone); 00415F03 push offset g_ivarone (427B40h) 00415F08 push offset string "0x%08x\n" (42405Ch) 00415F0D call @ILT+1295(_printf) (411514h) 00415F12 add esp,8 printf("0x%08x\n", &g_ivartwo); 00415F15 push offset g_ivartwo (427B44h) 00415F1A push offset string "0x%08x\n" (42405Ch) 00415F1F call @ILT+1295(_printf) (411514h) 00415F24 add esp,8 printf("0x%08x\n", &g_ivarthree); 00415F27 push offset g_ivarthree (427B48h) 00415F2C push offset string "0x%08x\n" (42405Ch) 00415F31 call @ILT+1295(_printf) (411514h) 00415F36 add esp,8 printf("0x%08x\n", &s_ivarfour); 00415F39 push offset s_ivarfour (427B4Ch) 00415F3E push offset string "0x%08x\n" (42405Ch) 00415F43 call @ILT+1295(_printf) (411514h) 00415F48 add esp,8 printf("0x%08x\n", &s_ivarfive); 00415F4B push offset s_ivarfive (427B50h) 00415F50 push offset string "0x%08x\n" (42405Ch) 00415F55 call @ILT+1295(_printf) (411514h) 00415F5A add esp,8 printf("0x%08x\n", &s_ivarsix); 00415F5D push offset s_ivarsix (427B54h) 00415F62 push offset string "0x%08x\n" (42405Ch) 00415F67 call @ILT+1295(_printf) (411514h) 00415F6C add esp,8 printf("0x%08x\n", &ivarone); 00415F6F lea eax,[ivarone] 00415F72 push eax 00415F73 push offset string "0x%08x\n" (42405Ch) 00415F78 call @ILT+1295(_printf) (411514h) 00415F7D add esp,8 printf("0x%08x\n", &ivartwo); 00415F80 lea eax,[ivartwo] 00415F83 push eax 00415F84 push offset string "0x%08x\n" (42405Ch) 00415F89 call @ILT+1295(_printf) (411514h) 00415F8E add esp,8 printf("0x%08x\n", &ivarthree); 00415F91 lea eax,[ivarthree] 00415F94 push eax 00415F95 push offset string "0x%08x\n" (42405Ch) 00415F9A call @ILT+1295(_printf) (411514h) 00415F9F add esp,8 }
0x00427b40 0x00427b44 0x00427b48 0x00427b4c 0x00427b50 0x00427b54 0x0012fed4 0x0012fec8 0x0012febc
#include <Windows.h> #include <tchar.h> #include <stdio.h> int g_ivarone = 1; int g_ivartwo = 2; int g_ivarthree = 3; static int s_ivarfour = 4; int func(int v1, int v2, int v3) { 00411A40 push ebp 00411A41 mov ebp,esp 00411A43 sub esp,0E4h 00411A49 push ebx 00411A4A push esi 00411A4B push edi 00411A4C lea edi,[ebp-0E4h] 00411A52 mov ecx,39h 00411A57 mov eax,0CCCCCCCCh 00411A5C rep stos dword ptr [edi] static int s_ivarfive = 5; static int s_ivarsix = 6; int ivarone = v1; 00411A5E mov eax,dword ptr [v1] 00411A61 mov dword ptr [ivarone],eax int ivartwo = v2; 00411A64 mov eax,dword ptr [v2] 00411A67 mov dword ptr [ivartwo],eax int ivarthree = v3; 00411A6A mov eax,dword ptr [v3] 00411A6D mov dword ptr [ivarthree],eax printf("0x%08x\n", &g_ivarone); 00411A70 push offset g_ivarone (427B40h) 00411A75 push offset string "0x%08x\n" (42401Ch) 00411A7A call @ILT+1175(_printf) (41149Ch) 00411A7F add esp,8 printf("0x%08x\n", &g_ivartwo); 00411A82 push offset g_ivartwo (427B44h) 00411A87 push offset string "0x%08x\n" (42401Ch) 00411A8C call @ILT+1175(_printf) (41149Ch) 00411A91 add esp,8 printf("0x%08x\n", &g_ivarthree); 00411A94 push offset g_ivarthree (427B48h) 00411A99 push offset string "0x%08x\n" (42401Ch) 00411A9E call @ILT+1175(_printf) (41149Ch) 00411AA3 add esp,8 printf("0x%08x\n", &s_ivarfour); 00411AA6 push offset s_ivarfour (427B4Ch) 00411AAB push offset string "0x%08x\n" (42401Ch) 00411AB0 call @ILT+1175(_printf) (41149Ch) 00411AB5 add esp,8 printf("0x%08x\n", &s_ivarfive); 00411AB8 push offset s_ivarfive (427B50h) 00411ABD push offset string "0x%08x\n" (42401Ch) 00411AC2 call @ILT+1175(_printf) (41149Ch) 00411AC7 add esp,8 printf("0x%08x\n", &s_ivarsix); 00411ACA push offset s_ivarsix (427B54h) 00411ACF push offset string "0x%08x\n" (42401Ch) 00411AD4 call @ILT+1175(_printf) (41149Ch) 00411AD9 add esp,8 printf("0x%08x\n", &ivarone); 00411ADC lea eax,[ivarone] 00411ADF push eax 00411AE0 push offset string "0x%08x\n" (42401Ch) 00411AE5 call @ILT+1175(_printf) (41149Ch) 00411AEA add esp,8 printf("0x%08x\n", &ivartwo); 00411AED lea eax,[ivartwo] 00411AF0 push eax 00411AF1 push offset string "0x%08x\n" (42401Ch) 00411AF6 call @ILT+1175(_printf) (41149Ch) 00411AFB add esp,8 printf("0x%08x\n", &ivarthree); 00411AFE lea eax,[ivarthree] 00411B01 push eax 00411B02 push offset string "0x%08x\n" (42401Ch) 00411B07 call @ILT+1175(_printf) (41149Ch) 00411B0C add esp,8 return 0; 00411B0F xor eax,eax }
int _tmain(int agrc, _TCHAR* agrv[]) { 00411BD0 push ebp 00411BD1 mov ebp,esp 00411BD3 sub esp,0C0h 00411BD9 push ebx 00411BDA push esi 00411BDB push edi 00411BDC lea edi,[ebp-0C0h] 00411BE2 mov ecx,30h 00411BE7 mov eax,0CCCCCCCCh 00411BEC rep stos dword ptr [edi] func(1,2,3); 00411BEE push 3 00411BF0 push 2 00411BF2 push 1 00411BF4 call func (4110B9h) 00411BF9 add esp,0Ch }
相关文章推荐
- C|C++中的静态全局变量,静态局部变量,全局变量,局部变量的区别
- C|C++中的静态全局变量,静态局部变量,全局变量,局部变量的区别
- 全局变量,静态局部变量,局部变量空间的堆分配和栈分配
- 全局变量、静态全局变量、静态局部变量
- 全局变量、静态全局变量、静态局部变量和局部变量的区别
- 局部变量、全局变量、堆、堆栈、静态和全局
- C++ 全局变量、静态全局变量和静态局部变量的异同
- C/C++——全局变量、局部变量、静态全局变量和静态局部变量
- 局部变量、全局变量、堆、堆栈、静态和全局【】
- 全局变量、静态全局变量和静态局部变量的链接性
- C|C++中的静态全局变量,静态局部变量,全局变量,局部变量的区别
- 局部变量、全局变量、堆、堆栈、静态和全局
- C++中局部变量、全局变量、静态局部变量、静态全局变量
- C|C++中的静态全局变量,静态局部变量,全局变量,局部变量的区别
- 内存分配方式(动态/静态)的不同对const变量(全局/局部)访问性的影响
- C|C++中的静态全局变量,静态局部变量,全局变量,局部变量的区别
- 全局变量、静态全局变量、局部变量、静态局部变量
- c++ 全局 局部 静态 变量 区别
- 全局变量、静态全局变量、静态局部变量和局部变量
- 全局变量,静态局部变量,局部变量空间的堆分配和栈分配问题