In Recon 2011: Practical C++ Decompilation there is this example where some fields are assigned before the derived class' virtual table pointer is:

public: __thiscall CMachine::CMachine(void) proc near
 mov edi, edi
 push esi
 mov esi, ecx
 call CDataStoreObject::CDataStoreObject(void)
 and dword ptr [esi+24h], 0
 or dword ptr [esi+28h], 0FFFFFFFFh
 and dword ptr [esi+2Ch], 0
 or dword ptr [esi+30h], 0FFFFFFFFh
 mov dword ptr [esi], offset const CMachine::`vftable'
 mov eax, esi
 pop esi
public: __thiscall CMachine::CMachine(void) endp

Igor mentions that the assigning of those fields are not written by the programmer because they come before the virtual table pointer. Would someone mind explaining what these fields are and possibly what the values could represent?


the c++ code is like:

CMachine *__thiscall CMachine::CMachine(CMachine
this->dword24 = 0;
this->dword28 = -1;
this->dword2C = 0;
this->dword30 = -1;
this->_._vtable = (CMachine_vtable
return this;

the class CMachine has a member or a super class CDataStoreObject. the assigning of those fields should/could be the members of class CDataStoreObject. or for alignment.

compiler optimization in details might looks odd seeing from machine code. it depends on the optimization level and compiler type/version.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.