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

Disassembly:
push ebp
mov ebp, esp
push ecx
push ecx
mov eax, dword [ebp + 0xc]
and dword [ebp - 4], 0
push 0x40
call fcn.004091d4
test eax, eax
je 0x409cd0
push esi
mov esi, dword [ebp + 8]
cmp word [esi], 0x5a4d
je 0x409a7e
push 0xc1
call dword [sym.imp.KERNEL32.dll_SetLastError]
xor eax, eax
jmp 0x409ccf
mov eax, dword [esi + 0x3c]
add eax, 0xf8
push eax
mov eax, dword [ebp + 0xc]
call fcn.004091d4
test eax, eax
je 0x409a77
push edi
mov edi, dword [esi + 0x3c]
add edi, esi
cmp dword [edi], 0x4550
mov dword [ebp - 8], edi
je 0x409ab6
push 0xc1
call dword [sym.imp.KERNEL32.dll_SetLastError]
xor eax, eax
jmp 0x409cce
cmp word [edi + 4], 0x14c
jne 0x409aa4
push ebx
mov ebx, dword [edi + 0x38]
test bl, 1
je 0x409ad9
push 0xc1
call dword [sym.imp.KERNEL32.dll_SetLastError]
xor eax, eax
jmp 0x409ccd
movzx edx, word [edi + 6]
test edx, edx
movzx eax, word [edi + 0x14]
lea eax, [eax + edi + 0x18]
jbe 0x409b09
lea ecx, [eax + 0xc]
mov esi, dword [ecx + 4]
test esi, esi
mov eax, dword [ecx]
jne 0x409af9
add eax, ebx
jmp 0x409afb
add eax, esi
cmp eax, dword [ebp - 4]
jbe 0x409b03
mov dword [ebp - 4], eax
add ecx, 0x28
dec edx
jne 0x409aec
mov eax, dword [edi + 0x38]
mov ecx, dword [edi + 0x50]
lea esi, [ecx + eax - 1]
lea ecx, [eax - 1]
not ecx
and esi, ecx
mov ecx, dword [ebp - 4]
lea ecx, [eax + ecx - 1]
dec eax
not eax
and ecx, eax
cmp esi, ecx
jne 0x409ac7
push dword [ebp + 0x24]
mov ebx, 0x3000
push 4
push ebx
push esi
push dword [edi + 0x34]
call dword [ebp + 0x10]
test eax, eax
mov dword [ebp - 4], eax
jne 0x409b55
push dword [ebp + 0x24]
push 4
push ebx
push esi
push eax
call dword [ebp + 0x10]
test eax, eax
mov dword [ebp - 4], eax
je 0x409b7b
push 0x40
push 8
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
mov ebx, eax
test ebx, ebx
jne 0x409b82
push dword [ebp + 0x24]
push 0x8000
push eax
push dword [ebp - 4]
call dword [ebp + 0x14]
push 0xe
jmp 0x409acc
mov esi, dword [ebp - 4]
xor eax, eax
mov dword [ebx + 4], esi
mov ax, word [edi + 0x16]
shr eax, 0xd
and eax, 1
mov dword [ebx + 0x14], eax
mov eax, dword [ebp + 0x10]
mov dword [ebx + 0x1c], eax
mov eax, dword [ebp + 0x14]
mov dword [ebx + 0x20], eax
mov eax, dword [ebp + 0x18]
mov dword [ebx + 0x24], eax
mov eax, dword [ebp + 0x1c]
mov dword [ebx + 0x28], eax
mov eax, dword [ebp + 0x20]
mov dword [ebx + 0x2c], eax
mov eax, dword [ebp + 0x24]
mov dword [ebx + 0x34], eax
mov eax, dword [edi + 0x38]
mov dword [ebx + 0x3c], eax
push dword [edi + 0x54]
mov eax, dword [ebp + 0xc]
call fcn.004091d4
test eax, eax
je 0x409cb3
push dword [ebp + 0x24]
push 4
push 0x1000
push dword [edi + 0x54]
push esi
call dword [ebp + 0x10]
mov ecx, dword [edi + 0x54]
mov esi, dword [ebp + 8]
mov edx, ecx
shr ecx, 2
mov edi, eax
rep movsd dword es:[edi], dword [esi]
mov ecx, edx
and ecx, 3
rep movsb byte es:[edi], byte [esi]
mov ecx, dword [ebp + 8]
mov edx, dword [ecx + 0x3c]
mov esi, dword [ebp - 8]
mov edi, dword [ebp - 4]
push ebx
push esi
push dword [ebp + 0xc]
add eax, edx
mov dword [ebx], eax
push ecx
mov dword [eax + 0x34], edi
call fcn.004091ec
test eax, eax
je 0x409cb3
mov eax, dword [ebx]
mov eax, dword [eax + 0x34]
sub eax, dword [esi + 0x34]
je 0x409c38
push eax
mov eax, ebx
call fcn.0040949c
mov dword [ebx + 0x18], eax
jmp 0x409c3f
mov dword [ebx + 0x18], 1
mov esi, ebx
call fcn.004096ef
test eax, eax
je 0x409cb3
push ebx
call fcn.00409396
test eax, eax
je 0x409cb3
mov eax, dword [ebx]
mov ecx, dword [ebx + 4]
add eax, 0xc0
mov eax, dword [eax]
test eax, eax
mov dword [ebp + 0x24], ecx
je 0x409c8a
mov esi, dword [eax + ecx + 0xc]
test esi, esi
je 0x409c8a
mov eax, dword [esi]
test eax, eax
je 0x409c8a
jmp 0x409c7a
mov ecx, dword [ebp + 0x24]
push 0
push 1
push ecx
call eax
add esi, 4
mov eax, dword [esi]
test eax, eax
jne 0x409c77
mov eax, dword [ebx]
mov eax, dword [eax + 0x28]
xor ecx, ecx
cmp eax, ecx
je 0x409cc8
add eax, edi
cmp dword [ebx + 0x14], ecx
je 0x409cc3
push ecx
xor esi, esi
inc esi
push esi
push edi
call eax
test eax, eax
jne 0x409cbe
push 0x45a
call dword [sym.imp.KERNEL32.dll_SetLastError]
push ebx
call fcn.004099c5
jmp 0x409ad2
mov dword [ebx + 0x10], esi
jmp 0x409ccb
mov dword [ebx + 0x38], eax
jmp 0x409ccb
mov dword [ebx + 0x38], ecx
mov eax, ebx
pop ebx
pop edi
pop esi
leave
ret 0x20