在调用类的构造函数时,代码段是这样的:
00401D96 mov ecx,dword ptr [ebp-28h]
00401D99 call @ILT+15(CMemoryItem::CMemoryItem) (00401014)
00401D9E mov dword ptr [ebp-38h],eax
在dword ptr [ebp-28h]中存放着CMemoryItem类对象申请的内存起始地址,现在跟踪一下类的构造函数来看看内部的执行流程,看现在的汇编代码:
00401DF0 push ebp
00401DF1 mov ebp,esp
00401DF3 push 0FFh
00401DF5 push offset __ehhandler$??0CMemoryItem@@QAE@XZ (004037ec)
00401DFA mov eax,fs:[00000000]
00401E00 push eax
00401E01 mov dword ptr fs:[0],esp
00401E08 sub esp,44h
00401E0B push ebx
00401E0C push esi
00401E0D push edi
00401E0E push ecx
00401E0F lea edi,[ebp-50h]
00401E12 mov ecx,11h
00401E17 mov eax,0CCCCCCCCh
00401E1C rep stos dword ptr [edi]
00401E1E pop ecx
00401E1F mov dword ptr [ebp-10h],ecx
00401E22 mov ecx,dword ptr [ebp-10h]
00401E25 add ecx,4
00401E28 call CString::CString (00402164)
00401E2D mov dword ptr [ebp-4],0
00401E34 mov eax,dword ptr [ebp-10h]
00401E37 mov dword ptr [eax],offset CMemoryItem::`vftable' (0041501c)
00401E3D mov ecx,dword ptr [g_Number (00416900)]
00401E43 add ecx,1
00401E46 mov dword ptr [g_Number (00416900)],ecx
00401E4C mov edx,dword ptr [g_Number (00416900)]
00401E52 push edx
00401E53 push offset string "Construct CMemoryItem Nember[%d]"... (004152c0)
00401E58 mov eax,dword ptr [ebp-10h]
00401E5B add eax,4
00401E5E push eax
00401E5F call CString::Format (0040119a)
00401E64 add esp,0Ch
|