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

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x28
and dword [ebp - 0x20], 0
push esi
mov esi, dword [ebp + 0xc]
lea eax, [esi - 0x201]
cmp eax, 0x6ffffdfe
ja 0x4052a3
mov ecx, dword [ebp + 8]
mov eax, 0x5a4d
cmp ax, word [ecx]
jne 0x4052a3
push edi
mov edi, dword [ecx + 0x3c]
cmp edi, esi
jae 0x4052a2
lea eax, [edi + 0x18]
cmp eax, esi
jae 0x4052a2
lea edx, [edi + ecx]
movzx eax, word [edx + 0x14]
mov dword [ebp - 0x1c], eax
lea eax, [edi + 0x18]
mov edi, dword [ebp - 0x1c]
push ebx
movzx ebx, word [edx + 6]
imul ecx, ebx, 0x28
mov dword [ebp + 0xc], ebx
add eax, ecx
add eax, edi
mov dword [ebp - 0xc], eax
lea eax, [edi + 0x18]
add eax, edx
mov dword [ebp - 0x1c], eax
add eax, 0xffffffd8
add eax, ecx
cmp dword [edx], 0x4550
mov dword [ebp - 8], eax
jne 0x4052a1
lea eax, [ebx - 1]
cmp eax, 0x4e
ja 0x4052a1
cmp dword [ebp - 0xc], esi
jae 0x4052a1
cmp edi, esi
jae 0x4052a1
mov ebx, dword [edx + 0x54]
mov ecx, dword [edx + 0x3c]
mov eax, dword [edx + 0x38]
mov edx, dword [edx + 0x50]
mov dword [ebp - 0x10], ebx
cmp dword [ebp - 0xc], ebx
ja 0x4052a1
mov edi, 0x10000
cmp ecx, edi
ja 0x4052a1
cmp eax, edi
ja 0x4052a1
lea edi, [eax - 1]
mov eax, edi
mov dword [ebp - 0x24], edi
lea ebx, [edi + edx]
not eax
and ebx, eax
mov eax, dword [ebp - 8]
mov dword [ebp + 0x18], ebx
mov edx, dword [eax + 0xc]
cmp edx, ebx
ja 0x4052a1
mov eax, dword [eax + 8]
cmp eax, ebx
jae 0x4052a1
add eax, edx
cmp eax, ebx
ja 0x4052a1
lea eax, [ecx - 1]
mov dword [ebp - 0x18], eax
cmp eax, edi
ja 0x4052a1
and dword [ebp - 0xc], 0
mov edx, dword [ebp + 0xc]
test edx, edx
je 0x40521c
mov ecx, dword [ebp - 0x1c]
add ecx, 0x14
mov edi, dword [ecx - 8]
cmp edi, ebx
ja 0x405213
test dword [ebp - 0x24], edi
jne 0x405213
mov eax, dword [ecx]
mov dword [ebp - 4], eax
cmp eax, esi
ja 0x405213
mov ebx, dword [ecx - 4]
cmp ebx, esi
mov dword [ebp - 0x14], ebx
mov ebx, dword [ebp + 0x18]
ja 0x405213
add eax, dword [ebp - 0x14]
cmp eax, esi
ja 0x405213
lea eax, [ecx - 0x14]
cmp eax, dword [ebp - 8]
je 0x4051a0
mov eax, dword [ecx + 0x20]
mov dword [ebp - 0x28], eax
cmp edi, eax
ja 0x405213
mov eax, dword [ecx - 0xc]
add eax, edi
cmp eax, dword [ebp - 0x28]
ja 0x405213
mov eax, dword [ebp - 0x18]
mov edx, dword [ebp - 4]
not eax
mov ebx, dword [ebp + 0x18]
and edx, eax
mov dword [ebp - 4], edx
mov dword [ecx], edx
mov edx, dword [ebp - 0x14]
add edx, dword [ebp - 0x18]
and edx, eax
mov eax, dword [ebp - 4]
mov dword [ebp - 0x14], edx
mov dword [ecx - 4], edx
mov edx, dword [ebp + 0xc]
cmp eax, esi
ja 0x405213
cmp dword [ebp - 0x14], 0
jl 0x405213
mov dword [ebp - 4], esi
sub dword [ebp - 4], eax
mov eax, dword [ebp - 4]
cmp dword [ebp - 0x14], eax
jbe 0x4051e1
mov dword [ecx - 4], eax
lea eax, [ecx - 0x14]
cmp eax, dword [ebp - 8]
je 0x4051f5
mov eax, dword [ecx + 0x20]
sub eax, edi
cmp dword [ecx - 4], eax
ja 0x405213
jmp 0x405201
mov eax, ebx
sub eax, edi
cmp dword [ecx - 4], eax
jbe 0x405201
mov dword [ecx - 4], eax
mov eax, dword [ebp - 0xc]
add ecx, 0x28
inc eax
mov dword [ebp - 0xc], eax
cmp eax, edx
jb 0x405147
cmp dword [ebp - 0xc], edx
jb 0x4052a1
lea eax, [ebx + 0x100]
push eax
push 1
call fcn.00478d6e
mov edi, eax
test edi, edi
je 0x4052a1
lea eax, [ebx + 0x100]
push eax
push 0
push edi
call sub.ntoskrnl.exe_memset
mov eax, dword [ebp - 0x10]
add esp, 0xc
cmp esi, eax
jb 0x40524b
mov esi, eax
push esi
push dword [ebp + 8]
push edi
call sub.ntoskrnl.exe_memcpy
add esp, 0xc
cmp dword [ebp + 0xc], 0
jbe 0x405293
mov esi, dword [ebp - 0x1c]
mov ebx, dword [ebp + 8]
add esi, 0x10
mov eax, dword [esi - 8]
mov ecx, dword [esi]
cmp eax, ecx
jae 0x405273
push eax
jmp 0x405274
push ecx
mov eax, dword [esi + 4]
add eax, ebx
push eax
mov eax, dword [esi - 4]
add eax, edi
push eax
call sub.ntoskrnl.exe_memcpy
add esp, 0xc
add esi, 0x28
dec dword [ebp + 0xc]
jne 0x405267
mov ebx, dword [ebp + 0x18]
mov ecx, dword [ebp + 0x10]
mov byte [ebp - 0x20], 1
mov dword [ecx], edi
mov ecx, dword [ebp + 0x14]
mov dword [ecx], ebx
pop ebx
pop edi
mov al, byte [ebp - 0x20]
pop esi
mov esp, ebp
pop ebp
ret 0x14