Function at 0x403e51
Capabilities:
Check if file exists
Write file on windows

Disassembly:
push 0x678
mov eax, 0x4166df
call fcn.004084e1
mov ebx, edx
mov dword [ebp - 0x680], ebx
mov esi, ecx
mov dword [ebp - 0x67c], esi
mov eax, dword [ebp + 8]
push eax
lea eax, [ebp - 0x218]
push 0x41e150
push eax
call fcn.00404292
mov dword [ebp - 0x678], eax
xor edx, edx
xor eax, eax
mov dword [ebp - 0x66c], edx
add esp, 0xc
mov dword [ebp - 0x660], eax
cmp ebx, 0x1e
jbe 0x40428c
cmp dword [esi], 0x15145c61
je 0x403ebb
cmp dword [esi], 0x4034b50
jne 0x404286
movzx eax, word [esi + 0x1a]
movzx ecx, word [esi + 0x1c]
mov edi, dword [esi + 0x12]
add ecx, eax
add edi, 0x1e
mov eax, ebx
add edi, ecx
sub eax, edx
mov dword [ebp - 0x664], edi
cmp edi, eax
jg 0x404286
or dword [ebp - 0x670], 0xffffffff
xor ebx, ebx
or dword [ebp - 0x674], 0xffffffff
and dword [ebp - 0x668], ebx
cmp dword [esi + 0x16], 0x100000
jbe 0x403fb0
xor eax, eax
push 0x206
push eax
mov word [ebp - 0x628], ax
lea eax, [ebp - 0x626]
push eax
call fcn.00407b90
add esp, 0xc
lea ecx, [ebp - 0x628]
call fcn.00403d4b
xor eax, eax
push eax
push 0x4000100
push 2
push eax
push eax
push 0x10000000
lea eax, [ebp - 0x628]
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov edi, eax
mov dword [ebp - 0x670], edi
cmp edi, 0xffffffff
je 0x40423c
push ebx
push ebx
push dword [esi + 0x16]
push edi
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
push edi
call dword [sym.imp.KERNEL32.dll_SetEndOfFile]
xor eax, eax
push eax
push eax
push eax
push 4
push eax
push edi
call dword [sym.imp.KERNEL32.dll_CreateFileMappingW]
mov edi, eax
mov dword [ebp - 0x674], edi
cmp edi, 0xffffffff
je 0x40423c
xor eax, eax
push eax
push eax
push eax
push 0xf001f
push edi
call dword [sym.imp.KERNEL32.dll_MapViewOfFile]
mov edi, dword [ebp - 0x664]
mov dword [ebp - 0x668], 1
jmp 0x403fb9
push dword [esi + 0x16]
call fcn.0040665f
pop ecx
mov ebx, eax
test ebx, ebx
je 0x40422a
mov ecx, dword [esi + 0x12]
mov eax, edi
and dword [ebp - 0x65c], 0
sub eax, ecx
add eax, esi
cmp ecx, dword [esi + 0x16]
je 0x403ff7
lea edx, [ebp - 0x65c]
push edx
push dword [esi + 0x16]
mov edx, ecx
mov ecx, eax
push ebx
call fcn.00406394
mov edi, dword [ebp - 0x65c]
add esp, 0xc
jmp 0x404008
mov edi, dword [esi + 0xe]
push ecx
push eax
push dword [esi + 0x16]
push ebx
call fcn.00407a1f
add esp, 0x10
cmp dword [esi + 0xe], edi
jne 0x40422a
movzx eax, word [esi + 0x1a]
lea ecx, [ebp - 0x658]
and dword [ebp - 0x648], 0
push eax
lea eax, [esi + 0x1e]
mov dword [ebp - 0x644], 0xf
push eax
mov byte [ebp - 0x658], 0
call fcn.00401c7b
and dword [ebp - 4], 0
xor eax, eax
and dword [ebp - 0x630], 0
mov dword [ebp - 0x62c], 7
mov word [ebp - 0x640], ax
push 0x41e360
lea ecx, [ebp - 0x640]
mov byte [ebp - 4], 1
call fcn.0040192b
cmp dword [ebp - 0x644], 0x10
lea eax, [ebp - 0x658]
mov ecx, dword [ebp - 0x648]
cmovae eax, dword [ebp - 0x658]
xor edx, edx
push edx
push edx
push ecx
push eax
push edx
push 0xfde9
mov dword [ebp - 0x65c], ecx
call dword [sym.imp.KERNEL32.dll_MultiByteToWideChar]
mov edi, eax
test edi, edi
je 0x4040f1
push edi
lea ecx, [ebp - 0x640]
call fcn.00403847
cmp dword [ebp - 0x62c], 8
lea ecx, [ebp - 0x640]
push edi
cmovae ecx, dword [ebp - 0x640]
lea eax, [ebp - 0x658]
cmp dword [ebp - 0x644], 0x10
push ecx
push dword [ebp - 0x65c]
cmovae eax, dword [ebp - 0x658]
push eax
push 0
push 0xfde9
call dword [sym.imp.KERNEL32.dll_MultiByteToWideChar]
cmp dword [ebp - 0x62c], 8
lea eax, [ebp - 0x640]
mov ecx, dword [ebp - 0x678]
mov edi, 0x104
cmovae eax, dword [ebp - 0x640]
push eax
mov eax, edi
sub eax, ecx
push 0x41e0dc
push eax
lea eax, [ebp - 0x218]
lea eax, [eax + ecx*2]
push eax
call fcn.00406735
lea eax, [ebp - 0x218]
add esp, 0x10
test eax, eax
je 0x404160
xor eax, eax
movzx ecx, word [ebp + eax*2 - 0x218]
xor edx, edx
cmp dx, cx
je 0x404160
push 0x2f
pop edx
cmp dx, cx
jne 0x40415b
push 0x5c
pop ecx
mov word [ebp + eax*2 - 0x218], cx
inc eax
cmp eax, edi
jl 0x404139
xor eax, eax
push 0x206
push eax
mov word [ebp - 0x420], ax
lea eax, [ebp - 0x41e]
push eax
call fcn.00407b90
add esp, 0xc
lea eax, [ebp - 0x218]
push eax
lea eax, [ebp - 0x420]
push edi
push eax
call fcn.00407261
add esp, 0xc
lea eax, [ebp - 0x420]
push eax
call dword [sym.imp.SHLWAPI.dll_PathRemoveFileSpecW]
lea eax, [ebp - 0x420]
push eax
call dword [sym.imp.SHLWAPI.dll_PathFileExistsW]
test eax, eax
jne 0x4041c2
lea eax, [ebp - 0x420]
push eax
push 0
call dword [sym.imp.SHELL32.dll_SHCreateDirectory]
xor eax, eax
push eax
push 0x80
push 2
push eax
push eax
push 0x40000000
lea eax, [ebp - 0x218]
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov edi, eax
cmp edi, 0xffffffff
je 0x404202
push 0
lea eax, [ebp - 0x684]
push eax
push dword [esi + 0x16]
push ebx
push edi
call dword [sym.imp.KERNEL32.dll_WriteFile]
push edi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
inc dword [ebp - 0x660]
lea ecx, [ebp - 0x640]
push 0
push 1
call fcn.0040185f
or dword [ebp - 4], 0xffffffff
lea ecx, [ebp - 0x658]
push 0
push 1
call fcn.00401c37
cmp dword [ebp - 0x668], 0
je 0x40423c
push ebx
call dword [sym.imp.KERNEL32.dll_UnmapViewOfFile]
jmp 0x404243
push ebx
call fcn.00406f88
pop ecx
push dword [ebp - 0x674]
mov edi, dword [sym.imp.KERNEL32.dll_CloseHandle]
call edi
push dword [ebp - 0x670]
call edi
mov edx, dword [ebp - 0x66c]
add edx, dword [ebp - 0x664]
mov ebx, dword [ebp - 0x680]
mov ecx, ebx
mov esi, dword [ebp - 0x67c]
sub ecx, edx
add esi, edx
mov dword [ebp - 0x66c], edx
cmp ecx, 0x1e
ja 0x403ea7
mov eax, dword [ebp - 0x660]
call fcn.0040849f
ret