Function at 0x581450
Capabilities:
Enumerate pe sections
Parse pe header
Resolve function by parsing pe exports

Disassembly:
push ecx
push esi
mov esi, ecx
cmp dword [esi + 0xc], 0x40
jae 0x581465
mov dword [esi], str.Too_small
xor al, al
pop esi
pop ecx
ret
mov ecx, dword [esi + 4]
cmp byte [ecx], 0x4d
jne 0x581769
cmp byte [ecx + 1], 0x5a
jne 0x581769
mov edx, dword [ecx + 0x3c]
lea eax, [ecx + edx]
cmp eax, ecx
push edi
jbe 0x58175d
mov ecx, dword [esi + 8]
lea edi, [ecx - 0x18]
cmp eax, edi
jae 0x58175d
test dl, 7
je 0x5814a9
pop edi
mov dword [esi], str.Misaligned_PE_header
xor al, al
pop esi
pop ecx
ret
cmp byte [eax], 0x50
jne 0x581751
cmp byte [eax + 1], 0x45
jne 0x581751
cmp byte [eax + 2], 0
jne 0x581751
cmp byte [eax + 3], 0
jne 0x581751
movzx edx, word [eax + 4]
mov word [esi + 0x20], dx
movzx edx, word [eax + 6]
mov word [esi + 0x22], dx
movzx edx, word [eax + 0x14]
lea edi, [eax + 0x18]
movzx eax, dx
mov word [esi + 0x1c], dx
movzx edx, ax
add edx, edi
cmp edx, ecx
mov dword [esi + 0x18], edi
jb 0x581506
pop edi
mov dword [esi], str.optional_header_past_end_of_file
xor al, al
pop esi
pop ecx
ret
cmp ax, 2
jae 0x581518
pop edi
mov dword [esi], str.optional_header_no_magic
xor al, al
pop esi
pop ecx
ret
movzx ecx, word [edi]
cmp cx, 0x10b
jne 0x58152e
mov byte [esi + 0x10], 0
mov word [esi + 0x1e], 0x60
jmp 0x581543
cmp cx, 0x20b
jne 0x581745
mov byte [esi + 0x10], 1
mov word [esi + 0x1e], 0x70
cmp ax, word [esi + 0x1e]
jae 0x581555
pop edi
mov dword [esi], str.optional_header_too_short
xor al, al
pop esi
pop ecx
ret
mov eax, dword [edi + 4]
mov dword [esi + 0x2c], eax
mov ecx, dword [edi + 8]
mov dword [esi + 0x30], ecx
mov edx, dword [edi + 0xc]
mov dword [esi + 0x34], edx
mov eax, dword [edi + 0x14]
mov dword [esi + 0x38], eax
mov al, byte [esi + 0x10]
test al, al
je 0x581589
mov dword [esi + 0x3c], 0
mov ecx, dword [edi + 0x18]
mov dword [esi + 0x40], ecx
mov edx, dword [edi + 0x1c]
mov dword [esi + 0x44], edx
jmp 0x58159c
mov ecx, dword [edi + 0x18]
mov dword [esi + 0x3c], ecx
mov edx, dword [edi + 0x1c]
mov dword [esi + 0x40], edx
mov dword [esi + 0x44], 0
mov ecx, dword [edi + 0x38]
neg al
mov dword [esi + 0x48], ecx
push ebx
mov ecx, esi
sbb eax, eax
and eax, 0x10
mov edx, dword [eax + edi + 0x5c]
add eax, 0x5c
lea eax, [esi + 0x50]
push eax
push 0
mov dword [esi + 0x4c], edx
call fcn.005811e0
lea ecx, [esi + 0x58]
push ecx
mov bl, al
push 1
mov ecx, esi
and bl, 1
call fcn.005811e0
lea edx, [esi + 0x60]
push edx
push 2
mov ecx, esi
and bl, al
call fcn.005811e0
and bl, al
lea eax, [esi + 0x68]
push eax
push 3
mov ecx, esi
call fcn.005811e0
lea ecx, [esi + 0x70]
push ecx
push 5
mov ecx, esi
and bl, al
call fcn.005811e0
lea edx, [esi + 0x78]
push edx
push 0xb
mov ecx, esi
and bl, al
call fcn.005811e0
and bl, al
lea eax, [esi + 0x80]
push eax
push 0xc
mov ecx, esi
call fcn.005811e0
lea ecx, [esi + 0x88]
push ecx
push 0xd
mov ecx, esi
and bl, al
call fcn.005811e0
lea edx, [esi + 0x90]
push edx
push 0xe
mov ecx, esi
and bl, al
call fcn.005811e0
test bl, al
jne 0x581656
pop ebx
pop edi
mov dword [esi], str.malformed_data_directory
xor al, al
pop esi
pop ecx
ret
movzx eax, word [esi + 0x1c]
add eax, edi
cmp word [esi + 0x22], 0
mov dword [esi + 0x24], eax
mov dword [esi + 0x14], 0
mov dword [esp + 0xc], 0
jbe 0x581738
mov ebx, eax
push ebp
lea esp, [esp]
mov eax, 6
mov ecx, str..text
mov edx, ebx
lea esp, [esp]
mov edi, dword [edx]
cmp edi, dword [ecx]
jne 0x5816a8
sub eax, 4
add ecx, 4
add edx, 4
cmp eax, 4
jae 0x581690
test eax, eax
je 0x581705
movzx edi, byte [edx]
movzx ebp, byte [ecx]
sub edi, ebp
jne 0x5816f7
sub eax, 1
add ecx, 1
add edx, 1
test eax, eax
je 0x581705
movzx edi, byte [edx]
movzx ebp, byte [ecx]
sub edi, ebp
jne 0x5816f7
sub eax, 1
add ecx, 1
add edx, 1
test eax, eax
je 0x581705
movzx edi, byte [edx]
movzx ebp, byte [ecx]
sub edi, ebp
jne 0x5816f7
sub eax, 1
add ecx, 1
add edx, 1
test eax, eax
je 0x581705
movzx edi, byte [edx]
movzx ecx, byte [ecx]
sub edi, ecx
je 0x581705
test edi, edi
mov eax, 1
jg 0x581707
or eax, 0xffffffff
jmp 0x581707
xor eax, eax
test eax, eax
jne 0x58170f
mov byte [esi + 0x28], 1
mov eax, dword [ebx + 0x14]
add eax, dword [ebx + 0x10]
cmp eax, dword [esi + 0x14]
jbe 0x58171d
mov dword [esi + 0x14], eax
mov eax, dword [esp + 0x10]
movzx edx, word [esi + 0x22]
add eax, 1
add ebx, 0x28
cmp eax, edx
mov dword [esp + 0x10], eax
jl 0x581680
pop ebp
pop ebx
pop edi
mov dword [esi], 0
mov al, 1
pop esi
pop ecx
ret
pop edi
mov dword [esi], str.unrecognized_magic
xor al, al
pop esi
pop ecx
ret
pop edi
mov dword [esi], str.no_PE_signature
xor al, al
pop esi
pop ecx
ret
pop edi
mov dword [esi], str.Bad_offset_to_PE_header
xor al, al
pop esi
pop ecx
ret
mov dword [esi], str.Not_MZ
xor al, al
pop esi
pop ecx
ret