Function at 0x408e80
Capabilities:
Check http status code
Check if file exists
Create http request
Download and write a file
Get file size
Get http content length
Read data from internet
Receive and write data from server to client
Receive data
Set file attributes
Write file on windows

Disassembly:
push 0xffffffffffffffff
push 0x439e18
mov eax, dword fs:[0]
push eax
sub esp, 0x34
push ebx
push ebp
push esi
push edi
mov eax, dword [0x44b654]
xor eax, esp
push eax
lea eax, [esp + 0x48]
mov dword fs:[0], eax
mov edi, ecx
mov esi, edx
mov eax, dword [esp + 0x6c]
mov dword [eax], 0
push esi
mov dword [edi], 0
call dword [sym.imp.SHLWAPI.dll_PathFileExistsW]
mov ebx, dword [sym.imp.KERNEL32.dll_CreateFileW]
test eax, eax
je 0x408f84
mov ecx, dword [esp + 0x64]
push esi
call fcn.00408520
add esp, 4
test eax, eax
je 0x408f00
mov dword [edi], 1
mov eax, 1
mov ecx, dword [esp + 0x48]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x40
ret
push 0
push esi
call dword [sym.imp.KERNEL32.dll_SetFileAttributesW]
push 0
push 0
push 3
push 0
push 1
push 0xc0000000
push esi
call ebx
mov ebp, eax
mov dword [esp + 0x18], ebp
cmp ebp, 0xffffffff
je 0x408f84
push 0
push ebp
call dword [sym.imp.KERNEL32.dll_GetFileSize]
mov esi, eax
cmp esi, 0xffffffff
je 0x408f4f
test esi, esi
jbe 0x408f51
mov edx, dword [esp + 0x60]
mov eax, dword [esp + 0x5c]
push edx
call fcn.00408db0
add esp, 4
test eax, eax
jne 0x408f51
xor esi, esi
mov eax, dword [esp + 0x5c]
xor edi, edi
push edi
push edi
push edi
push edi
push eax
call dword [sym.imp.WININET.dll_InternetOpenW]
mov ebx, eax
mov dword [esp + 0x44], ebx
test ebx, ebx
jne 0x408fb6
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov ecx, dword [esp + 0x6c]
push ebp
mov dword [ecx], eax
call dword [sym.imp.KERNEL32.dll_CloseHandle]
jmp 0x4092da
push 0
push 0
push 2
push 0
push 1
push 0xc0000000
push esi
call ebx
mov dword [esp + 0x18], eax
cmp eax, 0xffffffff
jne 0x408fb0
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov ecx, dword [esp + 0x6c]
mov dword [ecx], eax
jmp 0x4092da
mov ebp, dword [esp + 0x18]
jmp 0x408f4f
mov ebp, dword [sym.imp.WININET.dll_InternetSetOptionW]
push 4
lea edx, [esp + 0x28]
push edx
push 0x37
push ebx
mov dword [esp + 0x34], 0x7530
call ebp
push 4
lea eax, [esp + 0x28]
push eax
push 6
push ebx
call ebp
push 4
lea ecx, [esp + 0x28]
push ecx
push 8
push ebx
call ebp
xor ebp, ebp
cmp esi, ebp
jbe 0x40907b
call fcn.004097d0
xor ecx, ecx
cmp eax, ebp
setne cl
cmp ecx, ebp
jne 0x40900c
push 0x80004005
call fcn.00401510
mov edx, dword [eax]
mov ecx, eax
mov eax, dword [edx + 0xc]
call eax
add eax, 0x10
mov dword [esp + 0x28], eax
push esi
lea ecx, [esp + 0x2c]
push str.Range:bytes_d_
push ecx
mov dword [esp + 0x5c], ebp
call fcn.00406880
mov edx, dword [esp + 0x6c]
add esp, 0xc
push ebp
mov ebp, dword [esp + 0x2c]
push SysReAllocStringLen
push 0xffffffffffffffff
push ebp
push edx
push ebx
call dword [sym.imp.WININET.dll_InternetOpenUrlW]
mov edi, eax
test edi, edi
jne 0x409054
xor esi, esi
add ebp, 0xfffffff0
mov dword [esp + 0x50], 0xffffffff
lea eax, [ebp + 0xc]
or ecx, 0xffffffff
lock xadd dword [eax], ecx
dec ecx
test ecx, ecx
jg 0x409079
mov ecx, dword [ebp]
mov edx, dword [ecx]
mov eax, dword [edx + 4]
push ebp
call eax
xor ebp, ebp
mov dword [esp + 0x28], ebp
nop
cmp esi, ebp
jne 0x40909a
mov ecx, dword [esp + 0x60]
push ebp
push 0x84000000
push ebp
push ebp
push ecx
push ebx
call dword [sym.imp.WININET.dll_InternetOpenUrlW]
mov edi, eax
cmp edi, ebp
je 0x409108
push ebp
lea edx, [esp + 0x3c]
push edx
lea eax, [esp + 0x34]
push eax
push 0x20000013
push edi
mov dword [esp + 0x40], ebp
mov dword [esp + 0x4c], 4
call dword [sym.imp.WININET.dll_HttpQueryInfoW]
test eax, eax
mov eax, dword [esp + 0x2c]
je 0x4090dd
cmp esi, ebp
jne 0x4090d4
cmp eax, 0xc8
jmp 0x4090db
jbe 0x40912b
cmp eax, 0xce
je 0x40912b
cmp eax, 0x1a0
jne 0x4092bd
cmp dword [esp + 0x28], ebp
jne 0x4092bd
push edi
call dword [sym.imp.WININET.dll_InternetCloseHandle]
xor esi, esi
mov dword [esp + 0x28], 1
jmp 0x409080
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov edx, dword [esp + 0x18]
mov ecx, dword [esp + 0x6c]
push edx
mov dword [ecx], eax
call dword [sym.imp.KERNEL32.dll_CloseHandle]
push ebx
call dword [sym.imp.WININET.dll_InternetCloseHandle]
jmp 0x4092da
push ebp
lea eax, [esp + 0x40]
push eax
lea ecx, [esp + 0x28]
push ecx
push 0x20000005
push edi
mov dword [esp + 0x34], ebp
mov dword [esp + 0x50], 4
call dword [sym.imp.WININET.dll_HttpQueryInfoW]
test eax, eax
jne 0x409158
mov dword [esp + 0x20], ebp
jmp 0x409183
mov ecx, dword [esp + 0x20]
cmp ecx, ebp
je 0x409183
mov eax, 0x51eb851f
mul ecx
mov ebx, edx
shr ebx, 4
cmp ebx, 0x400
jae 0x40917b
mov ebx, 0x400
jmp 0x409188
cmp ebx, 0x20000
jbe 0x409188
mov ebx, 0x20000
push ebx
push ebp
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
mov edx, dword [esp + 0x20]
push 0
push 0
mov ebp, eax
mov eax, dword [esp + 0x20]
push esi
add edx, esi
push eax
mov dword [esp + 0x2c], 0
mov dword [esp + 0x50], edx
mov dword [esp + 0x44], 1
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov ecx, dword [esp + 0x18]
push ecx
call dword [sym.imp.KERNEL32.dll_SetEndOfFile]
mov eax, dword [esp + 0x1c]
mov dword [esp + 0x28], 1
test eax, eax
jbe 0x409228
mov ecx, dword [esp + 0x68]
add dword [ecx], eax
mov ecx, dword [esp + 0x58]
add esi, eax
test ecx, ecx
je 0x409202
mov edx, dword [esp + 0x40]
push edx
push esi
push 0x465
call fcn.00406950
mov eax, dword [esp + 0x1c]
mov edx, dword [esp + 0x18]
push 0
lea ecx, [esp + 0x34]
push ecx
push eax
push ebp
push edx
mov dword [esp + 0x44], 0
call dword [sym.imp.KERNEL32.dll_WriteFile]
mov eax, dword [esp + 0x30]
cmp eax, dword [esp + 0x1c]
jne 0x40924a
lea ecx, [esp + 0x1c]
push ecx
push ebx
push ebp
push edi
call dword [sym.imp.WININET.dll_InternetReadFile]
mov ecx, eax
mov dword [esp + 0x34], ecx
test ecx, ecx
je 0x409266
mov eax, dword [esp + 0x1c]
test eax, eax
ja 0x4091de
jmp 0x409262
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov edx, dword [esp + 0x6c]
mov ecx, dword [esp + 0x34]
mov dword [edx], eax
mov dword [esp + 0x28], 0
test ecx, ecx
jne 0x40927a
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov ecx, dword [esp + 0x6c]
mov dword [ecx], eax
mov dword [esp + 0x28], 0
push ebp
push 0
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call dword [sym.imp.KERNEL32.dll_HeapFree]
mov edx, dword [esp + 0x18]
push edx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov esi, dword [sym.imp.WININET.dll_InternetCloseHandle]
push edi
call esi
mov eax, dword [esp + 0x44]
push eax
call esi
mov eax, dword [esp + 0x28]
mov ecx, dword [esp + 0x48]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x40
ret
mov edx, dword [esp + 0x18]
mov ecx, dword [esp + 0x6c]
push edx
mov dword [ecx], eax
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov esi, dword [sym.imp.WININET.dll_InternetCloseHandle]
push edi
call esi
push ebx
call esi
xor eax, eax
mov ecx, dword [esp + 0x48]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x40
ret