利用C++的operator new實現同一物件多次呼叫建構函式
阿新 • • 發佈:2019-02-19
00417A60 push ebp
00417A61 mov ebp,esp
00417A63 push 0FFFFFFFFh
00417A65 push offset __ehhandler$_main (425954h)
00417A6A mov eax,dword ptr fs:[00000000h]
00417A70 push eax
00417A71 mov dword ptr fs:[0],esp
00417A78 sub esp,0E8h
00417A7E push ebx
00417A7F push esi
00417A80 push edi
00417A81 lea edi,[ebp-0F4h]
00417A87 mov ecx,3Ah
00417A8C mov eax,0CCCCCCCCh
00417A91 rep stos dword ptr [edi]
00417A93 lea ecx,[obj]
00417A96 call STest::STest (4115DCh)
00417A9B mov dword ptr [obj],0
00417AA2 lea eax,[obj]
00417AA5 push eax
00417AA6 push 4
00417AA8 call operator new (411096h)
00417AAD add esp,8
00417AB0 mov dword ptr [ebp-0E0h],eax // new 操作符的返回值
00417AB6 mov dword ptr [ebp-4],0
00417ABD cmp dword ptr [ebp-0E0h],0
00417AC4 je main+79h (417AD9h)
00417AC6 mov ecx,dword ptr [ebp-0E0h] // 將返回值給ECX
00417ACC call STest::STest (4115DCh) // 呼叫建構函式
00417AD1 mov dword ptr [ebp-0F4h],eax
00417AD7 jmp main+83h (417AE3h)
00417AD9 mov dword ptr [ebp-0F4h],0
00417AE3 mov ecx,dword ptr [ebp-0F4h]
00417AE9 mov dword ptr [ebp-0ECh],ecx
00417AEF mov dword ptr [ebp-4],0FFFFFFFFh
00417AF6 xor eax,eax
00417AF8 push edx
00417AF9 mov ecx,ebp
00417AFB push eax
00417AFC lea edx,ds:[417B27h]
00417B02 call @ILT+480(@_RTC_CheckStackVars@8) (4111E5h)
00417B07 pop eax
00417B08 pop edx
00417B09 mov ecx,dword ptr [ebp-0Ch]
00417B0C mov dword ptr fs:[0],ecx
00417B13 pop edi
00417B14 pop esi
00417B15 pop ebx
00417B16 add esp,0F4h
00417B1C cmp ebp,esp
00417B1E call @ILT+1095(__RTC_CheckEsp) (41144Ch)
00417B23 mov esp,ebp
00417B25 pop ebp
00417B26 ret
00417A61 mov ebp,esp
00417A63 push 0FFFFFFFFh
00417A65 push offset __ehhandler$_main (425954h)
00417A6A mov eax,dword ptr fs:[00000000h]
00417A70 push eax
00417A71 mov dword ptr fs:[0],esp
00417A78 sub esp,0E8h
00417A7E push ebx
00417A7F push esi
00417A80 push edi
00417A81 lea edi,[ebp-0F4h]
00417A87 mov ecx,3Ah
00417A8C mov eax,0CCCCCCCCh
00417A91 rep stos dword ptr [edi]
00417A93 lea ecx,[obj]
00417A96 call STest::STest (4115DCh)
00417A9B mov dword ptr [obj],0
00417AA2 lea eax,[obj]
00417AA5 push eax
00417AA6 push 4
00417AA8 call operator new (411096h)
00417AAD add esp,8
00417AB0 mov dword ptr [ebp-0E0h],eax // new 操作符的返回值
00417AB6 mov dword ptr [ebp-4],0
00417ABD cmp dword ptr [ebp-0E0h],0
00417AC4 je main+79h (417AD9h)
00417AC6 mov ecx,dword ptr [ebp-0E0h] // 將返回值給ECX
00417ACC call STest::STest (4115DCh) // 呼叫建構函式
00417AD1 mov dword ptr [ebp-0F4h],eax
00417AD7 jmp main+83h (417AE3h)
00417AD9 mov dword ptr [ebp-0F4h],0
00417AE3 mov ecx,dword ptr [ebp-0F4h]
00417AE9 mov dword ptr [ebp-0ECh],ecx
00417AEF mov dword ptr [ebp-4],0FFFFFFFFh
00417AF6 xor eax,eax
00417AF8 push edx
00417AF9 mov ecx,ebp
00417AFB push eax
00417AFC lea edx,ds:[417B27h]
00417B02 call @ILT+480(@_RTC_CheckStackVars@8) (4111E5h)
00417B07 pop eax
00417B08 pop edx
00417B09 mov ecx,dword ptr [ebp-0Ch]
00417B0C mov dword ptr fs:[0],ecx
00417B13 pop edi
00417B14 pop esi
00417B15 pop ebx
00417B16 add esp,0F4h
00417B1C cmp ebp,esp
00417B1E call @ILT+1095(__RTC_CheckEsp) (41144Ch)
00417B23 mov esp,ebp
00417B25 pop ebp
00417B26 ret