2014-02-23 3 views
0

Hex-Rays의 IDA Pro를 사용하여 바이너리를 디 컴파일합니다. 나는이 전환을 가지고있다 :Decompiling - _thiscall expression

case 0x35: 
    CField::OnDesc_MAYB(v6, a6); 
    break; 
case 0x36: 
    (*(void (__thiscall **)(_DWORD, _DWORD))(*(_DWORD *)(a1 - 8) + 28))(a1 - 8, a6); 
    break; 
case 0x3A: 
    CField::OnWarnMessage(v6, a6); 
    break; 

나는 0x36 :을 본다. 나는이 문장을 이해할 수 없다. 보통 나는 함수를 가리키고 F5 단축키를 사용하여 디코드하지만,이 문장이 의미하는 바를 이해하지 못한다. 코드를보기 위해 어떻게 해독 할 수 있습니까?

감사합니다.

+0

,하지만 당신은 당신이 디 컴파일/분해하기 위해 노력하고 있다는 것이 무엇인지 말할 수 :

이러한 고장으로 시작할 수? –

답변

1

경우 0x36은 가상 기능을 호출하거나 Hex-Rays가 가상 기능이라고 생각하는 것 이상입니다. 다음의 의사 C++ 코드 (reinterpret_cast를 간결하게 제외)를 고려해보십시오.이 코드는 한 줄을 분해합니다. 엔지니어 프로그램을 반대하기 전에 당신이 __thiscall 호출 규칙, 또는 어떻게 가상 함수 일반적으로 C++에서 구현 익숙하지 않다면

(
    *(
     void (__thiscall **)(_DWORD, _DWORD) 
    ) 
    (* 
     (_DWORD *)(a1 - 8) + 28 
    ) 
) 
(a1 - 8, a6); 

, 당신은 아마 그들에 읽어해야합니다

// in VC++, 'this' is usually passed via ECX register 
typedef void (__thiscall* member_function_t)(_DWORD this_ptr, _DWORD arg_0); 
// a1's declaration wasn't included in your post, so I'm making an assumption here 
byte* a1 = address_of_some_child_object; 
// It would appear a1 is a pointer to an object which has multiple vftables (due to multiple inheritance/interfaces) 
byte*** base_object = (byte***)(a1 - 8); 
// Dereference the pointer at a1[-8] to get the base's vftable pointer (constant list of function pointers for the class's virtual funcs) 
// a1[0] would probably be the child/interface's vftable pointer 
byte** base_object_vftable = *base_object; 
// 28/sizeof(void*) = 8th virtual function in the vftable 
byte* base_object_member_function = base_object_vftable[28]; 
auto member_function = (member_function_t)base_object_member_function; 
// case 0x36 simplified using a __thiscall function pointer 
member_function((_DWORD)base_object, a6) 

은 해체 그들을 사용합니다. 내가 대답 마음 것을하지