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

Disassembly:
sub esp, 0x274
mov eax, dword [0x4d6720]
xor eax, esp
mov dword [esp + 0x270], eax
push ebp
mov ebp, dword [esp + 0x27c]
push esi
push 0x24c
lea eax, [esp + 0x30]
push 0
push eax
or esi, 0xffffffff
mov dword [esp + 0x34], 0
call fcn.00482db0
add esp, 0xc
lea ecx, [esp + 0x28]
push ecx
push ebp
call dword [sym.imp.KERNEL32.dll_FindFirstFileW]
cmp eax, esi
je 0x40ce55
mov edx, dword [esp + 0x48]
mov esi, dword [esp + 0x44]
push ebx
xor ebx, ebx
xor ecx, ecx
or ebx, edx
push eax
mov dword [esp + 0x28], ebx
or esi, ecx
call dword [sym.imp.KERNEL32.dll_FindClose]
xor eax, eax
cmp esi, dword [esp + 0x28c]
mov dword [esp + 0xc], eax
jl 0x40ce38
mov ecx, dword [esp + 0x288]
jg 0x40cbd0
cmp ebx, ecx
jbe 0x40ce38
mov eax, ebx
sub eax, ecx
push edi
mov dword [esp + 0x20], eax
lea edi, [eax + 0x400]
xor eax, eax
cmp eax, esi
jl 0x40cbed
jg 0x40cbeb
cmp edi, ebx
jbe 0x40cbed
mov edi, ebx
push 0x4daa30
push edi
call fcn.00483f74
mov ebx, eax
add esp, 8
mov dword [esp + 0x18], ebx
test ebx, ebx
je 0x40ce50
push 0
push 0x20
push 3
push 0
push 1
push 0xc0000000
push ebp
call dword [sym.imp.KERNEL32.dll_CreateFileW]
or esi, 0xffffffff
mov dword [esp + 0x24], eax
cmp eax, esi
je 0x40ce22
push 0
lea edx, [esp + 0x18]
push edx
push edi
push ebx
push eax
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x40ce0d
mov eax, dword [esp + 0x14]
cmp eax, edi
jne 0x40ce0d
sub eax, 2
mov dword [esp + 0x14], eax
shr eax, 1
mov ebp, eax
add ebx, 2
xor eax, eax
mov dword [esp + 0x1c], ebp
mov esi, ebx
test ebp, ebp
jle 0x40ce11
lea edi, [eax + 1]
lea ecx, [ebx + 2]
lea edx, [eax + 2]
lea esp, [esp]
cmp word [ebx + eax*2], 0xa
jne 0x40ccab
cmp edi, ebp
jge 0x40cc99
cmp word [ecx], 0xd
jne 0x40cc99
inc eax
inc edi
add ecx, 2
add edx, 2
mov ebp, edx
sar ebp, 1
add ebp, ebp
mov esi, ecx
cmp ebp, dword [esp + 0x20]
jae 0x40ccb7
mov ebp, dword [esp + 0x1c]
inc eax
inc edi
add ecx, 2
add edx, 2
cmp eax, ebp
jl 0x40cc80
cmp esi, ebx
jbe 0x40ce11
mov eax, dword [esp + 0x18]
push eax
call fcn.0046082f
mov edi, dword [esp + 0x28]
mov ebp, dword [sym.imp.KERNEL32.dll_SetFilePointer]
add esp, 4
sub esi, ebx
push 0
sar esi, 1
push 0
add esi, esi
push esi
push edi
mov dword [esp + 0x28], 0
call ebp
cmp eax, 0xffffffff
jne 0x40cd17
call dword [sym.imp.KERNEL32.dll_GetLastError]
test eax, eax
je 0x40cd17
mov edx, dword [esp + 0x24]
push edx
mov dword [esp + 0x14], 0xffffffff
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov ebx, dword [esp + 0x18]
jmp 0x40ce26
mov eax, dword [esp + 0x28]
sub eax, esi
mov esi, eax
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push esi
push 0
push eax
mov dword [esp + 0x34], eax
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
mov ebx, eax
test ebx, ebx
je 0x40ccfb
push 0
lea ecx, [esp + 0x18]
push ecx
push esi
push ebx
push edi
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x40cde6
cmp dword [esp + 0x14], esi
jne 0x40cde6
push 0
push 0
push 0
push edi
call ebp
or ebp, 0xffffffff
cmp eax, ebp
jne 0x40cd9b
call dword [sym.imp.KERNEL32.dll_GetLastError]
test eax, eax
je 0x40cd9b
mov ecx, dword [esp + 0x28]
push ebx
push 0
push ecx
mov dword [esp + 0x1c], ebp
call dword [sym.imp.KERNEL32.dll_HeapFree]
mov edx, dword [esp + 0x24]
push edx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov ebx, dword [esp + 0x18]
jmp 0x40ce26
push edi
call dword [sym.imp.KERNEL32.dll_SetEndOfFile]
test eax, eax
je 0x40cd75
mov ebp, dword [sym.imp.KERNEL32.dll_WriteFile]
push 0
lea edx, [esp + 0x20]
push edx
push 2
push 0x4d42e0
push edi
mov dword [esp + 0x24], 1
call ebp
test eax, eax
je 0x40cde6
cmp dword [esp + 0x1c], 2
jne 0x40cde6
push 0
lea eax, [esp + 0x24]
push eax
push esi
push ebx
push edi
call ebp
test eax, eax
je 0x40cde6
cmp esi, dword [esp + 0x20]
je 0x40cdee
mov dword [esp + 0x10], 0xffffffff
mov ecx, dword [esp + 0x28]
push ebx
push 0
push ecx
call dword [sym.imp.KERNEL32.dll_HeapFree]
mov edx, dword [esp + 0x24]
push edx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov ebx, dword [esp + 0x18]
jmp 0x40ce26
mov dword [esp + 0x10], esi
mov edx, dword [esp + 0x24]
push edx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov ebx, dword [esp + 0x18]
jmp 0x40ce26
mov dword [esp + 0x10], esi
test ebx, ebx
je 0x40ce33
push ebx
call fcn.0046082f
add esp, 4
mov eax, dword [esp + 0x10]
pop edi
pop ebx
pop esi
pop ebp
mov ecx, dword [esp + 0x270]
xor ecx, esp
call fcn.00482b5f
add esp, 0x274
or eax, 0xffffffff
jmp 0x40ce37
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 2
jne 0x40ce79
pop esi
xor eax, eax
pop ebp
mov ecx, dword [esp + 0x270]
xor ecx, esp
call fcn.00482b5f
add esp, 0x274
ret
mov ecx, dword [esp + 0x278]
mov eax, esi
pop esi
pop ebp
xor ecx, esp
call fcn.00482b5f
add esp, 0x274
ret