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

Disassembly:
sub esp, 0x14
push esi
mov esi, eax
test esi, esi
je 0x403e34
cmp dword [esp + 0x1c], 0
je 0x403e34
push ebx
mov ebx, dword [sym.imp.KERNEL32.dll_CreateFileW]
push ebp
push 0
push 0
push 3
push 0
push 1
push SysReAllocString
push esi
call ebx
mov ebp, eax
cmp ebp, 0xffffffff
jne 0x403c78
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push esi
push str.SaveFileBufferAsFile_____CreateFile_lpSrcFilePath:___s___failed__error_code:__lu.
call fcn.0040b8f0
add esp, 0xc
pop ebp
pop ebx
xor eax, eax
pop esi
add esp, 0x14
ret
push 0
push ebp
call dword [sym.imp.KERNEL32.dll_GetFileSize]
cmp eax, 0xffffffff
jne 0x403cab
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push esi
push str.SaveFileBufferAsFile_____GetFileSize_lpSrcFilePath:___s___failed__error_code:__lu.
call fcn.0040b8f0
add esp, 0xc
push ebp
call dword [sym.imp.KERNEL32.dll_CloseHandle]
pop ebp
pop ebx
xor eax, eax
pop esi
add esp, 0x14
ret
mov ecx, dword [esp + 0x28]
push edi
mov edi, dword [esp + 0x30]
lea edx, [ecx + edi]
cmp eax, edx
jae 0x403cdc
push edi
push ecx
push eax
push str.SaveFileBufferAsFile_____Invalid_file_size__dwSrcFileSize:__lu__dwSrcFileOffset:__lu__dwDstFileSize:__lu.
call fcn.0040b8f0
add esp, 0x10
push ebp
call dword [sym.imp.KERNEL32.dll_CloseHandle]
pop edi
pop ebp
pop ebx
xor eax, eax
pop esi
add esp, 0x14
ret
push 0
push 0
push ecx
push ebp
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov esi, dword [esp + 0x28]
push 0
push 0x80
push 2
push 0
push 1
push 0x40000000
push esi
call ebx
cmp eax, 0xffffffff
mov dword [esp + 0x20], eax
jne 0x403d42
push ebp
call dword [sym.imp.KERNEL32.dll_CloseHandle]
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 0x20
jne 0x403d29
pop edi
pop ebp
pop ebx
mov eax, 1
pop esi
add esp, 0x14
ret
push eax
push esi
push str.SaveFileBufferAsFile_____CreateFile_lpDstFilePath:___s___failed__error_code:__lu.
call fcn.0040b8f0
add esp, 0xc
pop edi
pop ebp
pop ebx
xor eax, eax
pop esi
add esp, 0x14
ret
mov esi, 0x100000
cmp edi, esi
jae 0x403d4d
mov esi, edi
push esi
call fcn.0040f590
add esp, 4
test edi, edi
mov ebx, eax
mov dword [esp + 0x1c], 1
mov dword [esp + 0x10], 0
jbe 0x403e18
jmp 0x403d76
mov edi, dword [esp + 0x30]
mov eax, edi
sub eax, dword [esp + 0x10]
cmp esi, eax
jbe 0x403d82
mov esi, eax
push 0
lea eax, [esp + 0x1c]
push eax
push esi
push ebx
push ebp
mov dword [esp + 0x2c], 0
call dword [sym.imp.KERNEL32.dll_ReadFile]
mov edi, eax
test edi, edi
je 0x403df5
cmp dword [esp + 0x18], esi
jne 0x403df5
mov edx, dword [esp + 0x20]
push 0
lea ecx, [esp + 0x18]
push ecx
push esi
push ebx
push edx
mov dword [esp + 0x28], 0
call dword [sym.imp.KERNEL32.dll_WriteFile]
mov edi, eax
test edi, edi
je 0x403de0
cmp dword [esp + 0x14], esi
jne 0x403de0
mov eax, dword [esp + 0x10]
add eax, esi
cmp eax, dword [esp + 0x30]
mov dword [esp + 0x10], eax
jb 0x403d72
jmp 0x403e18
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
mov eax, dword [esp + 0x18]
push eax
push esi
push edi
push str.SaveFileBufferAsFile_____WriteFile___failed__bWriteResult:__d__dwBufferSize:__lu__dwBytesWritten:__lu__error_code:__lu.
jmp 0x403e08
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov ecx, dword [esp + 0x18]
push eax
push ecx
push esi
push edi
push str.SaveFileBufferAsFile_____ReadFile___failed__bReadResult:__d__dwBufferSize:__lu__dwBytesRead:__lu__error_code:__lu.
call fcn.0040b8f0
mov dword [esp + 0x30], 0
add esp, 0x14
mov esi, dword [sym.imp.KERNEL32.dll_CloseHandle]
push ebp
call esi
mov edx, dword [esp + 0x20]
push edx
call esi
mov eax, dword [esp + 0x1c]
pop edi
pop ebp
pop ebx
pop esi
add esp, 0x14
ret
xor eax, eax
pop esi
add esp, 0x14
ret