Function at 0x4064a0
Capabilities:
Check if file exists
Get file attributes
Get file size
Read file on windows
Write file on windows

Disassembly:
push ebp
mov ebp, esp
push 0xffffffffffffffff
push 0x4c8b68
mov eax, dword fs:[0]
push eax
sub esp, 0x3e0
mov eax, dword [0x4fad60]
xor eax, ebp
mov dword [ebp - 0x10], eax
push ebx
push esi
push edi
push eax
lea eax, [ebp - 0xc]
mov dword fs:[0], eax
push 1
push 0x4ddb10
lea eax, [ebp + 8]
push eax
xor eax, eax
mov dword [ebp - 4], 1
call fcn.00407340
push eax
xor ecx, ecx
lea esi, [ebp - 0x354]
lea edx, [ebp + 8]
call fcn.004070a0
push 1
push 0x4ddb10
lea ecx, [ebp + 8]
push ecx
xor eax, eax
mov byte [ebp - 4], 2
call fcn.00407340
mov edx, dword [ebp + 0x18]
push edx
lea ecx, [eax + 1]
lea esi, [ebp - 0x38c]
lea edx, [ebp + 8]
call fcn.004070a0
mov byte [ebp - 4], 3
cmp dword [ebp - 0x340], 8
mov ecx, dword [ebp - 0x354]
jae 0x40653c
lea ecx, [ebp - 0x354]
lea ebx, [ebp - 0x370]
call fcn.00405100
sub esp, 0x1c
mov ecx, esp
mov bl, 4
mov byte [ebp - 4], bl
mov dword [ebp - 0x3e4], esp
xor esi, esi
xor eax, eax
mov edi, 7
mov dword [ecx + 0x14], edi
mov dword [ecx + 0x10], esi
push esi
lea edx, [ebp - 0x38c]
mov word [ecx], ax
push edx
or eax, 0xffffffff
call fcn.00404570
sub esp, 0x1c
mov ecx, esp
mov byte [ebp - 4], 5
mov dword [ebp - 0x3ec], esp
xor eax, eax
mov dword [ecx + 0x14], edi
mov dword [ecx + 0x10], esi
push esi
lea edx, [ebp - 0x370]
mov word [ecx], ax
push edx
or eax, 0xffffffff
call fcn.00404570
mov byte [ebp - 4], bl
lea ebx, [ebp - 0x338]
call fcn.00405340
add esp, 0x38
xor ebx, ebx
mov byte [ebp - 4], 6
cmp dword [ebp - 0x328], ebx
jne 0x4066b5
mov esi, 8
cmp dword [ebp - 0x324], esi
jb 0x4065e2
mov eax, dword [ebp - 0x338]
push eax
call fcn.00490a16
add esp, 4
xor ecx, ecx
mov edi, 7
mov dword [ebp - 0x324], edi
mov dword [ebp - 0x328], ebx
mov word [ebp - 0x338], cx
cmp dword [ebp - 0x35c], esi
jb 0x406613
mov edx, dword [ebp - 0x370]
push edx
call fcn.00490a16
add esp, 4
xor eax, eax
mov dword [ebp - 0x35c], edi
mov dword [ebp - 0x360], ebx
mov word [ebp - 0x370], ax
cmp dword [ebp - 0x378], esi
jb 0x40663f
mov ecx, dword [ebp - 0x38c]
push ecx
call fcn.00490a16
add esp, 4
xor edx, edx
mov dword [ebp - 0x378], edi
mov dword [ebp - 0x37c], ebx
mov word [ebp - 0x38c], dx
cmp dword [ebp - 0x340], esi
jb 0x40666b
mov eax, dword [ebp - 0x354]
push eax
call fcn.00490a16
add esp, 4
xor ecx, ecx
mov dword [ebp - 0x340], edi
mov dword [ebp - 0x344], ebx
mov word [ebp - 0x354], cx
cmp dword [ebp + 0x1c], esi
jb 0x406691
mov edx, dword [ebp + 8]
push edx
call fcn.00490a16
add esp, 4
xor eax, eax
mov dword [ebp + 0x1c], edi
mov dword [ebp + 0x18], ebx
mov word [ebp + 8], ax
cmp dword [ebp + 0x38], esi
jb 0x4066ae
mov ecx, dword [ebp + 0x24]
push ecx
call fcn.00490a16
add esp, 4
xor eax, eax
jmp 0x406d46
push 0x208
lea edx, [ebp - 0x31c]
push ebx
push edx
call fcn.00497ad0
mov eax, dword [ebp + 0x24]
mov edi, 8
add esp, 0xc
cmp dword [ebp + 0x38], edi
jae 0x4066da
lea eax, [ebp + 0x24]
lea edx, [ebp - 0x31c]
sub edx, eax
movzx ecx, word [eax]
mov word [edx + eax], cx
add eax, 2
cmp cx, bx
jne 0x4066e2
lea eax, [ebp - 0x31c]
push 0x5c
push eax
call fcn.00491576
mov ecx, dword [ebp - 0x338]
add esp, 8
cmp dword [ebp - 0x324], edi
jae 0x406716
lea ecx, [ebp - 0x338]
lea edx, [eax + 2]
sub edx, ecx
jmp 0x406720
movzx eax, word [ecx]
mov word [edx + ecx], ax
add ecx, 2
cmp ax, bx
jne 0x406720
lea ecx, [ebp - 0x31c]
push ecx
call dword [sym.imp.KERNEL32.dll_GetFileAttributesW]
cmp eax, 0xffffffff
je 0x40674f
shr eax, 4
not eax
and eax, 1
jne 0x40683d
cmp dword [ebp - 0x324], edi
jb 0x406766
mov edx, dword [ebp - 0x338]
push edx
call fcn.00490a16
add esp, 4
xor eax, eax
mov esi, 7
mov dword [ebp - 0x324], esi
mov dword [ebp - 0x328], ebx
mov word [ebp - 0x338], ax
cmp dword [ebp - 0x35c], edi
jb 0x406797
mov ecx, dword [ebp - 0x370]
push ecx
call fcn.00490a16
add esp, 4
xor edx, edx
mov dword [ebp - 0x35c], esi
mov dword [ebp - 0x360], ebx
mov word [ebp - 0x370], dx
cmp dword [ebp - 0x378], edi
jb 0x4067c3
mov eax, dword [ebp - 0x38c]
push eax
call fcn.00490a16
add esp, 4
xor ecx, ecx
mov dword [ebp - 0x378], esi
mov dword [ebp - 0x37c], ebx
mov word [ebp - 0x38c], cx
cmp dword [ebp - 0x340], edi
jb 0x4067ef
mov edx, dword [ebp - 0x354]
push edx
call fcn.00490a16
add esp, 4
xor eax, eax
mov dword [ebp - 0x340], esi
mov dword [ebp - 0x344], ebx
mov word [ebp - 0x354], ax
cmp dword [ebp + 0x1c], edi
jb 0x406815
mov ecx, dword [ebp + 8]
push ecx
call fcn.00490a16
add esp, 4
xor edx, edx
mov dword [ebp + 0x1c], esi
mov dword [ebp + 0x18], ebx
mov word [ebp + 8], dx
cmp dword [ebp + 0x38], edi
jb 0x4066ae
mov eax, dword [ebp + 0x24]
push eax
call fcn.00490a16
add esp, 4
xor eax, eax
jmp 0x406d46
mov edi, 7
xor ecx, ecx
lea eax, [ebp - 0x31c]
mov dword [ebp - 0x3b0], edi
mov dword [ebp - 0x3b4], ebx
mov word [ebp - 0x3c4], cx
lea edx, [eax + 2]
mov cx, word [eax]
add eax, 2
cmp cx, bx
jne 0x406860
sub eax, edx
sar eax, 1
push eax
lea eax, [ebp - 0x31c]
lea esi, [ebp - 0x3c4]
call fcn.00403e70
mov byte [ebp - 4], 7
xor edx, edx
push edi
mov eax, str.acad.rx
lea esi, [ebp - 0x3e0]
mov dword [ebp - 0x3cc], edi
mov dword [ebp - 0x3d0], ebx
mov word [ebp - 0x3e0], dx
call fcn.00403e70
mov byte [ebp - 4], 8
call fcn.00408dc0
add eax, 0x1b0
push eax
mov edx, esi
lea ecx, [ebp - 0x3a8]
call fcn.0044e150
add esp, 4
mov byte [ebp - 4], 0xa
cmp dword [ebp - 0x3cc], 8
jb 0x4068e6
mov eax, dword [ebp - 0x3e0]
push eax
call fcn.00490a16
add esp, 4
push 0x104
lea edx, [ebp - 0x114]
xor ecx, ecx
push ebx
push edx
mov dword [ebp - 0x3cc], edi
mov dword [ebp - 0x3d0], ebx
mov word [ebp - 0x3e0], cx
call fcn.00497ad0
mov esi, dword [ebp - 0x3c4]
add esp, 0xc
cmp dword [ebp - 0x3b0], 8
jae 0x406925
lea esi, [ebp - 0x3c4]
mov edi, dword [sym.imp.KERNEL32.dll_WideCharToMultiByte]
push ebx
push ebx
push ebx
push ebx
push 0xffffffffffffffff
push esi
push ebx
push ebx
call edi
cmp eax, ebx
je 0x40694b
push ebx
push ebx
push eax
lea eax, [ebp - 0x114]
push eax
push 0xffffffffffffffff
push esi
push ebx
push ebx
call edi
mov cx, word [0x4ddc80]
mov dl, byte [0x4ddc82]
mov eax, dword [ebp - 0x3a8]
mov esi, 8
mov word [ebp - 0x3e8], cx
mov byte [ebp - 0x3e6], dl
cmp dword [ebp - 0x394], esi
jae 0x40697e
lea eax, [ebp - 0x3a8]
push eax
call dword [sym.imp.KERNEL32.dll_GetFileAttributesW]
cmp eax, 0xffffffff
je 0x406b83
shr eax, 4
not eax
and eax, 1
je 0x406b83
mov eax, dword [ebp - 0x3a8]
cmp dword [ebp - 0x394], esi
jae 0x4069b0
lea eax, [ebp - 0x3a8]
push ebx
push 0x80
push 3
push ebx
push 3
push 0xc0000000
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov esi, eax
cmp esi, 0xffffffff
jne 0x406a2f
push 0xffffffffffffffff
call dword [sym.imp.KERNEL32.dll_CloseHandle]
lea ecx, [ebp - 0x3a8]
call fcn.00404690
lea ecx, [ebp - 0x3c4]
call fcn.00404690
lea ecx, [ebp - 0x338]
call fcn.00404690
lea ecx, [ebp - 0x370]
call fcn.00404690
lea ecx, [ebp - 0x38c]
call fcn.00404690
lea ecx, [ebp - 0x354]
call fcn.00404690
lea ecx, [ebp + 8]
call fcn.00404690
lea ecx, [ebp + 0x24]
call fcn.00404690
xor eax, eax
jmp 0x406d46
push 0
push esi
call dword [sym.imp.KERNEL32.dll_GetFileSize]
mov edi, eax
push edi
call fcn.0048d7af
add esp, 4
push 0
mov ebx, eax
lea eax, [ebp - 0x3e4]
push eax
push edi
push ebx
push esi
call dword [sym.imp.KERNEL32.dll_ReadFile]
lea ecx, [ebp - 0x114]
push ecx
push ebx
call fcn.00491610
add esp, 8
test eax, eax
je 0x406ac9
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
lea ecx, [ebp - 0x3a8]
call fcn.00404690
lea ecx, [ebp - 0x3c4]
call fcn.00404690
lea ecx, [ebp - 0x338]
call fcn.00404690
lea ecx, [ebp - 0x370]
call fcn.00404690
lea ecx, [ebp - 0x38c]
call fcn.00404690
lea ecx, [ebp - 0x354]
call fcn.00404690
lea ecx, [ebp + 8]
call fcn.00404690
lea ecx, [ebp + 0x24]
call fcn.00404690
jmp 0x406d41
push 0
push 0
push edi
push esi
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
cmp byte [ebx + edi - 1], 0xa
jne 0x406b34
cmp byte [ebx + edi - 2], 0xd
jne 0x406b34
lea eax, [ebp - 0x114]
lea edx, [eax + 1]
lea esp, [esp]
mov cl, byte [eax]
inc eax
test cl, cl
jne 0x406af0
mov edi, dword [sym.imp.KERNEL32.dll_WriteFile]
sub eax, edx
xor ebx, ebx
push ebx
lea edx, [ebp - 0x3e4]
push edx
push eax
lea eax, [ebp - 0x114]
push eax
push esi
call edi
push ebx
lea ecx, [ebp - 0x3e4]
push ecx
push 2
lea edx, [ebp - 0x3e8]
push edx
push esi
call edi
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
jmp 0x406c01
mov edi, dword [sym.imp.KERNEL32.dll_WriteFile]
push 0
lea eax, [ebp - 0x3e4]
push eax
push 2
lea ecx, [ebp - 0x3e8]
push ecx
push esi
call edi
lea eax, [ebp - 0x114]
lea edx, [eax + 1]
mov cl, byte [eax]
inc eax
test cl, cl
jne 0x406b58
sub eax, edx
push 0
lea edx, [ebp - 0x3e4]
push edx
push eax
lea eax, [ebp - 0x114]
push eax
push esi
call edi
push esi
xor ebx, ebx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
jmp 0x406c01
mov eax, dword [ebp - 0x3a8]
cmp dword [ebp - 0x394], esi
jae 0x406b97
lea eax, [ebp - 0x3a8]
push ebx
push 0x80
push 2
push ebx
push 3
push 0xc0000000
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov esi, eax
cmp esi, 0xffffffff
je 0x4069ce
lea eax, [ebp - 0x114]
lea edx, [eax + 1]
mov cl, byte [eax]
inc eax
test cl, cl
jne 0x406bc2
mov edi, dword [sym.imp.KERNEL32.dll_WriteFile]
push ebx
lea ecx, [ebp - 0x3e4]
push ecx
sub eax, edx
push eax
lea edx, [ebp - 0x114]
push edx
push esi
call edi
push ebx
lea eax, [ebp - 0x3e4]
push eax
push 2
lea ecx, [ebp - 0x3e8]
push ecx
push esi
call edi
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
xor ebx, ebx
mov esi, 8
cmp dword [ebp - 0x394], esi
jb 0x406c1d
mov edx, dword [ebp - 0x3a8]
push edx
call fcn.00490a16
add esp, 4
xor eax, eax
mov edi, 7
mov dword [ebp - 0x394], edi
mov dword [ebp - 0x398], ebx
mov word [ebp - 0x3a8], ax
cmp dword [ebp - 0x3b0], esi
jb 0x406c4e
mov ecx, dword [ebp - 0x3c4]
push ecx
call fcn.00490a16
add esp, 4
xor edx, edx
mov dword [ebp - 0x3b0], edi
mov dword [ebp - 0x3b4], ebx
mov word [ebp - 0x3c4], dx
cmp dword [ebp - 0x324], esi
jb 0x406c7a
mov eax, dword [ebp - 0x338]
push eax
call fcn.00490a16
add esp, 4
xor ecx, ecx
mov dword [ebp - 0x324], edi
mov dword [ebp - 0x328], ebx
mov word [ebp - 0x338], cx
cmp dword [ebp - 0x35c], esi
jb 0x406ca6
mov edx, dword [ebp - 0x370]
push edx
call fcn.00490a16
add esp, 4
xor eax, eax
mov dword [ebp - 0x35c], edi
mov dword [ebp - 0x360], ebx
mov word [ebp - 0x370], ax
cmp dword [ebp - 0x378], esi
jb 0x406cd2
mov ecx, dword [ebp - 0x38c]
push ecx
call fcn.00490a16
add esp, 4
xor edx, edx
mov dword [ebp - 0x378], edi
mov dword [ebp - 0x37c], ebx
mov word [ebp - 0x38c], dx
cmp dword [ebp - 0x340], esi
jb 0x406cfe
mov eax, dword [ebp - 0x354]
push eax
call fcn.00490a16
add esp, 4
xor ecx, ecx
mov dword [ebp - 0x340], edi
mov dword [ebp - 0x344], ebx
mov word [ebp - 0x354], cx
cmp dword [ebp + 0x1c], esi
jb 0x406d24
mov edx, dword [ebp + 8]
push edx
call fcn.00490a16
add esp, 4
xor eax, eax
mov dword [ebp + 0x1c], edi
mov dword [ebp + 0x18], ebx
mov word [ebp + 8], ax
cmp dword [ebp + 0x38], esi
jb 0x406d41
mov ecx, dword [ebp + 0x24]
push ecx
call fcn.00490a16
add esp, 4
mov eax, 1
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 0x10]
xor ecx, ebp
call fcn.00490a21
mov esp, ebp
pop ebp
ret