Function at 0x40f940
Capabilities:
Write file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x65c
mov eax, dword [0x417084]
xor eax, ebp
mov dword [ebp - 4], eax
mov dword [ebp - 0x13c], 0
mov byte [ebp - 0x258], 0
push 0x108
push 0
lea eax, [ebp - 0x257]
push eax
call fcn.004049e0
add esp, 0xc
mov dword [ebp - 0x138], 0
mov dword [ebp - 0x65c], 0
mov dword [ebp - 0x128], 0
mov dword [ebp - 0x130], 0
mov dword [ebp - 0x134], 0xffffffff
mov dword [ebp - 0x148], 0
xor ecx, ecx
mov dword [ebp - 0x144], ecx
mov byte [ebp - 0x110], 0
push 0x103
push 0
lea edx, [ebp - 0x10f]
push edx
call fcn.004049e0
add esp, 0xc
mov byte [ebp - 0x658], 0
push 0x3ff
push 0
lea eax, [ebp - 0x657]
push eax
call fcn.004049e0
add esp, 0xc
lea ecx, [ebp - 0x258]
push ecx
mov edx, dword [ebp + 0x10]
push edx
movzx eax, byte [ebp + 0xc]
push eax
mov ecx, dword [ebp + 8]
push ecx
call fcn.0040f590
add esp, 0x10
mov dword [ebp - 0x13c], eax
cmp dword [ebp - 0x13c], 0
je 0x40fa67
mov edx, dword [ebp - 0x13c]
push edx
mov eax, dword [ebp + 0x10]
push eax
push str.RCM_BeginDownloadFile__s__failed:__d_n
lea ecx, [ebp - 0x658]
push ecx
call fcn.00404c98
add esp, 0x10
lea edx, [ebp - 0x658]
push edx
call fcn.0040e430
add esp, 4
lea eax, [ebp - 0x658]
push eax
call fcn.0040e490
jmp 0x40fce3
push 0
push 0
push 2
push 0
push 3
push 0xc0000000
mov ecx, dword [ebp + 0x14]
push ecx
call dword [sym.imp.KERNEL32.dll_CreateFileA]
mov dword [ebp - 0x134], eax
cmp dword [ebp - 0x134], 0xffffffff
jne 0x40fafe
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov dword [ebp - 0x13c], eax
cmp dword [ebp - 0x13c], 3
jne 0x40fafe
lea edx, [ebp - 0x110]
push edx
mov eax, dword [ebp + 0x14]
push eax
call fcn.0040d870
lea ecx, [ebp - 0x110]
push ecx
call fcn.0040d7a0
mov dword [ebp - 0x13c], 0
push 0
push 0
push 2
push 0
push 3
push 0xc0000000
mov edx, dword [ebp + 0x14]
push edx
call dword [sym.imp.KERNEL32.dll_CreateFileA]
mov dword [ebp - 0x134], eax
cmp dword [ebp - 0x134], 0xffffffff
jne 0x40fafe
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov dword [ebp - 0x13c], eax
cmp dword [ebp - 0x13c], 0
je 0x40fb4b
mov eax, dword [ebp - 0x13c]
push eax
mov ecx, dword [ebp + 0x14]
push ecx
push str.CreateFile__s__failed:__d_n
lea edx, [ebp - 0x658]
push edx
call fcn.00404c98
add esp, 0x10
lea eax, [ebp - 0x658]
push eax
call fcn.0040e430
add esp, 4
lea ecx, [ebp - 0x658]
push ecx
call fcn.0040e490
jmp 0x40fce3
mov edx, dword [ebp - 0x257]
shr edx, 0x12
mov dword [ebp - 0x138], edx
mov eax, dword [ebp - 0x257]
xor edx, edx
mov ecx, 0x40000
div ecx
mov dword [ebp - 0x65c], edx
cmp dword [ebp - 0x65c], 0
je 0x40fb87
mov edx, dword [ebp - 0x138]
add edx, 1
mov dword [ebp - 0x138], edx
mov dword [ebp - 0x128], 0x40000
mov dword [ebp - 0x120], 0
mov dword [ebp - 0x11c], 0
mov dword [ebp - 0x124], 0
jmp 0x40fbc0
mov eax, dword [ebp - 0x124]
add eax, 1
mov dword [ebp - 0x124], eax
mov ecx, dword [ebp - 0x124]
cmp ecx, dword [ebp - 0x138]
jae 0x40fc8c
mov edx, dword [ebp - 0x138]
sub edx, 1
cmp dword [ebp - 0x124], edx
jne 0x40fbf8
cmp dword [ebp - 0x65c], 0
jbe 0x40fbf8
mov eax, dword [ebp - 0x65c]
mov dword [ebp - 0x128], eax
lea ecx, [ebp - 0x130]
push ecx
mov edx, dword [ebp - 0x128]
push edx
mov eax, dword [ebp - 0x120]
push eax
mov ecx, dword [0x418b74]
push ecx
mov edx, dword [ebp + 8]
push edx
call fcn.0040f1d0
add esp, 0x14
mov dword [ebp - 0x13c], eax
cmp dword [ebp - 0x13c], 0
je 0x40fc31
jmp 0x40fc8c
push 0
lea eax, [ebp - 0x114]
push eax
mov ecx, dword [ebp - 0x128]
push ecx
mov edx, dword [0x418b74]
push edx
mov eax, dword [ebp - 0x134]
push eax
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
jne 0x40fc67
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov dword [ebp - 0x13c], eax
jmp 0x40fc8c
mov ecx, dword [ebp - 0x128]
xor edx, edx
add ecx, dword [ebp - 0x120]
adc edx, dword [ebp - 0x11c]
mov dword [ebp - 0x120], ecx
mov dword [ebp - 0x11c], edx
jmp 0x40fbb1
cmp dword [ebp - 0x13c], 0
je 0x40fc99
jmp 0x40fce3
mov eax, dword [ebp - 0x257]
xor ecx, ecx
mov dword [ebp - 0x148], eax
mov dword [ebp - 0x144], ecx
lea edx, [ebp - 0x148]
push edx
mov eax, dword [ebp - 0x134]
push eax
call fcn.0040d740
mov dword [ebp - 0x13c], eax
cmp dword [ebp - 0x13c], 0
je 0x40fce3
mov ecx, dword [ebp - 0x13c]
push ecx
push str.RTNETDRV:_RCM_SetFileSize_result:_0x_x_n
call fcn.0040529e
add esp, 8
push 1
mov edx, dword [ebp + 8]
push edx
call fcn.0040f080
add esp, 8
cmp dword [ebp - 0x134], 0xffffffff
je 0x40fd07
mov eax, dword [ebp - 0x134]
push eax
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov eax, dword [ebp - 0x13c]
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.00402b6d
mov esp, ebp
pop ebp
ret