Function at 0x40db20
Capabilities:
Resolve function by parsing pe exports

Disassembly:
sub esp, 0x28c
mov eax, dword [0x4f36a0]
xor eax, esp
mov dword [esp + 0x284], eax
push ebx
push ebp
push esi
push edi
push 0x4c
xor esi, esi
lea eax, [esp + 0xa0]
mov ebx, ecx
push esi
push eax
mov dword [esp + 0x28], ebx
call fcn.0049ca10
mov eax, dword [ebx + 4]
mov ebp, dword [sym.imp.USER32.dll_SendMessageW]
add esp, 0xc
mov dword [esp + 0x98], 0x50
mov dword [esp + 0x9c], 0x10
mov edx, dword [eax + 0xc]
mov eax, dword [eax]
lea ecx, [esp + 0x98]
push ecx
push edx
push 0x41c
push eax
call ebp
mov edi, dword [esp + 0xb8]
push esi
push esi
push 0x418
push edi
call ebp
cmp eax, esi
mov dword [esp + 0x18], eax
jle 0x40de73
push esi
push esi
push 0x52e
push edi
call ebp
cmp eax, esi
setne cl
mov dword [esp + 0x24], eax
mov byte [ebx + 8], cl
call dword [sym.imp.USER32.dll_CreatePopupMenu]
lea edx, [esp + 0x58]
mov dword [esp + 0x14], eax
xor eax, eax
push edx
push edi
mov dword [esp + 0x60], esi
mov dword [esp + 0x64], eax
mov dword [esp + 0x68], eax
mov dword [esp + 0x6c], eax
call dword [sym.imp.USER32.dll_GetClientRect]
cmp dword [esp + 0x18], esi
mov dword [esp + 0x20], esi
jle 0x40de51
xor eax, eax
mov dword [esp + 0xec], eax
mov dword [esp + 0xf0], eax
mov dword [esp + 0xf4], eax
mov dword [esp + 0xf8], eax
mov dword [esp + 0xfc], eax
lea eax, [esp + 0xec]
push eax
push esi
push 0x417
push edi
call ebp
test byte [esp + 0xf4], 8
jne 0x40de3e
lea ecx, [esp + 0x28]
push ecx
push esi
xor eax, eax
push 0x41d
push edi
mov dword [esp + 0x38], eax
mov dword [esp + 0x3c], eax
mov dword [esp + 0x40], eax
mov dword [esp + 0x44], eax
call ebp
mov eax, dword [esp + 0xf4]
mov edx, dword [esp + 0x30]
mov bl, al
shr bl, 2
and bl, 1
cmp edx, dword [esp + 0x60]
jle 0x40de3e
test ah, 1
je 0x40dca3
mov eax, dword [esp + 0x14]
push eax
call dword [sym.imp.USER32.dll_GetMenuItemCount]
test eax, eax
jle 0x40de3e
mov ecx, dword [esp + 0x14]
push 0
push 0
push 0x800
push ecx
call dword [sym.imp.USER32.dll_AppendMenuW]
jmp 0x40de3e
mov edx, dword [esp + 0x1c]
cmp byte [edx + 8], 0
push 0x18e
push 0
je 0x40dd55
lea ecx, [esp + 0x10a]
xor eax, eax
push ecx
mov word [esp + 0x10c], ax
call fcn.0049ca10
push 0x30
lea edx, [esp + 0x78]
push 0
push edx
call fcn.0049ca10
add esp, 0x18
mov dword [esp + 0x68], 0x30
call fcn.0040a2e0
test al, al
je 0x40dcf9
mov dword [esp + 0x68], 0x2c
mov edx, dword [esp + 0x24]
lea ecx, [esp + 0x68]
push ecx
push 1
push esi
lea eax, [esp + 0x10c]
push edx
mov dword [esp + 0x7c], 0x14
mov dword [esp + 0x9c], eax
mov dword [esp + 0xa0], 0xc8
call dword [sym.imp.USER32.dll_GetMenuItemInfoW]
mov eax, dword [esp + 0x8c]
mov ecx, dword [esp + 0x7c]
xor edx, edx
test bl, bl
sete dl
push eax
mov eax, dword [esp + 0x18]
push ecx
or edx, 0x10
push edx
push eax
call dword [sym.imp.USER32.dll_AppendMenuW]
jmp 0x40de3e
lea edx, [esp + 0x10a]
xor ecx, ecx
push edx
mov word [esp + 0x10c], cx
call fcn.0049ca10
mov edx, dword [esp + 0xfc]
add esp, 0xc
xor eax, eax
lea ecx, [esp + 0x38]
push ecx
push edx
mov dword [esp + 0x44], eax
mov dword [esp + 0x58], eax
mov dword [esp + 0x5c], eax
lea esi, [esp + 0x108]
mov dword [esp + 0x48], eax
mov dword [esp + 0x4c], eax
mov dword [esp + 0x50], eax
mov dword [esp + 0x54], eax
push 0x43f
mov eax, esi
push edi
mov dword [esp + 0x48], 0x20
mov dword [esp + 0x4c], 2
mov dword [esp + 0x60], eax
mov dword [esp + 0x64], 0xc8
call ebp
cmp eax, 0xffffffff
je 0x40ddd9
mov eax, esi
push eax
call dword [sym.imp.KERNEL32.dll_lstrlenW]
test eax, eax
jne 0x40de1e
mov edx, dword [esp + 0xf0]
mov eax, dword [0x4fd4e4]
push 0xc8
lea ecx, [esp + 0x104]
push ecx
push edx
push eax
mov esi, 0x4d6464
call dword [sym.imp.USER32.dll_LoadStringW]
xor ecx, ecx
test eax, eax
jle 0x40de1e
cmp word [esp + ecx*2 + 0x100], 0xa
je 0x40de17
inc ecx
cmp ecx, eax
jl 0x40de05
jmp 0x40de1e
lea esi, [esp + ecx*2 + 0x102]
mov ecx, dword [esp + 0xf0]
mov eax, dword [esp + 0x14]
xor edx, edx
test bl, bl
sete dl
push esi
push ecx
push edx
push eax
call dword [sym.imp.USER32.dll_AppendMenuW]
mov esi, dword [esp + 0x20]
inc esi
cmp esi, dword [esp + 0x18]
mov dword [esp + 0x20], esi
jl 0x40dbf1
mov ebx, dword [esp + 0x1c]
mov esi, dword [esp + 0x14]
push esi
call dword [sym.imp.USER32.dll_GetMenuItemCount]
test eax, eax
jne 0x40de77
test esi, esi
je 0x40de6b
push esi
call dword [sym.imp.USER32.dll_DestroyMenu]
push 0xffffffffffffffff
call dword [sym.imp.USER32.dll_MessageBeep]
xor al, al
jmp 0x40de7b
mov dword [ebx], esi
mov al, 1
mov ecx, dword [esp + 0x294]
pop edi
pop esi
pop ebp
pop ebx
xor ecx, esp
call fcn.00497c58
add esp, 0x28c
ret