Function at 0x408240
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 0x4084c3
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 0x4084bc
cmp word [esp + 0x54], 0x5a4d
jne 0x4084bc
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 0x4084bc
lea ecx, [esp + 0x10]
push 0
push ecx
lea edx, [esp + 0x9c]
push 0xf8
push edx
push ebp
call esi
test eax, eax
je 0x4084bc
cmp dword [esp + 0x94], 0x4550
jne 0x4084bc
cmp word [esp + 0x9a], 0
je 0x4084bc
push 0x1000
mov dword [esp + 0x1c], 0
call sub.MSVCRT.dll_void____cdecl_operator_new_unsigned_int_
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 0x408470
lea ecx, [esp + 0x10]
push 0
push ecx
lea edx, [esp + 0x34]
push 0x28
push edx
push ebp
call esi
test eax, eax
je 0x408497
cmp dword [esp + 0x10], 0x28
jne 0x408497
mov eax, dword [esp + 0x194]
test eax, eax
je 0x4083ac
mov ecx, 2
lea edi, [esp + 0x2c]
mov esi, eax
xor edx, edx
repe cmpsd dword [esi], dword es:[edi]
je 0x4083a6
lea ecx, [esp + 0x2c]
push 8
push ecx
push eax
call dword [sym.imp.MSVCRT.dll__mbsnbcmp]
add esp, 0xc
test eax, eax
jne 0x40843d
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 0x40842f
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 0x40842f
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 0x40842f
cmp ecx, dword [esp + 0x20]
je 0x408468
mov dl, byte [ecx]
cmp dl, byte [eax]
jne 0x408414
inc eax
inc ecx
jmp 0x408425
mov edx, dword [esp + 0x198]
mov edi, edx
sub edi, ecx
mov ecx, edx
lea eax, [eax + edi + 1]
cmp eax, esi
jb 0x408404
mov edi, dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov eax, dword [esp + 0x1c]
push 0
push 0
push eax
push ebp
call edi
jmp 0x408443
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 0x408470
mov esi, dword [sym.imp.KERNEL32.dll_ReadFile]
jmp 0x40834d
mov dword [esp + 0x18], 1
push ebp
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov al, byte [esp + 0x24]
test al, al
je 0x408488
push ebx
call fcn.00414a60
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 0x4084c3
push ebx
call fcn.00414a60
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