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

Disassembly:
sub esp, 0x14
push ebp
mov ebp, dword [esp + 0x20]
push esi
push 0
mov esi, eax
call dword [sym.imp.KERNEL32.dll_SetLastError]
cmp dword [esp + 0x20], 0
je 0x40400c
push edi
push 0
push 0
push 3
push 0
push 1
push SysReAllocString
push 0x42ef10
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov edi, eax
cmp edi, 0xffffffff
mov dword [esp + 0xc], edi
jne 0x403ea6
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push 0x42ef10
push str.SaveFileBufferToFile_____1_CreateFile_lpSrcFilePath:___s___failed__error_code:__lu.
call fcn.0040b8f0
add esp, 0xc
pop edi
pop esi
xor eax, eax
pop ebp
add esp, 0x14
ret
push 0
push edi
call dword [sym.imp.KERNEL32.dll_GetFileSize]
cmp eax, 0xffffffff
jne 0x403edd
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push 0x42ef10
push str.SaveFileBufferToFile____2__GetFileSize_lpSrcFilePath:___s___failed__error_code:__lu.
call fcn.0040b8f0
add esp, 0xc
push edi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
pop edi
pop esi
xor eax, eax
pop ebp
add esp, 0x14
ret
lea ecx, [esi + ebp]
cmp eax, ecx
jae 0x403f04
push ebp
push esi
push eax
push str.SaveFileBufferToFile_____Invalid_file_size__dwSrcFileSize:__lu__dwSrcFileOffset:__lu__dwDstFileSize:__lu.
call fcn.0040b8f0
add esp, 0x10
push edi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
pop edi
pop esi
xor eax, eax
pop ebp
add esp, 0x14
ret
push 0
push 0
push esi
push edi
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov esi, 0x100000
cmp ebp, esi
jae 0x403f1b
mov esi, ebp
push ebx
push esi
call fcn.0040f590
add esp, 4
test ebp, ebp
mov ebx, eax
mov dword [esp + 0x20], 1
mov dword [esp + 0x14], 0
jbe 0x403ff9
nop
mov eax, ebp
sub eax, dword [esp + 0x14]
cmp esi, eax
jbe 0x403f4c
mov esi, eax
push 0
lea edx, [esp + 0x20]
push edx
push esi
push ebx
push edi
mov dword [esp + 0x30], 0
call dword [sym.imp.KERNEL32.dll_ReadFile]
mov edi, eax
test edi, edi
je 0x403fd2
cmp dword [esp + 0x1c], esi
jne 0x403fd2
mov ecx, dword [esp + 0x28]
push 0
lea eax, [esp + 0x1c]
push eax
push esi
push ebx
push ecx
mov dword [esp + 0x2c], 0
call dword [sym.imp.KERNEL32.dll_WriteFile]
mov edi, eax
test edi, edi
je 0x403fbd
cmp dword [esp + 0x18], esi
jne 0x403fbd
mov eax, dword [esp + 0x14]
mov edi, dword [esp + 0x10]
add eax, esi
cmp eax, ebp
mov dword [esp + 0x14], eax
jb 0x403f40
push edi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov eax, dword [esp + 0x20]
pop ebx
pop edi
pop esi
pop ebp
add esp, 0x14
ret
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov edx, dword [esp + 0x18]
push eax
push edx
push esi
push edi
push str.SaveFileBufferToFile_____WriteFile___failed__bWriteResult:__d__dwBufferSize:__lu__dwBytesWritten:__lu__error_code:__lu.
jmp 0x403fe5
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
mov eax, dword [esp + 0x20]
push eax
push esi
push edi
push str.SaveFileBufferToFile_____ReadFile___failed__bReadResult:__d__dwBufferSize:__lu__dwBytesRead:__lu__error_code:__lu.
call fcn.0040b8f0
mov edi, dword [esp + 0x24]
mov dword [esp + 0x34], 0
add esp, 0x14
push edi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov eax, dword [esp + 0x20]
pop ebx
pop edi
pop esi
pop ebp
add esp, 0x14
ret
pop esi
xor eax, eax
pop ebp
add esp, 0x14
ret