Function at 0x4aaff5
Capabilities:
Write file on windows

Disassembly:
push ebp
mov ebp, esp
push edi
mov edi, eax
push esi
push ebx
sub esp, 0x2c
mov dword [esp], 0x8000
mov dword [ebp - 0x1c], edx
call sub.msvcrt.dll_malloc
test eax, eax
mov ebx, eax
jne 0x4ab021
mov dword [esp], str.couldnt_allocate_buffer_for_copy_to_file
call fcn.0040b930
test byte [0x4f3060], 1
je 0x4ab0d4
mov esi, dword [sym.imp.msvcrt.dll__errno]
call esi
mov eax, dword [eax]
mov dword [esp], 0x4f3068
mov dword [ebp - 0x20], eax
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
push eax
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
mov dword [ebp - 0x24], eax
call sub.msvcrt.dll__getpid
mov edx, dword [sym.imp.msvcrt.dll__iob]
mov ecx, dword [ebp - 0x24]
mov dword [esp + 8], str.copy_to_file
mov dword [esp + 4], 0x4b120b
mov dword [esp + 0x10], ecx
mov dword [esp + 0xc], eax
lea eax, [edx + 0x40]
mov dword [esp], eax
call fcn.0049fc30
call esi
mov ecx, dword [ebp - 0x20]
mov edx, dword [ebp - 0x1c]
mov dword [eax], ecx
mov dword [esp + 0xc], edx
mov edx, dword [sym.imp.msvcrt.dll__iob]
mov dword [esp + 8], edi
mov dword [esp + 4], str.copy_to_file__d_____d__n
lea eax, [edx + 0x40]
mov dword [esp], eax
call fcn.0049fc30
mov edx, dword [sym.imp.msvcrt.dll__iob]
lea eax, [edx + 0x40]
mov dword [esp], eax
call sub.msvcrt.dll_fflush
mov dword [esp], 0x4f3068
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
push edx
call esi
mov ecx, dword [ebp - 0x20]
mov dword [eax], ecx
test edi, edi
jne 0x4ab0e4
mov dword [esp], 0
call fcn.0041b7c0
mov dword [ebp - 0x20], 0
test edi, edi
mov dword [esp + 8], 0x8000
mov dword [esp + 4], ebx
jne 0x4ab10b
mov dword [esp], 0
call fcn.0041b9f0
mov esi, eax
jmp 0x4ab115
mov dword [esp], edi
call fcn.00418e20
mov esi, eax
test esi, esi
jne 0x4ab1cc
test byte [0x4f3060], 1
je 0x4ab388
mov edx, dword [sym.imp.msvcrt.dll__errno]
mov dword [ebp - 0x24], edx
call edx
mov eax, dword [eax]
mov dword [esp], 0x4f3068
mov esi, eax
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
push eax
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
mov dword [ebp - 0x1c], eax
call sub.msvcrt.dll__getpid
mov ecx, dword [ebp - 0x1c]
mov dword [esp + 8], str.copy_to_file
mov dword [esp + 4], 0x4b120b
mov dword [esp + 0x10], ecx
mov dword [esp + 0xc], eax
mov eax, dword [sym.imp.msvcrt.dll__iob]
add eax, 0x40
mov dword [esp], eax
call fcn.0049fc30
mov edx, dword [ebp - 0x24]
mov dword [ebp - 0x1c], edx
call edx
mov dword [eax], esi
mov eax, dword [sym.imp.msvcrt.dll__iob]
mov dword [esp + 4], str.copy_to_file___:_read_0_bytes__exiting_n
add eax, 0x40
mov dword [esp], eax
call fcn.0049fc30
mov eax, dword [sym.imp.msvcrt.dll__iob]
add eax, 0x40
mov dword [esp], eax
call sub.msvcrt.dll_fflush
mov dword [esp], 0x4f3068
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov edx, dword [ebp - 0x1c]
push eax
call edx
mov dword [eax], esi
jmp 0x4ab388
jns 0x4ab335
call dword [sym.imp.msvcrt.dll__errno]
cmp dword [eax], 4
mov eax, dword [0x4f3060]
jne 0x4ab288
test al, 1
je 0x4ab0eb
call dword [sym.imp.msvcrt.dll__errno]
mov esi, dword [eax]
mov dword [esp], 0x4f3068
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
push eax
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
mov dword [ebp - 0x24], eax
call sub.msvcrt.dll__getpid
mov edx, dword [ebp - 0x24]
mov dword [esp + 8], str.copy_to_file
mov dword [esp + 4], 0x4b120b
mov dword [esp + 0x10], edx
mov dword [esp + 0xc], eax
mov eax, dword [sym.imp.msvcrt.dll__iob]
add eax, 0x40
mov dword [esp], eax
call fcn.0049fc30
call dword [sym.imp.msvcrt.dll__errno]
mov dword [eax], esi
mov eax, dword [sym.imp.msvcrt.dll__iob]
mov dword [esp + 4], str.copy_to_file___:_EINTR__retrying_n
add eax, 0x40
mov dword [esp], eax
call fcn.0049fc30
mov eax, dword [sym.imp.msvcrt.dll__iob]
add eax, 0x40
mov dword [esp], eax
call sub.msvcrt.dll_fflush
mov dword [esp], 0x4f3068
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
push eax
call dword [sym.imp.msvcrt.dll__errno]
mov dword [eax], esi
jmp 0x4ab0eb
test al, 1
je 0x4ab388
call dword [sym.imp.msvcrt.dll__errno]
mov eax, dword [eax]
mov dword [esp], 0x4f3068
mov esi, eax
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
push ecx
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
mov dword [ebp - 0x1c], eax
call sub.msvcrt.dll__getpid
mov edx, dword [ebp - 0x1c]
mov dword [esp + 8], str.copy_to_file
mov dword [esp + 4], 0x4b120b
mov dword [esp + 0x10], edx
mov dword [esp + 0xc], eax
mov eax, dword [sym.imp.msvcrt.dll__iob]
add eax, 0x40
mov dword [esp], eax
call fcn.0049fc30
call dword [sym.imp.msvcrt.dll__errno]
mov dword [eax], esi
call dword [sym.imp.msvcrt.dll__errno]
mov eax, dword [eax]
mov dword [esp + 4], str.copy_to_file___:_error__d_n
mov dword [esp + 8], eax
mov eax, dword [sym.imp.msvcrt.dll__iob]
add eax, 0x40
mov dword [esp], eax
call fcn.0049fc30
mov eax, dword [sym.imp.msvcrt.dll__iob]
add eax, 0x40
mov dword [esp], eax
call sub.msvcrt.dll_fflush
mov dword [esp], 0x4f3068
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
push eax
call dword [sym.imp.msvcrt.dll__errno]
mov dword [eax], esi
jmp 0x4ab388
cmp dword [ebp - 0x1c], 1
jne 0x4ab36d
mov eax, dword [sym.imp.msvcrt.dll__iob]
mov dword [esp + 8], esi
mov dword [esp + 4], 1
mov dword [esp], ebx
add eax, 0x20
mov dword [esp + 0xc], eax
call sub.msvcrt.dll_fwrite
mov eax, dword [sym.imp.msvcrt.dll__iob]
add eax, 0x20
mov dword [esp], eax
call sub.msvcrt.dll_fflush
jmp 0x4ab380
mov eax, dword [ebp - 0x1c]
mov dword [esp + 8], esi
mov dword [esp + 4], ebx
mov dword [esp], eax
call fcn.00418e60
add dword [ebp - 0x20], esi
jmp 0x4ab0eb
test edi, edi
jne 0x4ab398
mov dword [esp], 0
call fcn.0041b8f0
test byte [0x4f3060], 1
je 0x4ab43b
mov edi, dword [sym.imp.msvcrt.dll__errno]
call edi
mov esi, dword [eax]
mov dword [esp], 0x4f3068
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
push eax
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
mov dword [ebp - 0x1c], eax
call sub.msvcrt.dll__getpid
mov ecx, dword [ebp - 0x1c]
mov dword [esp + 8], str.copy_to_file
mov dword [esp + 4], 0x4b120b
mov dword [esp + 0x10], ecx
mov dword [esp + 0xc], eax
mov eax, dword [sym.imp.msvcrt.dll__iob]
add eax, 0x40
mov dword [esp], eax
call fcn.0049fc30
call edi
mov dword [eax], esi
mov eax, dword [ebp - 0x20]
mov dword [esp + 4], str.copy_to_file___finished_after__lu_bytes_n
mov dword [esp + 8], eax
mov eax, dword [sym.imp.msvcrt.dll__iob]
add eax, 0x40
mov dword [esp], eax
call fcn.0049fc30
mov eax, dword [sym.imp.msvcrt.dll__iob]
add eax, 0x40
mov dword [esp], eax
call sub.msvcrt.dll_fflush
mov dword [esp], 0x4f3068
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
push edx
call edi
mov dword [eax], esi
mov dword [esp], ebx
call fcn.0049f980
lea esp, [ebp - 0xc]
pop ebx
pop esi
pop edi
pop ebp
ret