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

Disassembly:
push ebp
mov ebp, esp
push eax
mov eax, 0x10
add esp, 0xfffff004
push eax
dec eax
jne 0x65d451
mov eax, dword [ebp - 4]
add esp, 0xffffffbc
push ebx
push esi
push edi
xor ebx, ebx
mov dword [ebp - 0x10048], ebx
mov dword [ebp - 0x10044], ebx
mov dword [ebp - 4], ebx
mov dword [ebp - 8], ebx
mov dword [ebp - 0xc], ecx
mov ebx, edx
mov esi, eax
xor eax, eax
push ebp
push 0x65d8d4
push dword fs:[eax]
mov dword fs:[eax], esp
mov byte [esi + 0x18], 0
xor eax, eax
mov dword [esi + 0xc], eax
mov eax, dword [ebp - 0xc]
call fcn.00410b10
cmp dword [esi + 0x20], 0
jbe 0x65d4d2
lea eax, [ebp - 0x40]
push eax
mov eax, dword [esi + 0x14]
push eax
call sub.kernel32.dll_GetCommTimeouts
mov dword [ebp - 0x3c], 0xffffffff
mov eax, dword [esi + 0x20]
mov dword [ebp - 0x38], eax
mov dword [ebp - 0x40], 0xffffffff
lea eax, [ebp - 0x40]
push eax
mov eax, dword [esi + 0x14]
push eax
call sub.kernel32.dll_SetCommTimeouts
mov eax, ebx
mov edx, dword [eax]
call dword [edx + 0x10]
mov eax, dword [eax + 0x10]
mov edx, dword [eax]
call dword [edx]
mov dword [ebp - 0x20], eax
mov dword [ebp - 0x1c], edx
push 0
push 0
mov eax, ebx
mov edx, dword [eax]
call dword [edx + 0x10]
mov eax, dword [eax + 0x10]
call fcn.004a3f90
lea edx, [ebp - 0x10044]
mov eax, ebx
mov ecx, dword [eax]
call dword [ecx + 0xc]
mov eax, dword [ebp - 0x10044]
mov ecx, eax
test ecx, ecx
je 0x65d517
sub ecx, 4
mov ecx, dword [ecx]
mov eax, ecx
add eax, eax
cdq
mov dword [ebp - 0x28], eax
mov dword [ebp - 0x24], edx
mov eax, dword [ebp - 0x28]
mov edx, dword [ebp - 0x24]
add eax, 8
adc edx, 0
push eax
lea eax, [ebp - 4]
mov ecx, 1
mov edx, dword [0x65d410]
call fcn.0040ef28
add esp, 4
lea eax, [ebp - 0x28]
mov ecx, 8
mov edx, dword [ebp - 4]
call fcn.004078a0
cmp dword [ebp - 0x24], 0
jne 0x65d563
cmp dword [ebp - 0x28], 0
jbe 0x65d58b
jmp 0x65d565
jle 0x65d58b
lea edx, [ebp - 0x10048]
mov eax, ebx
mov ecx, dword [eax]
call dword [ecx + 0xc]
mov eax, dword [ebp - 0x10048]
call fcn.0040c8a8
mov edx, dword [ebp - 4]
add edx, 8
mov ecx, dword [ebp - 0x28]
call fcn.004078a0
mov edi, dword [ebp - 4]
test edi, edi
je 0x65d597
sub edi, 4
mov edi, dword [edi]
push 0
lea eax, [ebp - 0x10]
push eax
push edi
mov eax, dword [ebp - 4]
push eax
mov eax, dword [esi + 0x14]
push eax
call sub.kernel32.dll_WriteFile
test eax, eax
jne 0x65d5c9
lea eax, [esi + 8]
mov edx, 0x65d8f0
call fcn.0040bd94
call sub.kernel32.dll_GetLastError
mov dword [esi + 0xc], eax
jmp 0x65d89e
push 0
lea eax, [ebp - 0x10]
push eax
push 8
lea eax, [ebp - 0x20]
push eax
mov eax, dword [esi + 0x14]
push eax
call sub.kernel32.dll_WriteFile
test eax, eax
jne 0x65d5fc
lea eax, [esi + 8]
mov edx, 0x65d950
call fcn.0040bd94
call sub.kernel32.dll_GetLastError
mov dword [esi + 0xc], eax
jmp 0x65d89e
mov eax, ebx
mov edx, dword [eax]
call dword [edx + 0x10]
mov eax, dword [eax + 0x10]
mov edx, dword [eax]
call dword [edx]
cmp edx, 0
jne 0x65d61a
cmp eax, 0
jbe 0x65d69a
jmp 0x65d61c
jle 0x65d69a
mov eax, ebx
mov edx, dword [eax]
call dword [edx + 0x10]
mov eax, dword [eax + 0x10]
lea edx, [ebp - 0x10040]
mov ecx, 0x10000
mov edi, dword [eax]
call dword [edi + 0xc]
mov dword [ebp - 0x2c], eax
cmp dword [ebp - 0x2c], 0
jbe 0x65d69a
push 0
lea eax, [ebp - 0x10]
push eax
mov eax, dword [ebp - 0x2c]
push eax
lea eax, [ebp - 0x10040]
push eax
mov eax, dword [esi + 0x14]
push eax
call sub.kernel32.dll_WriteFile
test eax, eax
jne 0x65d677
lea eax, [esi + 8]
mov edx, 0x65d9c0
call fcn.0040bd94
call sub.kernel32.dll_GetLastError
mov dword [esi + 0xc], eax
jmp 0x65d89e
mov eax, ebx
mov edx, dword [eax]
call dword [edx + 0x10]
mov eax, dword [eax + 0x10]
lea edx, [ebp - 0x10040]
mov ecx, 0x10000
mov edi, dword [eax]
call dword [edi + 0xc]
mov dword [ebp - 0x2c], eax
cmp dword [ebp - 0x2c], 0
ja 0x65d63f
mov eax, dword [ebp - 0xc]
call fcn.0065ce94
push 0
lea eax, [ebp - 0x2c]
push eax
push 8
lea eax, [ebp - 0x28]
push eax
mov eax, dword [esi + 0x14]
push eax
call sub.kernel32.dll_ReadFile
cmp eax, 1
sbb ebx, ebx
inc ebx
test bl, bl
jne 0x65d6e7
call sub.kernel32.dll_GetLastError
cmp eax, 0xea
je 0x65d6e7
lea eax, [esi + 8]
mov edx, 0x65da28
call fcn.0040bd94
call sub.kernel32.dll_GetLastError
mov dword [esi + 0xc], eax
jmp 0x65d89e
cmp dword [ebp - 0x24], 0
jne 0x65d6f9
cmp dword [ebp - 0x28], 0
jbe 0x65d79b
jmp 0x65d6ff
jle 0x65d79b
mov eax, dword [ebp - 0x28]
push eax
lea eax, [ebp - 4]
mov ecx, 1
mov edx, dword [0x65d410]
call fcn.0040ef28
add esp, 4
push 0
push 2
mov eax, dword [ebp - 0x28]
mov edx, dword [ebp - 0x24]
call fcn.0040e7bc
mov edx, eax
lea eax, [ebp - 8]
call fcn.0040ca34
push 0
lea eax, [ebp - 0x2c]
push eax
mov eax, dword [ebp - 0x28]
push eax
mov eax, dword [ebp - 4]
push eax
mov eax, dword [esi + 0x14]
push eax
call sub.kernel32.dll_ReadFile
cmp eax, 1
sbb ebx, ebx
inc ebx
test bl, bl
jne 0x65d779
call sub.kernel32.dll_GetLastError
cmp eax, 0xea
je 0x65d779
lea eax, [esi + 8]
mov edx, 0x65da94
call fcn.0040bd94
call sub.kernel32.dll_GetLastError
mov dword [esi + 0xc], eax
jmp 0x65d89e
lea eax, [ebp - 8]
call fcn.0040bf78
mov edx, eax
mov ecx, dword [ebp - 0x28]
mov eax, dword [ebp - 4]
call fcn.004078a0
mov eax, dword [ebp - 0xc]
mov eax, dword [eax]
mov edx, dword [ebp - 8]
mov ecx, dword [eax]
call dword [ecx + 0x14]
push 0
lea eax, [ebp - 0x2c]
push eax
push 8
lea eax, [ebp - 0x20]
push eax
mov eax, dword [esi + 0x14]
push eax
call sub.kernel32.dll_ReadFile
cmp eax, 1
sbb ebx, ebx
inc ebx
test bl, bl
jne 0x65d7e0
call sub.kernel32.dll_GetLastError
cmp eax, 0xea
je 0x65d7e0
lea eax, [esi + 8]
mov edx, 0x65daf4
call fcn.0040bd94
call sub.kernel32.dll_GetLastError
mov dword [esi + 0xc], eax
jmp 0x65d89e
cmp dword [ebp - 0x1c], 0
jne 0x65d7f2
cmp dword [ebp - 0x20], 0
jbe 0x65d884
jmp 0x65d7f8
jle 0x65d884
mov dword [ebp - 0x18], 0
mov dword [ebp - 0x14], 0
push 0
lea eax, [ebp - 0x2c]
push eax
push 0x10000
lea eax, [ebp - 0x10040]
push eax
mov eax, dword [esi + 0x14]
push eax
call sub.kernel32.dll_ReadFile
cmp eax, 1
sbb ebx, ebx
inc ebx
mov eax, dword [ebp - 0xc]
mov eax, dword [eax]
mov edx, dword [eax]
call dword [edx + 0x10]
mov eax, dword [eax + 0x10]
lea edx, [ebp - 0x10040]
mov ecx, dword [ebp - 0x2c]
mov edi, dword [eax]
call dword [edi + 0x10]
mov eax, dword [ebp - 0x2c]
xor edx, edx
add dword [ebp - 0x18], eax
adc dword [ebp - 0x14], edx
test bl, bl
jne 0x65d874
call sub.kernel32.dll_GetLastError
cmp eax, 0xea
je 0x65d874
lea eax, [esi + 8]
mov edx, 0x65db60
call fcn.0040bd94
call sub.kernel32.dll_GetLastError
mov dword [esi + 0xc], eax
jmp 0x65d89e
mov eax, dword [ebp - 0x18]
mov edx, dword [ebp - 0x14]
cmp edx, dword [ebp - 0x1c]
jne 0x65d806
cmp eax, dword [ebp - 0x20]
jne 0x65d806
push 0
push 0
mov eax, dword [ebp - 0xc]
mov eax, dword [eax]
mov edx, dword [eax]
call dword [edx + 0x10]
mov eax, dword [eax + 0x10]
call fcn.004a3f90
mov byte [esi + 0x18], 1
xor eax, eax
pop edx
pop ecx
pop ecx
mov dword fs:[eax], edx
push 0x65d8db
lea eax, [ebp - 0x10048]
mov edx, 2
call fcn.0040ba04
lea eax, [ebp - 8]
call fcn.0040b9a4
lea eax, [ebp - 4]
mov edx, dword [0x65d410]
call fcn.0040f04c
pop eax
jmp eax