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

Disassembly:
sub esp, 0x18
push ebx
mov ebx, dword [esp + 0x20]
push ebp
push dword [ebx]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov ebp, dword [esp + 0x2c]
push 0
push 0x80
push 3
push 0
push 0
push closesocket
push ebp
call dword [sym.imp.KERNEL32.dll_CreateFileA]
mov dword [ebx], eax
cmp eax, 0xffffffff
jne 0x1001a6c4
mov eax, dword [esp + 0x28]
push ebp
push str.failed_to_open_file:__s
push 1
push dword [eax + 0x18]
call fcn.10019a50
add esp, 0x10
xor eax, eax
pop ebp
pop ebx
add esp, 0x18
ret
mov edx, dword [ebx + 8]
mov ecx, dword [ebx + 0xc]
push edi
mov edi, 0x40
test edx, edx
je 0x1001a6e9
add ecx, 4
mov eax, edi
lea ecx, [ecx + 0x20]
mov edi, dword [ecx - 0x20]
cmp edi, eax
cmovbe edi, eax
sub edx, 1
jne 0x1001a6d7
push esi
shl edi, 0xb
push edi
call fcn.100b8d28
mov esi, eax
add esp, 4
mov dword [esp + 0x20], esi
test esi, esi
jne 0x1001a72b
mov eax, dword [esp + 0x30]
push str.img_buffer
push str.failed_to_allocate_memory_for__s
push 1
push dword [eax + 0x18]
call fcn.10019a50
push esi
call fcn.100b8d0d
add esp, 0x14
xor eax, eax
pop esi
pop edi
pop ebp
pop ebx
add esp, 0x18
ret
mov eax, dword [ebx + 8]
xor edx, edx
xor ecx, ecx
mov dword [ebx + 0x10], 0
mov dword [esp + 0x10], edx
mov dword [esp + 0x18], ecx
test eax, eax
je 0x1001a84a
xor ebp, ebp
nop dword [eax + eax]
shl ecx, 5
add ecx, dword [ebx + 0xc]
mov dword [esp + 0x1c], ecx
mov esi, dword [ecx]
shl esi, 0xb
mov ecx, esi
sub ecx, edx
je 0x1001a791
push 1
push 0
push ecx
push dword [ebx]
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
cmp eax, 0xffffffff
jne 0x1001a787
mov ebp, dword [sym.imp.KERNEL32.dll_GetLastError]
call ebp
test eax, eax
jne 0x1001a860
mov ebp, dword [ebx + 0x10]
mov eax, dword [ebx + 8]
mov dword [esp + 0x10], esi
sub eax, dword [esp + 0x18]
mov edx, dword [esp + 0x1c]
mov dword [esp + 0x24], eax
xor eax, eax
mov dword [esp + 0x14], eax
xor esi, esi
mov eax, dword [edx + 4]
shl eax, 0xb
add eax, esi
cmp eax, edi
ja 0x1001a7d8
lea ecx, [esi + ebp]
mov esi, eax
shr ecx, 0xb
mov dword [edx], ecx
add edx, 0x20
mov ecx, dword [esp + 0x14]
inc ecx
mov dword [esp + 0x14], ecx
cmp ecx, dword [esp + 0x24]
jae 0x1001a7d8
mov ecx, dword [edx]
shl ecx, 0xb
sub ecx, ebp
sub ecx, eax
je 0x1001a7a5
mov ebp, dword [esp + 0x20]
lea eax, [esp + 0x2c]
push 0
push eax
push esi
push ebp
push dword [ebx]
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x1001a89c
cmp dword [esp + 0x2c], esi
jne 0x1001a89c
push 0
lea eax, [esp + 0x30]
push eax
push esi
push ebp
push dword [ebx + 4]
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x1001a89c
cmp dword [esp + 0x2c], esi
jne 0x1001a89c
mov ecx, dword [esp + 0x18]
add dword [ebx + 0x10], esi
mov edx, dword [esp + 0x10]
add ecx, dword [esp + 0x14]
add edx, esi
mov eax, dword [ebx + 8]
mov ebp, dword [ebx + 0x10]
mov dword [esp + 0x10], edx
mov dword [esp + 0x18], ecx
cmp ecx, eax
jb 0x1001a750
mov esi, dword [esp + 0x20]
push esi
call fcn.100b8d0d
add esp, 4
mov eax, 1
pop esi
pop edi
pop ebp
pop ebx
add esp, 0x18
ret
call ebp
push eax
mov eax, dword [esp + 0x20]
add eax, 8
push eax
mov eax, dword [esp + 0x3c]
push 0x18
push eax
mov eax, dword [esp + 0x40]
push str.failed_to_seek_file:__s__target:__.s__win32:__d_
push 1
push dword [eax + 0x18]
call fcn.10019a50
mov esi, dword [esp + 0x3c]
push esi
call fcn.100b8d0d
add esp, 0x20
xor eax, eax
pop esi
pop edi
pop ebp
pop ebx
add esp, 0x18
ret
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
mov eax, dword [esp + 0x20]
push esi
push dword [esp + 0x34]
add eax, 8
push edi
push eax
mov eax, dword [esp + 0x48]
push 0x18
push eax
mov eax, dword [esp + 0x4c]
push str.failed_to_copy_file:__s__target:__.s__buffer:__lu__bytes:__lu____lu__win32:__d_
push 1
push dword [eax + 0x18]
call fcn.10019a50
push ebp
call fcn.100b8d0d
add esp, 0x2c
xor eax, eax
pop esi
pop edi
pop ebp
pop ebx
add esp, 0x18
ret