Function at 0x51a380
Capabilities:
Access peb ldr_data
Get process heap flags

Disassembly:
push 0xffffffffffffffff
push 0x5d4158
mov eax, dword fs:[0]
push eax
mov dword fs:[0], esp
sub esp, 0x20
push ebx
push ebp
push esi
push edi
mov edi, dword [esp + 0x44]
mov edx, dword [edi]
add edx, 0x18
mov eax, edx
mov dword [edi], edx
push eax
call fcn.004f6540
mov ebx, dword [edi]
add ebx, eax
mov eax, ebx
mov dword [edi], ebx
push eax
call fcn.004f6540
mov ecx, dword [edi]
add ecx, eax
mov eax, ecx
mov dword [edi], ecx
mov ecx, dword [eax + 4]
mov edx, dword [eax + 8]
lea esi, [eax + 0xc]
mov eax, dword [0x7b8c60]
push esi
mov dword [esp + 0x28], ecx
mov dword [esp + 0x20], edx
mov dword [esp + 0x2c], esi
mov dword [esp + 0x30], eax
mov dword [edi], esi
call fcn.004f6540
mov edx, dword [edi]
mov ebp, dword [esp + 0x58]
add eax, 4
add esp, 0xc
add edx, eax
mov eax, edx
mov dword [edi], edx
test ebp, ebp
mov dword [esp + 0x18], eax
jne 0x51a41a
mov ecx, dword [esp + 0x40]
test ecx, ecx
jne 0x51a414
add eax, 4
mov dword [esp + 0x18], eax
mov dword [eax], 0
mov ebx, dword [edi]
add ebx, 0x14
mov dword [edi], ebx
mov ebx, dword [esp + 0x48]
mov edx, dword [ebx]
dec edx
mov dword [ebx], edx
mov ecx, dword [0x7b8c60]
inc ecx
mov dword [0x7b8c60], ecx
mov ecx, dword [0x7a8100]
mov dword [esp + 0x44], ecx
test ebp, ebp
mov dword [esp + 0x38], 0
jne 0x51a4e3
mov eax, dword [esp + 0x40]
test eax, eax
je 0x51a4e3
test byte [esp + 0x14], 1
je 0x51a4e3
cmp dword [ebx], 0
jle 0x51a4bd
mov esi, dword [edi]
add esi, 0x18
push esi
call fcn.004f6540
add esi, eax
push esi
call fcn.004f6540
mov edx, dword [esp + 0x24]
add esi, eax
add esp, 8
cmp dword [esi + 4], edx
jle 0x51a4bd
add esi, 0xc
push esi
call fcn.004f6540
lea eax, [esi + eax + 4]
add esp, 4
mov dword [eax], 0
add eax, 0x14
mov dword [edi], eax
mov edx, dword [ebx]
dec edx
mov dword [ebx], edx
mov ecx, dword [0x7b8c60]
inc ecx
mov dword [0x7b8c60], ecx
mov eax, dword [ebx]
test eax, eax
jg 0x51a469
lea ecx, [esp + 0x44]
mov dword [esp + 0x38], 0xffffffff
call fcn.005c6a51
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
mov ecx, dword [esp + 0x20]
mov dword fs:[0], ecx
add esp, 0x2c
ret
test ebp, ebp
mov dword [esp + 0x10], 0x10
jne 0x51a4fe
test byte [esp + 0x14], 2
je 0x51a4fe
mov dword [esp + 0x10], 0x11
call dword [sym.imp.USER32.dll_CreatePopupMenu]
test ebp, ebp
mov dword [esp + 0x48], eax
jne 0x51a512
mov ecx, dword [esp + 0x18]
mov dword [ecx], eax
cmp dword [ebx], 0
jle 0x51a709
mov esi, dword [edi]
add esi, 0x18
push esi
call fcn.004f6540
add esi, eax
push esi
call fcn.004f6540
mov ebp, dword [esi + eax]
add esi, eax
add esi, 4
add esp, 8
lea ecx, [esp + 0x44]
mov dword [esp + 0x2c], ebp
mov edx, dword [esi]
mov eax, dword [esi + 4]
add esi, 4
mov dword [esp + 0x28], edx
add esi, 4
mov dword [esp + 0x18], eax
push esi
call fcn.005c6b8e
push ebp
call fcn.0051a360
mov ebp, eax
add esp, 4
test ebp, ebp
je 0x51a581
push 0x78c35c
lea ecx, [esp + 0x48]
call fcn.005c6de1
push ebp
lea ecx, [esp + 0x48]
call fcn.005c6de1
push esi
call fcn.004f6540
mov ecx, dword [esp + 0x50]
add esp, 4
test ecx, ecx
lea ebp, [esi + eax + 4]
jne 0x51a5aa
mov eax, dword [esp + 0x40]
test eax, eax
jne 0x51a5a3
mov dword [ebp + 4], ecx
jmp 0x51a5aa
mov dword [ebp], 0
mov eax, dword [ebx]
add ebp, 0x14
cmp eax, 1
mov dword [esp + 0x14], ebp
jle 0x51a5d7
lea esi, [ebp + 0x18]
push esi
call fcn.004f6540
add esi, eax
push esi
call fcn.004f6540
mov ecx, dword [esp + 0x54]
add esp, 8
add esi, eax
mov esi, dword [esi + 4]
jmp 0x51a5da
or esi, 0xffffffff
mov eax, dword [esp + 0x28]
mov edx, dword [esp + 0x1c]
cmp eax, edx
jle 0x51a742
cmp esi, 0xffffffff
je 0x51a612
cmp esi, eax
jle 0x51a612
mov edx, dword [esp + 0x54]
mov eax, dword [esp + 0x50]
push edx
push eax
push ecx
mov ecx, dword [esp + 0x54]
push ebx
push edi
push ecx
call fcn.0051a380
add esp, 0x18
jmp 0x51a6f8
cmp ecx, 1
je 0x51a622
test byte [esp + 0x18], 1
jne 0x51a6e6
mov edx, dword [esp + 0x44]
push 0x78c358
push edx
call fcn.005b4d04
add esp, 8
test eax, eax
jne 0x51a669
mov ecx, dword [esp + 0x54]
mov eax, dword [0x7b8c60]
mov edx, ecx
neg edx
sbb edx, edx
and edx, eax
neg ecx
sbb ecx, ecx
push edx
and ecx, 0x100
push eax
mov eax, dword [esp + 0x50]
add ecx, 0x800
push ecx
push eax
call dword [sym.imp.USER32.dll_AppendMenuA]
jmp 0x51a6e6
mov al, byte [esp + 0x18]
xor esi, esi
test al, 4
je 0x51a678
mov esi, 8
mov ecx, dword [esp + 0x4c]
test ecx, ecx
jne 0x51a687
test al, 2
je 0x51a687
or esi, 1
mov ecx, dword [esp + 0x44]
mov edx, dword [0x7b8c60]
mov ebp, dword [esp + 0x48]
push ecx
push edx
push esi
push ebp
call dword [sym.imp.USER32.dll_AppendMenuA]
mov eax, dword [esp + 0x54]
test eax, eax
je 0x51a6bd
mov eax, dword [0x7b8c60]
or esi, 0x100
push eax
push eax
push esi
push eax
push ebp
call dword [sym.imp.USER32.dll_ModifyMenuA]
mov esi, dword [esp + 0x50]
test esi, esi
je 0x51a6e2
mov ebp, dword [esp + 0x2c]
test ebp, ebp
jle 0x51a6e2
mov eax, dword [0x7b8c60]
mov ecx, esi
push eax
call fcn.004f5d90
push ebp
mov ecx, esi
call fcn.004f5d90
mov ebp, dword [esp + 0x14]
mov dword [edi], ebp
mov ecx, dword [ebx]
dec ecx
mov dword [ebx], ecx
mov eax, dword [0x7b8c60]
inc eax
mov dword [0x7b8c60], eax
cmp dword [ebx], 0
jg 0x51a51b
mov esi, dword [esp + 0x20]
mov eax, dword [esp + 0x48]
mov edi, dword [esp + 0x40]
push esi
mov esi, dword [esp + 0x14]
push eax
push esi
push edi
call dword [sym.imp.USER32.dll_AppendMenuA]
mov eax, dword [esp + 0x54]
test eax, eax
je 0x51a7b2
mov ecx, dword [esp + 0x24]
mov ebx, dword [esp + 0x48]
push ecx
or esi, 0x100
push ebx
push esi
push ebx
push edi
call dword [sym.imp.USER32.dll_ModifyMenuA]
jmp 0x51a7b6
mov eax, dword [esp + 0x40]
test eax, eax
jne 0x51a772
lea ecx, [esp + 0x44]
mov dword [esp + 0x38], 0xffffffff
call fcn.005c6a51
mov eax, dword [esp + 0x48]
pop edi
pop esi
pop ebp
pop ebx
mov ecx, dword [esp + 0x20]
mov dword fs:[0], ecx
add esp, 0x2c
ret
mov ecx, dword [esp + 0x20]
mov edi, dword [esp + 0x48]
mov esi, dword [esp + 0x10]
push ecx
push edi
push esi
push eax
call dword [sym.imp.USER32.dll_AppendMenuA]
mov eax, dword [esp + 0x54]
test eax, eax
je 0x51a4bd
mov edx, dword [esp + 0x24]
mov eax, dword [esp + 0x40]
push edx
or esi, 0x100
push edi
push esi
push edi
push eax
call dword [sym.imp.USER32.dll_ModifyMenuA]
jmp 0x51a4bd
mov ebx, dword [esp + 0x48]
test edi, edi
jne 0x51a4bd
lea ecx, [esp + 0x44]
mov dword [esp + 0x38], 0xffffffff
call fcn.005c6a51
mov ecx, dword [esp + 0x30]
pop edi
pop esi
mov eax, ebx
pop ebp
pop ebx
mov dword fs:[0], ecx
add esp, 0x2c
ret