Function at 0x499230
Capabilities:
Get file size
Parse pe header
Read file on windows

Disassembly:
push ebp
lea ebp, [esp - 0x6c]
sub esp, 0x6c
push 0xfffffffffffffffe
push 0x4d1a38
push 0x43c120
mov eax, dword fs:[0]
push eax
sub esp, 0x118
mov eax, dword [0x4d7590]
xor dword [ebp - 8], eax
xor eax, ebp
mov dword [ebp + 0x68], eax
push ebx
push esi
push edi
push eax
lea eax, [ebp - 0x10]
mov dword fs:[0], eax
mov dword [ebp - 0x18], esp
mov eax, dword [ebp + 0x74]
mov ecx, dword [ebp + 0x78]
mov dword [ebp + 0x18], ecx
mov dword [ebp + 0x1c], 0
push 0
push 0
push 3
push 0
push 1
push SysReAllocString
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov esi, eax
cmp esi, 0xffffffff
je 0x499397
push 0
lea edx, [ebp + 0x24]
push edx
push 0x40
lea eax, [ebp + 0x28]
push eax
push esi
mov ebx, dword [sym.imp.KERNEL32.dll_ReadFile]
call ebx
test eax, eax
je 0x499390
cmp dword [ebp + 0x24], 0x40
jne 0x499390
mov ecx, 0x5a4d
cmp word [ebp + 0x28], cx
jne 0x499390
push 0
push 0
mov edx, dword [ebp + 0x64]
push edx
push esi
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
cmp eax, dword [ebp + 0x64]
jne 0x499390
push 0
lea eax, [ebp + 0x24]
push eax
push 0xf8
lea ecx, [ebp - 0x128]
push ecx
push esi
call ebx
test eax, eax
je 0x499390
cmp dword [ebp + 0x24], 0xf8
jne 0x499390
cmp dword [ebp - 0x128], 0x4550
jne 0x499390
cmp word [ebp - 0x122], 0
je 0x499390
mov eax, dword [ebp - 0xa0]
mov dword [ebp + 0x10], eax
mov edx, dword [ebp - 0x9c]
mov dword [ebp + 0x14], edx
test eax, eax
je 0x499390
push 0
push esi
call dword [sym.imp.KERNEL32.dll_GetFileSize]
mov dword [ebp + 0x24], eax
push 4
push 0x1000
push eax
push 0
call dword [sym.imp.KERNEL32.dll_VirtualAlloc]
mov edi, eax
mov dword [ebp + 0x20], edi
test edi, edi
je 0x499390
push 0
push 0
push 0
push esi
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
push 0
lea eax, [ebp + 0x24]
push eax
mov ecx, dword [ebp + 0x24]
push ecx
push edi
push esi
call ebx
test eax, eax
jne 0x4993b8
push 0x8000
push eax
push edi
call dword [sym.imp.KERNEL32.dll_VirtualFree]
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
xor eax, eax
mov ecx, dword [ebp - 0x10]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebx
mov ecx, dword [ebp + 0x68]
xor ecx, ebp
call fcn.00436eab
add ebp, 0x6c
mov esp, ebp
pop ebp
ret
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov dword [ebp - 4], 0
mov edx, dword [ebp + 0x64]
add edi, edx
push edi
mov ebx, dword [ebp + 0x10]
call fcn.00499040
add esp, 4
mov ebx, dword [ebp + 0x20]
add eax, ebx
lea edx, [eax + 0x10]
movzx ecx, word [eax + 0xe]
movzx esi, word [eax + 0xc]
add ecx, esi
mov dword [ebp + 0xc], ecx
mov dword [ebp], edx
mov esi, ecx
dec ecx
mov dword [ebp + 0xc], ecx
test esi, esi
je 0x4994ac
test dword [edx], 0x80000000
jne 0x4994bd
cmp word [edx], 0xa
jne 0x4994bd
mov ecx, dword [edx + 4]
and ecx, 0x7fffffff
add ecx, eax
lea esi, [ecx + 0x10]
movzx edx, word [ecx + 0xe]
movzx ecx, word [ecx + 0xc]
add edx, ecx
mov dword [ebp + 4], edx
mov dword [ebp + 8], esi
mov ecx, edx
dec edx
mov dword [ebp + 4], edx
test ecx, ecx
je 0x4994ac
mov ecx, 0x360
cmp word [esi], cx
jne 0x4994b5
mov esi, dword [esi + 4]
test esi, esi
jns 0x499457
and esi, 0x7fffffff
add esi, eax
mov esi, dword [esi + 0x14]
add esi, eax
xor eax, eax
mov dword [edi + 0x58], eax
mov dword [edi + 0x98], eax
mov dword [edi + 0x9c], eax
mov dword [ebp - 0x30], 0x18
mov dword [ebp - 0x2c], ebx
push edi
mov ebx, dword [ebp + 0x10]
call fcn.00499040
mov dword [ebp - 0x28], eax
mov edx, dword [ebp + 0x18]
mov dword [ebp - 0x24], edx
mov eax, dword [esi + 4]
mov dword [ebp - 0x1c], eax
push edi
mov ebx, dword [esi]
call fcn.00499040
add eax, dword [ebp + 0x20]
mov dword [ebp - 0x20], eax
lea ecx, [ebp - 0x30]
push ecx
call fcn.004990b0
add esp, 0xc
mov dword [ebp + 0x1c], eax
mov ebx, dword [ebp + 0x20]
mov dword [ebp - 4], 0xfffffffe
jmp 0x4994d8
add esi, 8
jmp 0x49942e
add edx, 8
jmp 0x4993ec
test ebx, ebx
je 0x4994ea
push 0x8000
push 0
push ebx
call dword [sym.imp.KERNEL32.dll_VirtualFree]
mov eax, dword [ebp + 0x1c]
jmp 0x499399