Function at 0x406f20
Capabilities:
Check internet connectivity via wininet
Create http request
Download and write a file
Get http content length
Read data from internet
Receive and write data from server to client
Receive data
Write file on windows

Disassembly:
sub esp, 0x184
mov eax, dword [0x487264]
xor eax, esp
mov dword [esp + 0x180], eax
mov eax, dword [esp + 0x190]
mov ecx, dword [esp + 0x194]
mov edx, dword [esp + 0x198]
push ebx
push ebp
mov ebp, dword [esp + 0x194]
push esi
mov esi, dword [esp + 0x194]
xor ebx, ebx
push 0x3f
mov dword [esp + 0x18], eax
lea eax, [esp + 0x4d]
push ebx
push eax
mov dword [esp + 0x30], ecx
mov dword [esp + 0x40], edx
mov byte [esp + 0x54], bl
call fcn.004441f0
mov edx, dword [0x45ea1c]
mov ecx, dword [str.Accept:___r_n_r_n]
mov eax, dword [0x45ea20]
mov dword [esp + 0x48], edx
xor edx, edx
add esp, 0xc
cmp ebp, ebx
sete dl
mov dword [esp + 0x38], ecx
mov ecx, dword [0x45ea24]
mov dword [esp + 0x40], eax
mov dword [esp + 0x44], ecx
mov dword [esp + 0x18], ebx
mov dword [esp + 0x10], ebx
mov dword [esp + 0x30], 4
mov dword [esp + 0x20], edx
mov dword [esp + 0x2c], ebx
cmp esi, ebx
jne 0x406fe0
pop esi
pop ebp
xor eax, eax
pop ebx
mov ecx, dword [esp + 0x180]
xor ecx, esp
call fcn.00443a17
add esp, 0x184
ret
push ebx
lea eax, [esp + 0x2c]
push eax
call dword [sym.imp.WININET.dll_InternetGetConnectedState]
test byte [esp + 0x28], 0x20
jne 0x406fc6
lea edx, [esp + 0x88]
mov eax, esi
sub edx, esi
mov edi, edi
mov cl, byte [eax]
mov byte [edx + eax], cl
inc eax
cmp cl, bl
jne 0x407000
lea ecx, [esp + 0x90]
push 0x2f
push ecx
call fcn.00444cf0
add esp, 8
cmp eax, ebx
je 0x407022
mov byte [eax], bl
push ebx
push 1
lea edx, [esp + 0x90]
push edx
call dword [sym.imp.WININET.dll_InternetCheckConnectionA]
test eax, eax
je 0x406fc6
push edi
call dword [sym.imp.WINMM.dll_timeGetTime]
push eax
lea eax, [esp + 0x50]
push str.Agent_ld
push eax
call fcn.00444326
add esp, 0xc
test byte [esp + 0x2c], 4
push ebx
push ebx
push ebx
jne 0x407070
push 4
lea ecx, [esp + 0x5c]
push ecx
call dword [sym.imp.WININET.dll_InternetOpenA]
mov edi, eax
mov dword [esp + 0x10], edi
jmp 0x407082
push ebx
lea edx, [esp + 0x5c]
push edx
call dword [sym.imp.WININET.dll_InternetOpenA]
mov dword [esp + 0x10], eax
mov edi, eax
cmp edi, ebx
je 0x407248
push ebx
push 0x84000100
lea eax, [esp + 0x44]
push eax
call dword [sym.imp.KERNEL32.dll_lstrlenA]
push eax
lea ecx, [esp + 0x48]
push ecx
push esi
push edi
call dword [sym.imp.WININET.dll_InternetOpenUrlA]
mov edi, eax
cmp edi, ebx
jne 0x4070c1
mov edx, dword [esp + 0x10]
push edx
call dword [sym.imp.WININET.dll_InternetCloseHandle]
xor eax, eax
jmp 0x407277
push ebx
lea eax, [esp + 0x38]
push eax
lea ecx, [esp + 0x1c]
push ecx
push 0x20000005
push edi
call dword [sym.imp.WININET.dll_HttpQueryInfoA]
test eax, eax
jne 0x4070e5
mov dword [esp + 0x14], ebx
jmp 0x4071a9
mov eax, dword [esp + 0x14]
cmp eax, ebx
je 0x407238
mov ecx, dword [esp + 0x28]
mov dword [ecx], ebx
cmp dword [esp + 0x24], ebx
je 0x407191
push eax
call fcn.00444431
add esp, 4
mov dword [esp + 0x30], eax
cmp eax, ebx
je 0x407127
mov ecx, dword [esp + 0x14]
mov edx, dword [esp + 0x18]
push ecx
push ebx
push eax
mov dword [edx], eax
call fcn.004441f0
add esp, 0xc
mov ebp, ebx
push 0x10000
mov dword [esp + 0x1c], ebx
call fcn.00425270
mov esi, eax
add esp, 4
cmp esi, ebx
je 0x407238
push 0x10000
push ebx
push esi
call fcn.004441f0
add esp, 0xc
lea ecx, [esp + 0x20]
push ecx
push 0x10000
push esi
push edi
call dword [sym.imp.WININET.dll_InternetReadFile]
test eax, eax
je 0x407229
lea ecx, [ecx]
mov eax, dword [esp + 0x20]
cmp eax, ebx
je 0x40724c
cmp dword [esp + 0x24], ebx
jne 0x4071c0
push ebp
push eax
push 1
push esi
call fcn.00445266
add esp, 0x10
jmp 0x4071e1
push 0x45ea00
push ebp
call fcn.004450ed
mov ebp, eax
add esp, 8
mov dword [esp + 0x1c], ebp
cmp ebp, ebx
jne 0x407129
mov esi, dword [sym.imp.WININET.dll_InternetCloseHandle]
push edi
call esi
mov edx, dword [esp + 0x10]
push edx
call esi
xor eax, eax
jmp 0x407277
mov ebp, dword [esp + 0x28]
mov edx, dword [ebp]
add edx, dword [esp + 0x30]
push eax
push esi
push edx
call fcn.004452f0
mov eax, dword [esp + 0x2c]
add esp, 0xc
add dword [ebp], eax
mov ebp, dword [esp + 0x1c]
mov ecx, dword [esp + 0x20]
mov eax, dword [esp + 0x38]
add dword [esp + 0x18], ecx
cmp eax, ebx
je 0x407200
mov edx, dword [esp + 0x14]
mov ecx, dword [esp + 0x18]
push edx
push ecx
call eax
add esp, 8
push 0x10000
push ebx
push esi
call fcn.004441f0
add esp, 0xc
lea edx, [esp + 0x20]
push edx
push 0x10000
push esi
push edi
call dword [sym.imp.WININET.dll_InternetReadFile]
test eax, eax
jne 0x407170
push esi
call fcn.00425265
push ebp
call fcn.00444fad
add esp, 8
mov esi, dword [sym.imp.WININET.dll_InternetCloseHandle]
push edi
call esi
mov eax, dword [esp + 0x10]
push eax
call esi
xor eax, eax
jmp 0x407277
push esi
call fcn.00425265
add esp, 4
cmp ebp, ebx
je 0x407262
push ebp
call fcn.00444fad
add esp, 4
mov esi, dword [sym.imp.WININET.dll_InternetCloseHandle]
push edi
call esi
mov ecx, dword [esp + 0x10]
push ecx
call esi
mov eax, 1
mov ecx, dword [esp + 0x190]
pop edi
pop esi
pop ebp
pop ebx
xor ecx, esp
call fcn.00443a17
add esp, 0x184
ret