Function at 0x10005020
Capabilities:
Parse pe header
Read file on windows
Read file via mapping

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x48
mov eax, dword [0x10040a9c]
xor eax, ebp
mov dword [ebp - 4], eax
mov eax, dword [ebp + 8]
mov ecx, dword [ebp + 0xc]
mov edx, dword [ebp + 0x10]
push esi
push 0
push 0
push 3
push 0
push 1
push connect
push eax
mov dword [ebp - 0x44], ecx
mov dword [ebp - 0x40], edx
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov esi, eax
cmp esi, 0xffffffff
je 0x10005073
lea eax, [ebp - 0x38]
push eax
push esi
call dword [sym.imp.KERNEL32.dll_GetFileInformationByHandle]
test eax, eax
jne 0x10005086
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
xor al, al
pop esi
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.1000f795
mov esp, ebp
pop ebp
ret 0xc
mov ecx, dword [ebp - 0x14]
mov edx, dword [ebp - 0x18]
push edi
push 0
push ecx
push edx
push 2
push 0
push esi
call dword [sym.imp.KERNEL32.dll_CreateFileMappingA]
mov edi, eax
mov dword [ebp - 0x3c], edi
test edi, edi
jne 0x100050c0
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
pop edi
xor al, al
pop esi
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.1000f795
mov esp, ebp
pop ebp
ret 0xc
mov eax, dword [ebp - 0x14]
push ebx
push eax
push 0
push 0
push 4
push edi
call dword [sym.imp.KERNEL32.dll_MapViewOfFile]
mov ebx, eax
test ebx, ebx
je 0x100050e9
mov ecx, 0x5a4d
cmp word [ebx], cx
je 0x1000510a
push ebx
call dword [sym.imp.KERNEL32.dll_UnmapViewOfFile]
push edi
mov edi, dword [sym.imp.KERNEL32.dll_CloseHandle]
call edi
push esi
call edi
pop ebx
pop edi
xor al, al
pop esi
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.1000f795
mov esp, ebp
pop ebp
ret 0xc
mov edi, dword [ebx + 0x3c]
add edi, ebx
cmp dword [edi], 0x4550
jne 0x10005187
movzx eax, word [edi + 4]
mov ecx, 0x14c
cmp ax, cx
je 0x1000512f
mov edx, 0x8664
cmp ax, dx
jne 0x10005142
mov ecx, dword [edi + 0x28]
mov edx, dword [edi + 0x34]
push ecx
push edx
push edi
call dword [sym.imp.dbghelp.dll_ImageRvaToSection]
test eax, eax
jne 0x1000516d
push ebx
call dword [sym.imp.KERNEL32.dll_UnmapViewOfFile]
mov eax, dword [ebp - 0x3c]
mov edi, dword [sym.imp.KERNEL32.dll_CloseHandle]
push eax
call edi
push esi
call edi
pop ebx
pop edi
xor al, al
pop esi
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.1000f795
mov esp, ebp
pop ebp
ret 0xc
mov ecx, dword [eax + 0x14]
sub ecx, dword [eax + 0xc]
push 0
add ecx, dword [edi + 0x28]
push 0
push ecx
push esi
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
cmp eax, 0xffffffff
jne 0x100051b2
push ebx
call dword [sym.imp.KERNEL32.dll_UnmapViewOfFile]
mov edx, dword [ebp - 0x3c]
mov edi, dword [sym.imp.KERNEL32.dll_CloseHandle]
push edx
call edi
push esi
call edi
pop ebx
pop edi
xor al, al
pop esi
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.1000f795
mov esp, ebp
pop ebp
ret 0xc
mov ecx, dword [ebp - 0x40]
push 0
lea eax, [ebp - 0x48]
push eax
push 0x20
push ecx
push esi
mov dword [ebp - 0x48], 0
call dword [sym.imp.KERNEL32.dll_ReadFile]
push ebx
test eax, eax
je 0x10005188
mov eax, dword [edi + 0x28]
add eax, dword [edi + 0x34]
mov ecx, dword [ebp - 0x44]
mov dword [ecx], eax
call dword [sym.imp.KERNEL32.dll_UnmapViewOfFile]
mov edx, dword [ebp - 0x3c]
mov edi, dword [sym.imp.KERNEL32.dll_CloseHandle]
push edx
call edi
push esi
call edi
mov ecx, dword [ebp - 4]
pop ebx
pop edi
xor ecx, ebp
mov al, 1
pop esi
call fcn.1000f795
mov esp, ebp
pop ebp
ret 0xc