Function at 0x407800
Capabilities:
Get file size
Read file on windows
Write file on windows

Disassembly:
push 0xffffffffffffffff
push 0x46b5b0
mov eax, dword fs:[0]
push eax
sub esp, 0x68
mov eax, dword [0x4854a0]
xor eax, esp
mov dword [esp + 0x64], eax
push ebx
push ebp
push esi
mov eax, dword [0x4854a0]
xor eax, esp
push eax
lea eax, [esp + 0x78]
mov dword fs:[0], eax
push 4
mov ebx, 0xf
xor ebp, ebp
push str..bak
lea ecx, [esp + 0x24]
mov dword [esp + 0x3c], ebx
mov dword [esp + 0x38], ebp
mov byte [esp + 0x28], 0
call fcn.00403a90
mov dword [esp + 0x80], ebp
mov eax, dword [edi + 0x28]
add eax, 0xfffffffc
lea edx, [edi + 0x14]
push eax
xor ecx, ecx
lea esi, [esp + 0x40]
call fcn.00402520
lea ecx, [esp + 0x1c]
push ecx
push eax
lea esi, [esp + 0x60]
mov byte [esp + 0x88], 1
call fcn.004053a0
add esp, 8
mov esi, 0x10
cmp dword [esp + 0x54], esi
jb 0x4078a3
mov edx, dword [esp + 0x40]
push edx
call fcn.0041bf87
add esp, 4
mov dword [esp + 0x54], ebx
mov dword [esp + 0x50], ebp
mov byte [esp + 0x40], 0
mov byte [esp + 0x80], 4
cmp dword [esp + 0x34], esi
jb 0x4078cb
mov eax, dword [esp + 0x20]
push eax
call fcn.0041bf87
add esp, 4
cmp dword [esp + 0x70], esi
mov eax, dword [esp + 0x5c]
mov dword [esp + 0x34], ebx
mov dword [esp + 0x30], ebp
mov byte [esp + 0x20], 0
jae 0x4078e6
lea eax, [esp + 0x5c]
push ebp
push 0x80
push 3
push ebp
push 1
push SysReAllocStringLen
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileA]
mov esi, eax
cmp esi, 0xffffffff
je 0x407923
push ebp
lea edx, [esp + 0x18]
push edx
push 4
lea eax, [esp + 0x24]
push eax
push esi
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
jne 0x40793e
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
cmp dword [esp + 0x70], 0x10
jb 0x407937
mov ecx, dword [esp + 0x5c]
push ecx
call fcn.0041bf87
add esp, 4
xor eax, eax
jmp 0x407af1
cmp dword [esp + 0x14], 4
je 0x407967
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
cmp dword [esp + 0x70], 0x10
jb 0x407937
mov edx, dword [esp + 0x5c]
push edx
call fcn.0041bf87
add esp, 4
xor eax, eax
jmp 0x407af1
push ebp
push esi
call dword [sym.imp.KERNEL32.dll_GetFileSize]
mov ebp, eax
sub ebp, 4
push ebp
call fcn.0041bf8c
mov ebx, eax
add esp, 4
mov dword [esp + 0x38], ebx
push 0
lea eax, [esp + 0x18]
push eax
push ebp
push ebx
push esi
mov byte [esp + 0x94], 5
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
push esi
jne 0x4079bf
call dword [sym.imp.KERNEL32.dll_CloseHandle]
push ebx
call fcn.0041bf87
add esp, 4
lea ecx, [esp + 0x58]
call fcn.004024c0
xor eax, eax
jmp 0x407af1
cmp dword [esp + 0x18], ebp
jne 0x4079a0
mov esi, dword [sym.imp.KERNEL32.dll_CloseHandle]
call esi
mov ecx, dword [edi + 0x30]
push ecx
call esi
cmp dword [edi + 0x2c], 0x10
jb 0x4079de
mov eax, dword [edi + 0x18]
jmp 0x4079e1
lea eax, [edi + 0x18]
push 0
push 0x80
push 3
push 0
push 0
push 0x40000000
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileA]
cmp eax, 0xffffffff
mov dword [edi + 0x30], eax
je 0x4079a6
mov edx, dword [esp + 0x18]
push 0
push 0
push edx
push eax
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov ecx, dword [edi + 0x30]
push 0
lea eax, [esp + 0x14]
push eax
push ebp
push ebx
push ecx
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
jne 0x407a34
mov edx, dword [edi + 0x30]
push edx
call esi
jmp 0x4079a6
cmp dword [esp + 0x10], ebp
je 0x407a45
mov eax, dword [edi + 0x30]
push eax
call esi
jmp 0x4079a6
mov ecx, dword [edi + 0x30]
push ecx
call dword [sym.imp.KERNEL32.dll_SetEndOfFile]
mov edx, dword [edi]
mov eax, dword [esp + 0x18]
mov dword [edx + 0x10], eax
mov ecx, dword [edi]
push 0
push 0
mov byte [ecx + 0x14], 0xed
mov edx, dword [edi + 0x30]
push 0
push edx
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov ecx, dword [edi]
mov edx, dword [edi + 0x30]
push 0
lea eax, [esp + 0x14]
push eax
push 0x18
push ecx
push edx
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x407a3a
cmp dword [esp + 0x10], 0x18
je 0x407a9a
mov ecx, dword [edi + 0x30]
push ecx
call esi
jmp 0x4079a6
mov edx, dword [edi + 0x30]
push edx
call esi
cmp dword [edi + 0x2c], 0x10
jb 0x407aab
mov eax, dword [edi + 0x18]
jmp 0x407aae
lea eax, [edi + 0x18]
push 0
push 0x80
push 3
push 0
push 1
push SysReAllocStringLen
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileA]
cmp eax, 0xffffffff
mov dword [edi + 0x30], eax
je 0x4079a6
mov ecx, edi
call fcn.00407b10
push ebx
call fcn.0041bf87
add esp, 4
lea ecx, [esp + 0x58]
call fcn.004024c0
mov eax, 1
mov ecx, dword [esp + 0x78]
mov dword fs:[0], ecx
pop ecx
pop esi
pop ebp
pop ebx
mov ecx, dword [esp + 0x64]
xor ecx, esp
call fcn.00436f5b
add esp, 0x74
ret