Function at 0x402050
Capabilities:
Allocate or change rwx memory
Execute shellcode via indirect call

Disassembly:
push ebp
push edi
push esi
push ebx
mov esi, eax
sub esp, 0x4c
mov ebp, dword [0x406460]
mov dword [esp + 0x14], edx
mov dword [esp + 0x18], ecx
test ebp, ebp
jle 0x402250
mov eax, dword [0x406464]
lea edx, [eax + 4]
xor eax, eax
lea esi, [esi]
mov ecx, dword [edx]
cmp esi, ecx
jb 0x402094
mov ebx, dword [edx + 4]
add ecx, dword [ebx + 8]
cmp esi, ecx
jb 0x4021f0
add eax, 1
add edx, 0xc
cmp eax, ebp
jne 0x402080
mov dword [esp], esi
call fcn.00402a60
test eax, eax
mov edi, eax
je 0x402277
lea ebx, [ebp + ebp*2]
mov ebp, dword [0x406464]
shl ebx, 2
add ebp, ebx
mov dword [ebp + 8], eax
mov dword [ebp], 0
call fcn.00402b60
add eax, dword [edi + 0xc]
lea ecx, [esp + 0x24]
mov dword [esp + 0x1c], ecx
mov dword [ebp + 4], eax
mov eax, dword [0x406464]
mov dword [esp + 4], ecx
mov dword [esp + 8], 0x1c
mov ebp, dword [sym.imp.KERNEL32.dll_VirtualQuery]
mov eax, dword [eax + ebx + 4]
mov dword [esp], eax
call ebp
sub esp, 0xc
test eax, eax
mov ecx, dword [esp + 0x1c]
je 0x402257
mov eax, dword [esp + 0x38]
cmp eax, 4
je 0x40211d
cmp eax, 0x40
jne 0x402200
add dword [0x406460], 1
mov dword [esp + 8], 0x1c
mov dword [esp + 4], ecx
mov dword [esp], esi
call ebp
sub esp, 0xc
test eax, eax
je 0x402287
mov eax, dword [esp + 0x38]
cmp eax, 4
je 0x40214e
cmp eax, 0x40
jne 0x402170
mov eax, dword [esp + 0x18]
mov dword [esp], esi
mov dword [esp + 8], eax
mov eax, dword [esp + 0x14]
mov dword [esp + 4], eax
call sub.msvcrt.dll_memcpy
add esp, 0x4c
pop ebx
pop esi
pop edi
pop ebp
ret
mov eax, dword [esp + 0x30]
lea ebp, [esp + 0x20]
mov dword [esp + 8], 0x40
mov ebx, dword [sym.imp.KERNEL32.dll_VirtualProtect]
mov dword [esp + 0xc], ebp
mov dword [esp + 4], eax
mov eax, dword [esp + 0x24]
mov dword [esp], eax
call ebx
sub esp, 0x10
mov eax, dword [esp + 0x18]
mov dword [esp], esi
mov dword [esp + 8], eax
mov eax, dword [esp + 0x14]
mov dword [esp + 4], eax
call sub.msvcrt.dll_memcpy
mov eax, dword [esp + 0x38]
cmp eax, 0x40
je 0x402166
cmp eax, 4
je 0x402166
mov eax, dword [esp + 0x20]
mov dword [esp + 0xc], ebp
mov dword [esp + 8], eax
mov eax, dword [esp + 0x30]
mov dword [esp + 4], eax
mov eax, dword [esp + 0x24]
mov dword [esp], eax
call ebx
sub esp, 0x10
add esp, 0x4c
pop ebx
pop esi
pop edi
pop ebp
ret
lea ecx, [esp + 0x24]
mov ebp, dword [sym.imp.KERNEL32.dll_VirtualQuery]
jmp 0x402124
mov eax, dword [esp + 0x30]
add ebx, dword [0x406464]
mov dword [esp + 0x1c], ecx
mov dword [esp + 8], 0x40
mov dword [esp + 4], eax
mov eax, dword [esp + 0x24]
mov dword [esp + 0xc], ebx
mov dword [esp], eax
call dword [sym.imp.KERNEL32.dll_VirtualProtect]
sub esp, 0x10
test eax, eax
mov ecx, dword [esp + 0x1c]
jne 0x40211d
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov dword [esp], str.__VirtualProtect_failed_with_code_0x_x
mov dword [esp + 4], eax
call fcn.00401ff0
xor ebp, ebp
jmp 0x40209e
mov eax, dword [0x406464]
mov eax, dword [eax + ebx + 4]
mov dword [esp + 8], eax
mov eax, dword [edi + 8]
mov dword [esp], str.__VirtualQuery_failed_for__d_bytes_at_address__p
mov dword [esp + 4], eax
call fcn.00401ff0
mov dword [esp + 4], esi
mov dword [esp], str.Address__p_has_no_image_section
call fcn.00401ff0
mov dword [esp + 8], esi
mov dword [esp + 4], 0x1c
mov dword [esp], str.__VirtualQuery_failed_for__d_bytes_at_address__p
call fcn.00401ff0
nop