Quantcast
Channel: 看雪安全论坛
Viewing all articles
Browse latest Browse all 9556

【原创】类的逆向分析

$
0
0
类的权限控制只是编译器的产物,在汇编层次无法体现



类的构造函数VC特征
1.调用时,传递this指针。例如:lea ecx, [ebp+testb] ; this
2.函数内部,先处理this指针。例如:mov [ebp+this], ecx
3.若是有虚函数,则虚函数表赋值.例如:mov dword ptr [eax], offset ??_7CTestA@@6B@ ; const CTestA::`vftable'
4.返回this指针.例如:mov eax, [ebp+this]




类的析构函数VC特征
1.调用时,传递this指针。例如:lea ecx, [ebp+testb] ; this
2.函数内部,先处理this指针。例如:mov [ebp+this], ecx
3.若是有虚函数,则虚函数表赋值.mov dword ptr [eax], offset ??_7CTestA@@6B@ ; const CTestA::`vftable'
4.无返回值




类的成员函数VC特征
1.调用时,传递this指针。例如:lea ecx, [ebp+testb] ; this
2.函数内部,先处理this指针。例如:mov [ebp+this], ecx
3.函数地址引用,只有CALL指令。

类的内联成员函数VC特征
与类的成员函数VC特征一样




类的虚成员函数VC特征
1.调用时,传递this指针。例如:lea ecx, [ebp+testb] ; this
2.函数内部,先处理this指针。例如:mov [ebp+this], ecx
3.函数地址引用,能在虚表中找到。例如:
.rdata:00402394 ; const CTestA::`vftable'
.rdata:00402394 ??_7CTestA@@6B@ dd offset ?Sub@CTestA@@UAEHHH@Z
.rdata:00402394 ; DATA XREF: CTestA::CTestA(int,char,int)+Ao
.rdata:00402394 ; CTestA::CTestA(void)+Ao ...
.rdata:00402394 ; CTestA::Sub(int,int)
.rdata:00402398 dd offset ?Sub@CTestA@@UAEHXZ ; CTestA::Sub(void)
.rdata:0040239C dd 0
类的内联虚成员函数VC特征
与类的虚成员函数VC特征一样


类的静态成员函数VC特征
1.与普通函数无异。

Viewing all articles
Browse latest Browse all 9556

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>