Function at 0x407420
Capabilities:
Parse pe header
Read file on windows

Disassembly:
sub esp, 0x17c
mov eax, dword [esp + 0x180]
push ebx
push ebp
push esi
push edi
push 0
push 0
push 3
push 0
push 3
push 0x80000000
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileA]
mov ebp, eax
cmp ebp, 0xffffffff
je 0x4076a2
mov esi, dword [sym.imp.KERNEL32.dll_ReadFile]
lea ecx, [esp + 0x10]
push 0
push ecx
lea edx, [esp + 0x5c]
push 0x40
push edx
push ebp
call esi
test eax, eax
je 0x40769b
cmp word [esp + 0x54], 0x5a4d
jne 0x40769b
mov eax, dword [esp + 0x90]
mov edi, dword [sym.imp.KERNEL32.dll_SetFilePointer]
push 0
push 0
push eax
push ebp
call edi
cmp eax, dword [esp + 0x90]
jne 0x40769b
lea ecx, [esp + 0x10]
push 0
push ecx
lea edx, [esp + 0x9c]
push pe_nt_image_headers32
push edx
push ebp
call esi
test eax, eax
je 0x40769b
cmp dword [esp + 0x94], 0x4550
jne 0x40769b
cmp word [esp + 0x9a], 0
je 0x40769b
push 0x1000
mov dword [esp + 0x1c], 0
call fcn.00408443
mov ebx, eax
mov eax, dword [esp + 0xac]
add esp, 4
test ebx, ebx
setne byte [esp + 0x24]
and eax, 0xffff
push 1
sub eax, 0xe0
push 0
push eax
push ebp
call edi
cmp word [esp + 0x9a], 0
mov dword [esp + 0x14], 0
jbe 0x40764f
lea ecx, [esp + 0x10]
push 0
push ecx
lea edx, [esp + 0x34]
push 0x28
push edx
push ebp
call esi
test eax, eax
je 0x407676
cmp dword [esp + 0x10], 0x28
jne 0x407676
mov eax, dword [esp + 0x194]
test eax, eax
je 0x40758b
mov ecx, 2
lea edi, [esp + 0x2c]
mov esi, eax
xor edx, edx
repe cmpsd dword [esi], dword es:[edi]
je 0x407585
lea ecx, [esp + 0x2c]
push 8
push ecx
push eax
call fcn.0040958f
add esp, 0xc
test eax, eax
jne 0x40761c
mov edi, dword [sym.imp.KERNEL32.dll_SetFilePointer]
push 0
push 0
push 0
push ebp
call edi
mov edx, dword [esp + 0x40]
push 0
push 0
push edx
push ebp
mov dword [esp + 0x2c], eax
call edi
cmp eax, dword [esp + 0x40]
jne 0x40760e
lea eax, [esp + 0x10]
push 0
push eax
push 0x1000
push ebx
push ebp
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x40760e
mov ecx, dword [esp + 0x10]
mov edx, dword [esp + 0x19c]
mov eax, ebx
lea esi, [ebx + ecx]
mov ecx, dword [esp + 0x198]
add edx, ecx
cmp ebx, esi
mov dword [esp + 0x20], edx
jae 0x40760e
cmp ecx, dword [esp + 0x20]
je 0x407647
mov dl, byte [ecx]
cmp dl, byte [eax]
jne 0x4075f3
inc eax
inc ecx
jmp 0x407604
mov edx, dword [esp + 0x198]
mov edi, edx
sub edi, ecx
mov ecx, edx
lea eax, [eax + edi + 1]
cmp eax, esi
jb 0x4075e3
mov edi, dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov eax, dword [esp + 0x1c]
push 0
push 0
push eax
push ebp
call edi
jmp 0x407622
mov edi, dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov eax, dword [esp + 0x14]
mov ecx, dword [esp + 0x9a]
inc eax
and ecx, 0xffff
cmp eax, ecx
mov dword [esp + 0x14], eax
jae 0x40764f
mov esi, dword [sym.imp.KERNEL32.dll_ReadFile]
jmp 0x40752d
mov dword [esp + 0x18], 1
push ebp
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov al, byte [esp + 0x24]
test al, al
je 0x407667
push ebx
call fcn.004080ac
add esp, 4
mov eax, dword [esp + 0x18]
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x17c
ret
push ebp
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov al, byte [esp + 0x24]
test al, al
je 0x4076a2
push ebx
call fcn.004080ac
add esp, 4
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x17c
ret
push ebp
call dword [sym.imp.KERNEL32.dll_CloseHandle]
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 0x17c
ret