Function at 0x40f790
Capabilities:
Get file size
Parse pe header

Disassembly:
push 0xffffffffffffffff
push 0x46a380
mov eax, dword fs:[0]
push eax
sub esp, 0x44
push ebx
push ebp
push esi
push edi
mov eax, dword [0x486668]
xor eax, esp
push eax
lea eax, [esp + 0x58]
mov dword fs:[0], eax
xor ebp, ebp
xor edi, edi
mov dword [esp + 0x2c], ebp
mov dword [esp + 0x1c], edi
mov eax, dword [esp + 0x6c]
push ebp
push 0x80
push 3
push ebp
mov ebx, 1
push ebx
push SysReAllocStringLen
push eax
mov dword [esp + 0x7c], ebp
call dword [sym.imp.KERNEL32.dll_CreateFileW]
cmp eax, 0xffffffff
jne 0x40f890
call fcn.0040fc90
cmp eax, ebp
je 0x40f896
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
lea ecx, [esp + 0x28]
push 0x4781dc
push ecx
call fcn.004073f0
add esp, 0xc
mov esi, eax
lea edx, [esp + 0x18]
push 0x87
push edx
mov byte [esp + 0x68], bl
call fcn.004066e0
push esi
mov esi, dword [esp + 0x74]
push eax
push esi
mov byte [esp + 0x74], 2
call fcn.00407a50
mov byte [esp + 0x74], bl
mov eax, dword [esp + 0x2c]
add eax, 0xfffffff0
add esp, 0x14
lea ecx, [eax + 0xc]
or edx, 0xffffffff
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x40f862
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
mov byte [esp + 0x60], 0
mov eax, dword [esp + 0x24]
add eax, 0xfffffff0
lea ecx, [eax + 0xc]
or edx, 0xffffffff
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x40fb55
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
jmp 0x40fb55
mov edi, eax
mov dword [esp + 0x1c], edi
mov dword [esp + 0x34], ebp
mov dword [esp + 0x3c], ebp
lea ecx, [esp + 0x30]
push ecx
mov byte [esp + 0x64], 3
push edi
xor esi, esi
mov dword [esp + 0x38], ebp
call dword [sym.imp.KERNEL32.dll_GetFileSize]
cmp eax, 0xffffffff
mov dword [esp + 0x2c], eax
jne 0x40f8cb
call fcn.0040fc90
cmp eax, ebp
jl 0x40f8e1
mov eax, dword [esp + 0x2c]
cmp eax, 0x100000
mov edx, dword [esp + 0x30]
mov esi, eax
mov dword [esp + 0x30], edx
jbe 0x40f8e1
mov esi, 0x100000
mov ebx, 4
push ebx
push 2
push ebp
push ebp
push esi
push edi
lea ecx, [esp + 0x4c]
call fcn.0040fbb0
test eax, eax
je 0x40f9a6
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
lea eax, [esp + 0x1c]
push 0x4781dc
push eax
call fcn.004073f0
add esp, 0xc
mov esi, eax
lea ecx, [esp + 0x24]
push 0x87
push ecx
mov byte [esp + 0x68], bl
call fcn.004066e0
push esi
mov esi, dword [esp + 0x74]
push eax
push esi
mov byte [esp + 0x74], 5
call fcn.00407a50
mov byte [esp + 0x74], bl
mov eax, dword [esp + 0x38]
add eax, 0xfffffff0
add esp, 0x14
lea edx, [eax + 0xc]
or ecx, 0xffffffff
lock xadd dword [edx], ecx
dec ecx
test ecx, ecx
jg 0x40f964
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
mov byte [esp + 0x60], 3
mov eax, dword [esp + 0x18]
add eax, 0xfffffff0
lea ecx, [eax + 0xc]
or edx, 0xffffffff
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x40f989
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
lea ecx, [esp + 0x34]
call fcn.0040fcb0
cmp edi, ebp
je 0x40fb55
push edi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
jmp 0x40fb55
mov ecx, dword [esp + 0x34]
cmp word [ecx], 0x5a4d
je 0x40f9c3
mov esi, dword [esp + 0x68]
push 0x4783a0
mov ecx, esi
call fcn.00403710
jmp 0x40f989
mov eax, dword [ecx + 0x3c]
add eax, ecx
cmp dword [eax], 0x4550
je 0x40f9e2
mov esi, dword [esp + 0x68]
push str.Invalid_PE_signature.
mov ecx, esi
call fcn.00403710
jmp 0x40f989
mov ecx, dword [eax + 0x98]
cmp ecx, ebp
je 0x40f9f8
mov esi, dword [eax + 0x9c]
add esi, ecx
xor edi, edi
jmp 0x40fa4f
lea ecx, [esp + 0x18]
call fcn.00407c90
mov eax, dword [esp + 0x6c]
lea ecx, [esp + 0x24]
push ecx
lea edx, [esp + 0x1c]
push edx
push str._MGX_VERIFY
mov byte [esp + 0x6c], 6
push eax
mov dword [esp + 0x34], ebp
call fcn.0045e950
add esp, 0x10
cmp eax, ebp
jne 0x40fb2a
mov eax, dword [esp + 0x18]
cmp dword [eax - 0xc], 8
jne 0x40fb2a
mov esi, dword [eax]
mov edi, dword [eax + 4]
lea ecx, [esp + 0x18]
mov byte [esp + 0x60], 3
call fcn.00407c70
mov ecx, dword [esp + 0x6c]
call fcn.0040fb70
mov ebx, eax
cmp esi, ebx
mov ebp, edx
jne 0x40fa79
cmp edi, ebp
jne 0x40fa79
mov esi, dword [esp + 0x68]
push 0x477ce4
mov ecx, esi
call fcn.00403710
jmp 0x40fb43
lea ecx, [esp + 0x2c]
push 0xa2
push ecx
call fcn.004066e0
push ebp
push ebx
push edi
mov byte [esp + 0x74], 7
mov eax, dword [eax]
push esi
push eax
lea edx, [esp + 0x44]
push edx
call fcn.004073f0
mov esi, eax
lea eax, [esp + 0x38]
push 0x9b
push eax
mov byte [esp + 0x88], 8
call fcn.004066e0
push 0x477e10
push eax
lea ecx, [esp + 0x54]
push ecx
mov byte [esp + 0x94], 9
call fcn.00405740
add esp, 0x34
push esi
push eax
lea edx, [esp + 0x28]
push edx
mov byte [esp + 0x6c], 0xa
call fcn.00407a50
add esp, 0xc
lea ecx, [esp + 0x24]
call fcn.00407c70
lea ecx, [esp + 0x18]
call fcn.00407c70
lea ecx, [esp + 0x28]
call fcn.00407c70
lea ecx, [esp + 0x2c]
mov byte [esp + 0x60], 0xf
call fcn.00407c70
mov esi, dword [esp + 0x68]
lea eax, [esp + 0x20]
push eax
mov ecx, esi
call fcn.004036f0
lea ecx, [esp + 0x20]
call fcn.00407c70
jmp 0x40fb43
mov esi, dword [esp + 0x68]
push str.Resource__MGX_VERIFY_is_not_found.
mov ecx, esi
call fcn.00403710
lea ecx, [esp + 0x18]
call fcn.00407c70
lea ecx, [esp + 0x34]
call fcn.0040fcb0
lea ecx, [esp + 0x1c]
call fcn.0040fd00
mov eax, esi
mov ecx, dword [esp + 0x58]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x50
ret