Function at 0x401687
Capabilities:
Enumerate pe sections
Parse pe header

Disassembly:
push ebp
mov ebp, esp
push edi
push esi
push ebx
sub esp, 0x4c
mov eax, dword [ebp + 8]
cmp word [eax], 0x5a4d
jne 0x401b08
add eax, dword [eax + 0x3c]
cmp dword [eax], 0x4550
mov dword [ebp - 0x2c], eax
jne 0x401b08
mov dword [esp + 0xc], 4
mov edx, eax
mov dword [esp + 8], 0x2000
mov eax, dword [eax + 0x50]
mov dword [esp + 4], eax
mov eax, dword [edx + 0x34]
mov dword [esp], eax
call sub.KERNEL32.dll_VirtualAlloc
sub esp, 0x10
test eax, eax
mov dword [ebp - 0x34], eax
jne 0x401712
mov ecx, dword [ebp - 0x2c]
mov dword [esp + 0xc], 4
mov dword [esp + 8], 0x2000
mov eax, dword [ecx + 0x50]
mov dword [esp], 0
mov dword [esp + 4], eax
call sub.KERNEL32.dll_VirtualAlloc
sub esp, 0x10
test eax, eax
mov dword [ebp - 0x34], eax
je 0x401b08
call sub.KERNEL32.dll_GetProcessHeap
mov dword [esp + 8], 0x14
mov dword [esp + 4], 0
mov dword [esp], eax
call sub.KERNEL32.dll_HeapAlloc
mov esi, dword [ebp - 0x34]
mov edx, dword [ebp - 0x2c]
sub esp, 0xc
mov ebx, eax
mov dword [eax + 4], esi
mov dword [eax + 0xc], 0
mov dword [eax + 8], 0
mov dword [eax + 0x10], 0
mov dword [esp + 0xc], 4
mov dword [esp + 8], 0x1000
mov eax, dword [edx + 0x50]
mov dword [esp], esi
mov dword [esp + 4], eax
call sub.KERNEL32.dll_VirtualAlloc
mov ecx, dword [ebp - 0x2c]
sub esp, 0x10
mov dword [esp + 0xc], 4
mov dword [esp + 8], 0x1000
mov eax, dword [ecx + 0x54]
mov dword [esp], esi
mov dword [esp + 4], eax
call sub.KERNEL32.dll_VirtualAlloc
mov esi, dword [ebp + 8]
mov edx, dword [ebp - 0x2c]
mov ecx, dword [esi + 0x3c]
add ecx, dword [edx + 0x54]
mov edi, eax
sub esp, 0x10
rep movsb byte es:[edi], byte [esi]
mov dword [ebp - 0x38], 0
mov ecx, dword [ebp + 8]
mov edx, dword [ebx + 4]
mov esi, dword [ebp - 0x34]
add eax, dword [ecx + 0x3c]
mov dword [ebp - 0x3c], edx
movzx edx, word [eax + 0x14]
mov dword [eax + 0x34], esi
mov dword [ebx], eax
lea esi, [eax + edx + 0x18]
jmp 0x401861
mov eax, dword [esi + 0x10]
test eax, eax
jne 0x401818
mov eax, dword [ebp - 0x2c]
mov ecx, dword [eax + 0x38]
test ecx, ecx
jle 0x40185b
mov eax, dword [ebp - 0x3c]
mov dword [esp + 4], ecx
mov dword [esp + 0xc], 4
mov dword [esp + 8], 0x1000
add eax, dword [esi + 0xc]
mov dword [ebp - 0x40], ecx
mov dword [esp], eax
call sub.KERNEL32.dll_VirtualAlloc
mov dword [esi + 8], eax
mov ecx, dword [ebp - 0x40]
mov edi, eax
xor eax, eax
sub esp, 0x10
rep stosb byte es:[edi], al
jmp 0x40185b
mov dword [esp + 4], eax
mov eax, dword [ebp - 0x3c]
mov dword [esp + 0xc], 4
mov dword [esp + 8], 0x1000
add eax, dword [esi + 0xc]
mov dword [esp], eax
call sub.KERNEL32.dll_VirtualAlloc
mov edi, eax
mov eax, dword [esi + 0x10]
sub esp, 0x10
mov dword [esp + 8], eax
mov eax, dword [ebp + 8]
add eax, dword [esi + 0x14]
mov dword [esp], edi
mov dword [esp + 4], eax
call sub.msvcrt.dll_memmove
mov dword [esi + 8], edi
inc dword [ebp - 0x38]
add esi, 0x28
mov eax, dword [ebx]
movzx edx, word [eax + 6]
cmp dword [ebp - 0x38], edx
jl 0x4017d1
mov edx, dword [ebp - 0x2c]
mov ecx, dword [ebp - 0x34]
sub ecx, dword [edx + 0x34]
mov dword [ebp - 0x30], ecx
je 0x4018cc
mov esi, dword [ebx + 4]
cmp dword [eax + 0xa4], 0
mov dword [ebp - 0x2c], esi
je 0x4018cc
mov eax, dword [eax + 0xa0]
jmp 0x4018c4
add edi, dword [ebp - 0x2c]
xor edx, edx
jmp 0x4018b8
movzx ecx, word [eax + edx*2 + 8]
mov esi, ecx
sar esi, 0xc
cmp esi, 3
jne 0x4018b7
and ecx, 0xfff
mov esi, dword [ebp - 0x30]
add dword [edi + ecx], esi
inc edx
mov esi, dword [eax + 4]
lea ecx, [esi - 8]
shr ecx, 1
cmp edx, ecx
jb 0x40189c
add eax, esi
mov edi, dword [eax]
test edi, edi
jne 0x401895
mov eax, dword [ebx + 4]
mov dword [ebp - 0x2c], eax
mov eax, dword [ebx]
cmp dword [eax + 0x84], 0
je 0x4019f6
mov esi, dword [ebp - 0x2c]
add esi, dword [eax + 0x80]
jmp 0x4019bd
mov eax, dword [ebx + 0xc]
lea edi, [eax*4 + 4]
call sub.KERNEL32.dll_GetProcessHeap
mov dword [esp + 8], edi
mov dword [esp + 4], 0
mov dword [esp], eax
call sub.KERNEL32.dll_HeapAlloc
mov edx, dword [ebx + 8]
mov dword [ebp - 0x40], edx
sub esp, 0xc
mov edi, eax
call sub.KERNEL32.dll_GetProcessHeap
mov edx, dword [ebp - 0x40]
mov dword [esp + 4], 0
mov dword [esp + 8], edx
mov dword [esp], eax
call sub.KERNEL32.dll_HeapFree
mov dword [ebx + 8], edi
sub esp, 0xc
test edi, edi
je 0x401b00
mov eax, dword [ebx + 0xc]
mov edx, dword [ebp - 0x30]
mov dword [edi + eax*4], edx
inc eax
mov dword [ebx + 0xc], eax
mov eax, dword [esi]
test eax, eax
je 0x40196a
add eax, dword [ebp - 0x2c]
mov edx, dword [ebp - 0x2c]
add edx, dword [esi + 0x10]
mov dword [ebp - 0x38], eax
xor edi, edi
jmp 0x4019af
mov ecx, dword [ebp - 0x2c]
add ecx, dword [esi + 0x10]
mov dword [ebp - 0x38], ecx
mov edx, ecx
jmp 0x401966
jge 0x401980
and eax, 0xffff
jmp 0x401987
mov ecx, dword [ebp - 0x2c]
lea eax, [ecx + eax + 2]
mov dword [esp + 4], eax
mov eax, dword [ebp - 0x30]
mov dword [ebp - 0x40], edx
mov dword [esp], eax
call sub.KERNEL32.dll_GetProcAddress
push edx
push edx
mov edx, dword [ebp - 0x40]
mov dword [edx + edi], eax
mov eax, dword [edx + edi]
add edi, 4
test eax, eax
je 0x401b00
mov ecx, dword [ebp - 0x38]
mov eax, dword [ecx + edi]
cmp eax, 0
jne 0x401977
add esi, 0x14
mov dword [esp + 4], 0x14
mov dword [esp], esi
call sub.KERNEL32.dll_IsBadReadPtr
test eax, eax
push ecx
push ecx
jne 0x4019f6
mov eax, dword [esi + 0xc]
test eax, eax
je 0x4019f6
add eax, dword [ebp - 0x2c]
mov dword [esp], eax
call sub.KERNEL32.dll_LoadLibraryA
test eax, eax
push edx
mov dword [ebp - 0x30], eax
jne 0x4018ef
jmp 0x401b00
mov eax, dword [ebx]
mov dword [ebp - 0x2c], 0
mov dword [ebp - 0x3c], ebx
movzx edx, word [eax + 0x14]
lea esi, [eax + edx + 0x18]
jmp 0x401ab8
mov eax, dword [esi + 0x24]
test eax, 0x2000000
je 0x401a38
mov dword [esp + 8], 0x4000
mov eax, dword [esi + 0x10]
mov dword [esp + 4], eax
mov eax, dword [esi + 8]
mov dword [esp], eax
call sub.KERNEL32.dll_VirtualFree
sub esp, 0xc
jmp 0x401ab2
cdq
and edx, 4
mov dword [ebp - 0x30], edx
mov edx, eax
mov ebx, dword [ebp - 0x30]
and edx, 0x40000000
cmp edx, 1
mov edx, eax
sbb ecx, ecx
and edx, 0x20000000
not ecx
and ecx, 8
cmp edx, 1
sbb edx, edx
not edx
and edx, 0x10
test eax, 0x4000000
lea ebx, [ebx + ecx + 0x4206b0]
mov ecx, dword [ebx + edx]
je 0x401a7a
or ch, 2
mov edx, dword [esi + 0x10]
test edx, edx
jne 0x401a95
test al, 0x40
je 0x401a8a
mov edx, dword [edi + 0x20]
jmp 0x401a91
test al, al
jns 0x401ab2
mov edx, dword [edi + 0x24]
test edx, edx
je 0x401ab2
lea eax, [ebp - 0x1c]
mov dword [esp + 0xc], eax
mov dword [esp + 8], ecx
mov dword [esp + 4], edx
mov eax, dword [esi + 8]
mov dword [esp], eax
call sub.KERNEL32.dll_VirtualProtect
sub esp, 0x10
inc dword [ebp - 0x2c]
add esi, 0x28
mov edx, dword [ebp - 0x3c]
mov edi, dword [edx]
movzx eax, word [edi + 6]
cmp dword [ebp - 0x2c], eax
jl 0x401a0f
mov eax, dword [edi + 0x28]
mov ebx, edx
test eax, eax
je 0x401afc
mov ecx, dword [ebp - 0x34]
add eax, dword [ebp - 0x34]
mov dword [esp + 8], 0
mov dword [esp + 4], 1
mov dword [esp], ecx
call eax
sub esp, 0xc
test eax, eax
je 0x401b00
mov dword [ebx + 0x10], 1
mov eax, ebx
jmp 0x401b0a
mov dword [esp], ebx
call fcn.00401514
xor eax, eax
lea esp, [ebp - 0xc]
pop ebx
pop esi
pop edi
pop ebp
ret