Function at 0x401140
Capabilities:
Read file on windows
Write file on windows

Disassembly:
sub esp, 0x188
mov eax, dword [0x409034]
push ebx
mov ebx, dword [sym.imp.KERNEL32.dll_CreateFileA]
push ebp
push esi
push edi
mov edi, dword [esp + 0x19c]
push 0
push 0x20
push 4
push 0
push 3
push 0x80000000
push edi
mov dword [esp + 0x1b0], eax
mov dword [esp + 0x38], ecx
call ebx
push 0
push 0x20
push 4
push 0
push 3
push 0x40000000
push edi
mov esi, eax
call ebx
test esi, esi
mov ebp, eax
mov dword [esp + 0x14], ebp
je 0x40128c
test ebp, ebp
je 0x40128c
mov edi, dword [sym.imp.KERNEL32.dll_ReadFile]
push 0
lea eax, [esp + 0x14]
push eax
push 0x40
lea ecx, [esp + 0x160]
push ecx
push esi
call edi
mov ax, word [esp + 0x154]
cmp al, 0x4d
jne 0x401280
cmp ah, 0x5a
jne 0x401280
mov eax, dword [esp + 0x190]
test eax, eax
jne 0x4011f2
mov edi, dword [sym.imp.KERNEL32.dll_CloseHandle]
push ebp
call edi
push esi
call edi
jmp 0x40128c
push 0
push 0
push eax
push esi
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
push 0
lea edx, [esp + 0x14]
push edx
push 0xf8
lea eax, [esp + 0x68]
push eax
push esi
call edi
mov eax, dword [esp + 0xe4]
test eax, eax
je 0x401280
movzx eax, word [esp + 0x62]
lea ecx, [eax + eax*4]
shl ecx, 3
push ecx
call fcn.00403228
mov ebx, eax
movzx eax, word [esp + 0x66]
add esp, 4
push 0
lea edx, [esp + 0x14]
push edx
lea eax, [eax + eax*4]
shl eax, 3
push eax
push ebx
push esi
mov dword [esp + 0x2c], ebx
call edi
movzx ecx, word [esp + 0x62]
xor eax, eax
test ecx, ecx
jle 0x401273
mov ebp, dword [esp + 0xe4]
lea edx, [ebx + 0xc]
cmp dword [edx], ebp
je 0x40126f
inc eax
add edx, 0x28
cmp eax, ecx
jl 0x401263
mov ebp, dword [esp + 0x14]
cmp eax, ecx
jne 0x4012a5
push ebx
call fcn.00403275
add esp, 4
push esi
mov esi, dword [sym.imp.KERNEL32.dll_CloseHandle]
call esi
push ebp
call esi
mov ecx, dword [esp + 0x194]
pop edi
pop esi
pop ebp
pop ebx
call fcn.00403267
add esp, 0x188
ret 0x10
lea ecx, [eax + eax*4]
lea eax, [ebx + ecx*8]
mov ebx, dword [eax + 0x14]
mov eax, dword [eax + 0xc]
push 0
push 0
push ebx
sub eax, ebx
push esi
mov dword [esp + 0x40], eax
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
push 0
lea edx, [esp + 0x14]
push edx
push 0x10
lea eax, [esp + 0x2c]
push eax
push esi
call edi
movzx ecx, word [esp + 0x2c]
movzx edx, word [esp + 0x2e]
add ecx, edx
shl ecx, 3
push ecx
call fcn.00403228
movzx ecx, word [esp + 0x30]
movzx edx, word [esp + 0x32]
add esp, 4
push 0
mov ebp, eax
lea eax, [esp + 0x14]
push eax
add ecx, edx
shl ecx, 3
push ecx
push ebp
push esi
call edi
movzx ecx, word [esp + 0x2c]
movzx edx, word [esp + 0x2e]
add ecx, edx
xor eax, eax
test ecx, ecx
jle 0x40132d
jmp 0x401320
cmp word [ebp + eax*8], 3
je 0x40132d
inc eax
cmp eax, ecx
jl 0x401320
cmp eax, ecx
jne 0x401357
push ebp
call fcn.00403275
mov eax, dword [esp + 0x1c]
push eax
call fcn.00403275
add esp, 8
push esi
mov esi, dword [sym.imp.KERNEL32.dll_CloseHandle]
call esi
mov ecx, dword [esp + 0x14]
push ecx
jmp 0x40128a
mov edx, dword [ebp + eax*8 + 4]
push 0
and edx, 0x7fffffff
push 0
add edx, ebx
push edx
push esi
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
push 0
lea eax, [esp + 0x14]
push eax
push 0x10
lea ecx, [esp + 0x2c]
push ecx
push esi
call edi
push ebp
call fcn.00403275
movzx edx, word [esp + 0x30]
movzx eax, word [esp + 0x32]
add edx, eax
shl edx, 3
push edx
call fcn.00403228
movzx edx, word [esp + 0x34]
mov ebp, eax
movzx eax, word [esp + 0x36]
add esp, 8
push 0
lea ecx, [esp + 0x14]
push ecx
add edx, eax
shl edx, 3
push edx
push ebp
push esi
mov dword [esp + 0x4c], ebp
call edi
mov ecx, dword [ebp + 4]
push 0
and ecx, 0x7fffffff
push 0
add ecx, ebx
push ecx
push esi
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
push 0
lea edx, [esp + 0x14]
push edx
push 0x10
lea eax, [esp + 0x48]
push eax
push esi
call edi
movzx ecx, word [esp + 0x48]
movzx edx, word [esp + 0x4a]
add ecx, edx
shl ecx, 3
push ecx
call fcn.00403228
movzx ecx, word [esp + 0x4c]
movzx edx, word [esp + 0x4e]
add esp, 4
push 0
mov ebp, eax
lea eax, [esp + 0x14]
push eax
add ecx, edx
shl ecx, 3
push ecx
push ebp
push esi
call edi
mov eax, dword [ebp + 4]
push 0
push 0
add eax, ebx
push eax
push esi
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
push 0
mov ecx, dword [ebp + 4]
push 0
add ecx, ebx
mov ebx, dword [esp + 0x1c]
push ecx
push ebx
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
push ebp
call fcn.00403275
add esp, 4
push 0
lea edx, [esp + 0x14]
push edx
push 0x10
lea eax, [esp + 0x58]
push eax
push esi
call edi
mov eax, dword [esp + 0x1a8]
test eax, eax
jne 0x40146b
lea eax, [esp + 0x4c]
mov ecx, dword [esp + 0x4c]
push 0
lea edx, [esp + 0x38]
push edx
push 0x10
push eax
push ebx
mov dword [eax], ecx
call dword [sym.imp.KERNEL32.dll_WriteFile]
mov eax, dword [esp + 0x38]
push eax
call fcn.00403275
mov ecx, dword [esp + 0x1c]
push ecx
call fcn.00403275
mov edx, dword [esp + 0x54]
mov ebp, dword [esp + 0x38]
add esp, 8
push 0
push 0
sub edx, ebp
push edx
push ebx
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov eax, dword [esp + 0x1a0]
test eax, eax
mov ebp, dword [esp + 0x1c]
jne 0x4014d5
mov eax, dword [ebp]
push eax
call fcn.00403228
mov edi, eax
mov eax, dword [esp + 0x1a4]
add esp, 4
jmp 0x4014dc
mov edi, dword [esp + 0x1a4]
cmp eax, dword [ebp]
jge 0x4014ed
mov byte [eax + edi], 0
mov ecx, dword [ebp]
inc eax
cmp eax, ecx
jl 0x4014e1
mov edx, dword [ebp]
push 0
lea ecx, [esp + 0x38]
push ecx
push edx
push edi
push ebx
call dword [sym.imp.KERNEL32.dll_WriteFile]
push edi
call fcn.00403275
mov edi, dword [sym.imp.KERNEL32.dll_CloseHandle]
add esp, 4
push ebx
call edi
push esi
call edi
jmp 0x40128c