小弟最近在家过宅男+啃老族的生活,无事+无收入,为了个小项目,需要逆向一段用到了COM的用户级驱动。初涉逆向这一深潭,便遇到C++/COM这样复杂的逆向问题 ,遍寻看雪未能找到好的关于C++的逆向入门文章,幸得Reversing enginerring with IDA pro,提及了OpenRCE.org的这的两篇文章,觉其甚好,欲译之。
原文地址:http://www.openrce.org/articles/full_view/23
class A
{
int a1;
public:
virtual int A_virt1();
virtual int A_virt2();
static void A_static1();
void A_simple1();
};
class B
{
int b1;
int b2;
public:
virtual int B_virt1();
virtual int B_virt2();
};
class C: public A, public B
{
int c1;
public:
virtual int A_virt2();
virtual int B_virt2();
};
;pC->A_simple1(1);
;esi = pC
push 1
mov ecx, esi
call A::A_simple1
;pC->B_simple1(2,3);
;esi = pC
lea edi, [esi+8] ;adjust this
push 3
push 2
mov ecx, edi
call B::B_simple1
struct RTTIBaseClassDescriptor
{
struct TypeDescriptor* pTypeDescriptor; //类的类型描述符
DWORD numContainedBases; //number of nested classes following in the Base Class Array
struct PMD where; //pointer-to-member displacement info
DWORD attributes; //flags, usually 0
};
struct PMD
{
int mdisp; //成员偏移
int pdisp; //vbtable偏移
int vdisp; //vbtable内偏移
};