Function at 0x401610
Capabilities:
Parse pe header

Disassembly:
push ebp
push edi
push esi
push ebx
sub esp, 0x4c
mov eax, dword [esp + 0x60]
cmp word [eax], 0x5a4d
je 0x40162c
xor eax, eax
add esp, 0x4c
pop ebx
pop esi
pop edi
pop ebp
ret
mov ebx, dword [esp + 0x60]
mov eax, dword [ebx + 0x3c]
add eax, ebx
cmp dword [eax], 0x4550
mov dword [esp + 0x24], eax
jne 0x401622
mov ebx, dword [eax + 0x34]
mov dword [esp + 0xc], 4
mov dword [esp + 8], 0x3000
mov eax, dword [eax + 0x50]
mov dword [esp], ebx
mov dword [esp + 0x2c], ebx
mov dword [esp + 4], eax
call sub.KERNEL32.dll_VirtualAlloc
sub esp, 0x10
test eax, eax
mov ebx, eax
mov dword [esp + 0x20], 0
je 0x401910
mov eax, dword [esp + 0x60]
mov esi, dword [esp + 0x60]
mov eax, dword [eax + 0x3c]
mov eax, dword [esi + eax + 0x54]
mov dword [esp + 4], esi
mov dword [esp], ebx
mov dword [esp + 8], eax
call sub.msvcrt.dll_memcpy
mov eax, dword [esp + 0x60]
mov esi, dword [eax + 0x3c]
add esi, eax
movzx eax, word [esi + 0x14]
lea ebp, [esi + eax + 0x18]
xor eax, eax
cmp word [esi + 6], 0
je 0x40171c
mov dword [esp + 0x1c], ebx
mov ebx, eax
nop
lea esi, [esi]
mov edi, dword [esp + 0x1c]
mov eax, dword [esp + 0x60]
add ebx, 1
add edi, dword [ebp + 0xc]
add eax, dword [ebp + 0x14]
add ebp, 0x28
mov edx, dword [ebp - 0x18]
mov dword [esp], edi
mov dword [esp + 8], edx
mov dword [esp + 4], eax
call sub.msvcrt.dll_memcpy
mov ecx, dword [esi + 0x38]
mov eax, dword [ebp - 0x20]
sub edx, edx
add edi, dword [ebp - 0x18]
lea eax, [ecx + eax - 1]
div ecx
imul ecx, eax
sub ecx, dword [ebp - 0x18]
mov dword [esp + 4], 0
mov dword [esp], edi
mov dword [esp + 8], ecx
call sub.msvcrt.dll_memset
cmp bx, word [esi + 6]
jb 0x4016c0
mov ebx, dword [esp + 0x1c]
mov eax, dword [ebx + 0x3c]
mov eax, dword [ebx + eax + 0x80]
lea edx, [ebx + eax]
or eax, eax
mov eax, 0
cmovne eax, edx
mov dword [esp + 0x28], eax
mov dword [esp + 0x1c], eax
nop
lea esi, [esi]
mov esi, dword [esp + 0x1c]
mov eax, dword [esi + 0xc]
or eax, eax
jne 0x401756
mov edx, dword [esi + 4]
test edx, edx
je 0x4017e1
add eax, ebx
mov dword [esp], eax
call sub.KERNEL32.dll_LoadLibraryA
sub esp, 4
test eax, eax
push eax
pop esi
je 0x4017b2
mov edi, dword [esp + 0x1c]
mov eax, dword [edi]
mov ebp, dword [edi + 0x10]
lea edi, [ebx + eax]
add ebp, ebx
or eax, eax
cmove edi, ebp
mov eax, dword [edi]
or eax, eax
je 0x4017ab
lea edx, [ebx + eax + 2]
movzx ecx, ax
or eax, eax
push ecx
pop eax
mov dword [esp], esi
cmovns eax, edx
add edi, 4
add ebp, 4
mov dword [esp + 4], eax
call fcn.004014c0
mov dword [ebp - 4], eax
mov eax, dword [edi]
test eax, eax
jne 0x401782
add dword [esp + 0x1c], 0x14
jmp 0x401740
mov ecx, dword [esp + 0x1c]
mov edx, dword [esp + 0x28]
push ebx
pop eax
call fcn.00401340
mov dword [esp + 8], 0x8000
mov dword [esp + 4], 0
mov dword [esp], ebx
call sub.KERNEL32.dll_VirtualFree
sub esp, 0xc
jmp 0x401622
mov eax, dword [esp + 0x20]
or eax, eax
jne 0x40195f
mov eax, dword [ebx + 0x3c]
lea esi, [esp + 0x3c]
mov dword [esp + 8], 2
xor edi, edi
mov dword [esp + 0xc], esi
add eax, ebx
mov esi, eax
mov dword [esp + 0x1c], eax
mov eax, dword [eax + 0x54]
mov dword [esp], ebx
mov dword [esp + 4], eax
call sub.KERNEL32.dll_VirtualProtect
push esi
pop edx
sub esp, 0x10
movzx eax, word [esi + 0x14]
cmp word [edx + 6], 0
lea esi, [esi + eax + 0x18]
jne 0x401892
jmp 0x4018cb
mov edx, eax
push eax
pop ebp
shr edx, 0x1c
shr ebp, 0x1e
and ebp, 1
and edx, 2
add edx, ebp
mov ebp, eax
shr ebp, 0x1f
lea edx, [ebp + edx*2]
mov edx, dword [edx*4 + 0x45e080]
mov ebp, edx
or ebp, 0x200
test eax, 0x4000000
lea eax, [esp + 0x3c]
cmovne edx, ebp
add edi, 1
add esi, 0x28
mov dword [esp + 0xc], eax
mov dword [esp + 8], edx
mov eax, dword [esi - 0x20]
mov dword [esp], ecx
mov dword [esp + 4], eax
call sub.KERNEL32.dll_VirtualProtect
sub esp, 0x10
mov eax, dword [esp + 0x1c]
cmp di, word [eax + 6]
jae 0x4018cb
mov ecx, dword [esi + 0xc]
mov eax, dword [esi + 0x24]
add ecx, ebx
test eax, 0x2000000
je 0x401832
mov dword [esp + 8], 0x4000
mov eax, dword [esi + 8]
add edi, 1
mov dword [esp], ecx
add esi, 0x28
mov dword [esp + 4], eax
call sub.KERNEL32.dll_VirtualFree
sub esp, 0xc
mov eax, dword [esp + 0x1c]
cmp di, word [eax + 6]
jb 0x401892
mov eax, dword [esp + 0x24]
mov eax, dword [eax + 0x28]
or eax, eax
jne 0x4018e0
add esp, 0x4c
push ebx
pop eax
pop ebx
pop esi
pop edi
pop ebp
ret
add eax, ebx
mov dword [esp + 8], 0
mov dword [esp + 4], 1
mov dword [esp], ebx
call eax
push eax
pop edx
sub esp, 0xc
mov eax, ebx
or edx, edx
jne 0x401624
call fcn.00401390
jmp 0x4017c1
mov eax, dword [esp + 0x24]
mov ecx, dword [eax + 0xa0]
test ecx, ecx
je 0x401622
mov dword [esp + 0xc], 4
mov dword [esp + 8], 0x3000
mov eax, dword [eax + 0x50]
mov dword [esp], 0
mov dword [esp + 4], eax
call sub.KERNEL32.dll_VirtualAlloc
sub esp, 0x10
test eax, eax
mov ebx, eax
je 0x401622
mov dword [esp + 0x20], 1
jmp 0x40167c
mov esi, dword [esp + 0x24]
mov dword [esp + 4], esi
mov eax, dword [esi + 0xa0]
mov dword [esp], eax
call fcn.00401400
add eax, dword [esp + 0x60]
mov esi, dword [esi + 0xa4]
mov edi, eax
mov eax, ebx
sub eax, dword [esp + 0x2c]
add esi, edi
cmp edi, esi
mov dword [esp + 0x20], esi
mov dword [esp + 0x1c], eax
jae 0x4017ed
lea esi, [esi]
mov ebp, dword [edi]
or ebp, ebp
je 0x4017ed
mov ecx, dword [edi + 4]
lea eax, [edi + 8]
lea edx, [ecx - 8]
shr edx, 1
je 0x4019ef
lea esi, [edi + edx*2 + 8]
jmp 0x4019c7
add eax, 2
cmp eax, esi
je 0x4019ec
movzx edx, word [eax]
push edx
pop ecx
shr cx, 0xc
cmp cx, 3
jne 0x4019c0
and edx, 0xfff
add eax, 2
mov ecx, dword [esp + 0x1c]
add edx, ebp
add dword [ebx + edx], ecx
cmp eax, esi
jne 0x4019c7
mov ecx, dword [edi + 4]
add edi, ecx
cmp dword [esp + 0x20], edi
ja 0x4019a0
jmp 0x4017ed