Function at 0x4a5df8
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 0x4a5e24
mov dword [esp], str.couldnt_allocate_buffer_for_copy_to_file
call fcn.0040a7b0
test byte [0x4ee060], 1
je 0x4a5ed7
mov esi, dword [sym.imp.msvcrt.dll__errno]
call esi
mov eax, dword [eax]
mov dword [esp], 0x4ee068
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], 0x4ac173
mov dword [esp + 0x10], ecx
mov dword [esp + 0xc], eax
lea eax, [edx + 0x40]
mov dword [esp], eax
call fcn.0049e490
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.0049e490
mov edx, dword [sym.imp.msvcrt.dll__iob]
lea eax, [edx + 0x40]
mov dword [esp], eax
call sub.msvcrt.dll_fflush
mov dword [esp], 0x4ee068
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
push edx
call esi
mov ecx, dword [ebp - 0x20]
mov dword [eax], ecx
test edi, edi
jne 0x4a5ee7
mov dword [esp], 0
call fcn.0041a310
mov dword [ebp - 0x20], 0
test edi, edi
mov dword [esp + 8], 0x8000
mov dword [esp + 4], ebx
jne 0x4a5f0e
mov dword [esp], 0
call fcn.0041a540
mov esi, eax
jmp 0x4a5f18
mov dword [esp], edi
call fcn.00417970
mov esi, eax
test esi, esi
jne 0x4a5fcf
test byte [0x4ee060], 1
je 0x4a618b
mov edx, dword [sym.imp.msvcrt.dll__errno]
mov dword [ebp - 0x24], edx
call edx
mov eax, dword [eax]
mov dword [esp], 0x4ee068
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], 0x4ac173
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.0049e490
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.0049e490
mov eax, dword [sym.imp.msvcrt.dll__iob]
add eax, 0x40
mov dword [esp], eax
call sub.msvcrt.dll_fflush
mov dword [esp], 0x4ee068
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov edx, dword [ebp - 0x1c]
push eax
call edx
mov dword [eax], esi
jmp 0x4a618b
jns 0x4a6138
call dword [sym.imp.msvcrt.dll__errno]
cmp dword [eax], 4
mov eax, dword [0x4ee060]
jne 0x4a608b
test al, 1
je 0x4a5eee
call dword [sym.imp.msvcrt.dll__errno]
mov esi, dword [eax]
mov dword [esp], 0x4ee068
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], 0x4ac173
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.0049e490
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.0049e490
mov eax, dword [sym.imp.msvcrt.dll__iob]
add eax, 0x40
mov dword [esp], eax
call sub.msvcrt.dll_fflush
mov dword [esp], 0x4ee068
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
push eax
call dword [sym.imp.msvcrt.dll__errno]
mov dword [eax], esi
jmp 0x4a5eee
test al, 1
je 0x4a618b
call dword [sym.imp.msvcrt.dll__errno]
mov eax, dword [eax]
mov dword [esp], 0x4ee068
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], 0x4ac173
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.0049e490
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.0049e490
mov eax, dword [sym.imp.msvcrt.dll__iob]
add eax, 0x40
mov dword [esp], eax
call sub.msvcrt.dll_fflush
mov dword [esp], 0x4ee068
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
push eax
call dword [sym.imp.msvcrt.dll__errno]
mov dword [eax], esi
jmp 0x4a618b
cmp dword [ebp - 0x1c], 1
jne 0x4a6170
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 0x4a6183
mov eax, dword [ebp - 0x1c]
mov dword [esp + 8], esi
mov dword [esp + 4], ebx
mov dword [esp], eax
call fcn.004179b0
add dword [ebp - 0x20], esi
jmp 0x4a5eee
test edi, edi
jne 0x4a619b
mov dword [esp], 0
call fcn.0041a440
test byte [0x4ee060], 1
je 0x4a623e
mov edi, dword [sym.imp.msvcrt.dll__errno]
call edi
mov esi, dword [eax]
mov dword [esp], 0x4ee068
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], 0x4ac173
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.0049e490
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.0049e490
mov eax, dword [sym.imp.msvcrt.dll__iob]
add eax, 0x40
mov dword [esp], eax
call sub.msvcrt.dll_fflush
mov dword [esp], 0x4ee068
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
push edx
call edi
mov dword [eax], esi
mov dword [esp], ebx
call fcn.0049e1d0
lea esp, [ebp - 0xc]
pop ebx
pop esi
pop edi
pop ebp
ret