osx - Reversing of _PrepareMenuWindow() subroutine -
can 1 me reversing of _preparemenuwindow() subroutine? trying find signature of method.
__text:000639a7 _preparemenuwindow proc near ; code xref: drawthemenu(menuselectdata *,__cfarray **,uchar,uchar *)+274p __text:000639a7 ; popupmenuselectcore(menudata *,point,double,point,ushort,uint,rect const*,ushort,ulong,rect const*,rect const*,__cfstring const*,opaquemenuref **,ushort *)+528p __text:000639a7 __text:000639a7 var_44 = dword ptr -44h __text:000639a7 var_40 = dword ptr -40h __text:000639a7 var_3c = dword ptr -3ch __text:000639a7 var_34 = dword ptr -34h __text:000639a7 var_30 = dword ptr -30h __text:000639a7 var_2c = dword ptr -2ch __text:000639a7 var_28 = dword ptr -28h __text:000639a7 var_24 = word ptr -24h __text:000639a7 var_20 = dword ptr -20h __text:000639a7 var_1a = word ptr -1ah __text:000639a7 arg_0 = dword ptr 8 __text:000639a7 arg_4 = dword ptr 0ch __text:000639a7 arg_8 = dword ptr 10h __text:000639a7 __text:000639a7 push ebp __text:000639a8 mov ebp, esp __text:000639aa push edi __text:000639ab push esi __text:000639ac push ebx __text:000639ad sub esp, 5ch __text:000639b0 xor edi, edi __text:000639b2 mov eax, [ebp+arg_0] __text:000639b5 test eax, eax __text:000639b7 jz short loc_639c6 __text:000639b9 mov eax, [ebp+arg_0] __text:000639bc mov [esp], eax __text:000639bf call __znk8hiobject13getencodedrefev ; hiobject::getencodedref(void) __text:000639c4 mov edi, eax __text:000639c6 __text:000639c6 loc_639c6: ; code xref: _preparemenuwindow+10j __text:000639c6 mov ecx, [ebp+arg_4] __text:000639c9 mov eax, [ecx] __text:000639cb mov edx, [ecx+4] __text:000639ce mov [ebp+var_2c], eax __text:000639d1 mov [ebp+var_28], edx __text:000639d4 lea eax, [ebp+var_1a] __text:000639d7 mov [ebp+var_40], eax __text:000639da mov [esp+4], eax __text:000639de mov [esp], edi __text:000639e1 call _getmenutype __text:000639e6 mov dword ptr [esp+4], 0 __text:000639ee mov [esp], edi __text:000639f1 call _ismenuitemenabled __text:000639f6 movzx edx, [ebp+var_1a] __text:000639fa or dh, 1 __text:000639fd test al, al __text:000639ff movzx ebx, [ebp+var_1a] __text:00063a03 cmovz ebx, edx __text:00063a06 mov [ebp+var_1a], bx __text:00063a0a mov eax, [ebp+arg_8] __text:00063a0d mov [esp+0ch], eax __text:00063a11 lea ecx, [ebp+var_2c] __text:00063a14 mov [ebp+var_44], ecx __text:00063a17 mov [esp+8], ecx __text:00063a1b mov eax, [ebp+arg_4] __text:00063a1e mov [esp+4], eax __text:00063a22 mov [esp], edi __text:00063a25 call __addopenmenu __text:00063a2a mov ecx, [ebp+var_44] __text:00063a2d mov [esp], ecx __text:00063a30 call _emptyrect __text:00063a35 test al, al __text:00063a37 jnz loc_63b94 __text:00063a3d mov [esp], edi __text:00063a40 call __z11getmenudatap13opaquemenuref ; getmenudata(opaquemenuref *) __text:00063a45 mov [ebp+var_3c], eax __text:00063a48 call _newrgn __text:00063a4d mov esi, eax __text:00063a4f test eax, eax __text:00063a51 jz loc_63bdd __text:00063a57 movzx ebx, bx __text:00063a5a mov eax, [ebp+var_3c] __text:00063a5d mov eax, [eax+40h] __text:00063a60 test eax, eax __text:00063a62 jnz loc_63b23 __text:00063a68 mov [ebp+var_1a], 0 __text:00063a6e mov eax, [ebp+var_2c] __text:00063a71 mov edx, [ebp+var_28] __text:00063a74 mov [ebp+var_34], eax __text:00063a77 mov [ebp+var_30], edx __text:00063a7a mov ecx, [ebp+var_40] __text:00063a7d mov [esp+10h], ecx __text:00063a81 mov dword ptr [esp+0ch], 0 __text:00063a89 lea eax, [ebp+var_34] __text:00063a8c mov [esp+8], eax __text:00063a90 mov dword ptr [esp+4], 7 __text:00063a98 mov eax, [ebp+var_3c] __text:00063a9b mov [esp], eax __text:00063a9e call __z12_callmenudefp8menudatasp4rect5pointps ; _callmenudef(menudata *,short,rect *,point,short *) __text:00063aa3 cmp [ebp+var_1a], 7473h __text:00063aa9 jz short loc_63adc __text:00063aab add word ptr [ebp+var_2c], 3 __text:00063ab0 mov dword ptr [esp+8], 0fffffffch __text:00063ab8 mov dword ptr [esp+4], 0fffffffch __text:00063ac0 mov ecx, [ebp+var_44] __text:00063ac3 mov [esp], ecx __text:00063ac6 call _insetrect __text:00063acb mov eax, [ebp+var_44] __text:00063ace mov [esp+4], eax __text:00063ad2 mov [esp], esi __text:00063ad5 call _rectrgn __text:00063ada jmp short loc_63b23 __text:00063adc ; --------------------------------------------------------------------------- __text:00063adc __text:00063adc loc_63adc: ; code xref: _preparemenuwindow+102j __text:00063adc lea eax, [ebp+var_24] __text:00063adf mov [esp+8], eax __text:00063ae3 lea eax, [ebp+var_20] __text:00063ae6 mov [esp+4], eax __text:00063aea mov [esp], edi __text:00063aed call __getmenucallout __text:00063af2 movsx eax, [ebp+var_24] __text:00063af6 mov [esp+10h], eax __text:00063afa mov eax, [ebp+var_20] __text:00063afd mov [esp+0ch], eax __text:00063b01 mov [esp+8], esi __text:00063b05 mov [esp+4], ebx __text:00063b09 mov ecx, [ebp+var_44] __text:00063b0c mov [esp], ecx __text:00063b0f call __getthememenubackgroundregionwithcallout __text:00063b14 mov eax, [ebp+var_44] __text:00063b17 mov [esp+4], eax __text:00063b1b mov [esp], esi __text:00063b1e call _getregionbounds __text:00063b23 __text:00063b23 loc_63b23: ; code xref: _preparemenuwindow+bbj __text:00063b23 ; _preparemenuwindow+133j __text:00063b23 mov [esp+0ch], esi __text:00063b27 mov ecx, [ebp+var_44] __text:00063b2a mov [esp+8], ecx __text:00063b2e mov [esp+4], ebx __text:00063b32 mov [esp], edi __text:00063b35 call __zl13getmenuwindowp13opaquemenureftpk4rectp15opaquergnhandle ; getmenuwindow(opaquemenuref *,ushort,rect const*,opaquergnhandle *) __text:00063b3a test eax, eax __text:00063b3c jz short loc_63ba1 __text:00063b3e mov [esp], eax __text:00063b41 call _getwindowport __text:00063b46 mov [esp], eax __text:00063b49 call _setportwrapper __text:00063b4e mov [esp], esi __text:00063b51 call _setclipwrapper __text:00063b56 mov [esp], esi __text:00063b59 call _disposergn __text:00063b5e mov eax, [ebp+var_3c] __text:00063b61 mov eax, [eax+40h] __text:00063b64 test eax, eax __text:00063b66 jnz short loc_63bdd __text:00063b68 mov dword ptr [esp+14h], 0 __text:00063b70 mov dword ptr [esp+10h], 0 __text:00063b78 mov [esp+0ch], ebx __text:00063b7c mov ecx, [ebp+arg_4] __text:00063b7f mov [esp+8], ecx __text:00063b83 mov eax, [ebp+var_44] __text:00063b86 mov [esp+4], eax __text:00063b8a mov [esp], edi __text:00063b8d call __z18drawmenubackgroundp13opaquemenurefrk4rects3_thpv ; drawmenubackground(opaquemenuref *,rect const&,rect const&,ushort,uchar,void *) __text:00063b92 jmp short loc_63bdd __text:00063b94 ; --------------------------------------------------------------------------- __text:00063b94 __text:00063b94 loc_63b94: ; code xref: _preparemenuwindow+90j __text:00063b94 mov ecx, [ebp+arg_0] __text:00063b97 mov [esp], ecx __text:00063b9a call _disposemenuwindow __text:00063b9f jmp short loc_63bdd __text:00063ba1 ; --------------------------------------------------------------------------- __text:00063ba1 __text:00063ba1 loc_63ba1: ; code xref: _preparemenuwindow+195j __text:00063ba1 mov eax, [ebp+arg_0] __text:00063ba4 mov [esp], eax __text:00063ba7 call __z11findmbentryp8menudata ; findmbentry(menudata *) __text:00063bac mov ecx, eax __text:00063bae test eax, eax __text:00063bb0 jz short loc_63bd5 __text:00063bb2 mov word ptr [eax+1eh], 0 __text:00063bb8 mov word ptr [eax+1ch], 0 __text:00063bbe mov word ptr [eax+1ah], 0 __text:00063bc4 mov word ptr [eax+18h], 0 __text:00063bca mov eax, [eax+18h] __text:00063bcd mov edx, [ecx+1ch] __text:00063bd0 mov [ecx], eax __text:00063bd2 mov [ecx+4], edx __text:00063bd5 __text:00063bd5 loc_63bd5: ; code xref: _preparemenuwindow+209j __text:00063bd5 mov [esp], esi __text:00063bd8 call _disposergn __text:00063bdd __text:00063bdd loc_63bdd: ; code xref: _preparemenuwindow+aaj __text:00063bdd ; _preparemenuwindow+1bfj ... __text:00063bdd xor eax, eax __text:00063bdf add esp, 5ch __text:00063be2 pop ebx __text:00063be3 pop esi __text:00063be4 pop edi __text:00063be5 leave __text:00063be6 retn __text:00063be6 _preparemenuwindow endp
what have got far isn't generated ida? (ie: analysis of function).
from looks of __cdecl
function returns null/false/0. seems take 3 arguments(which can confirmed looking @ cleanup caller, if there any).
arg 0 menudata*
, arg 4 seems rect&
(which secretly rect*
), arg 8 whatever type __addopenmenu
takes fourth argument.
so i'd assume along lines of typedef bool(__cdecl*)(menudata*,rect&,void*)
Comments
Post a Comment