Function at 0x4059e8
Capabilities:
Check http status code
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:
push ebp
mov ebp, esp
and esp, 0xfffffff8
push 0xffffffffffffffff
push 0x423afa
mov eax, dword fs:[0]
push eax
sub esp, 0x80
push ebx
push esi
push edi
mov eax, dword [0x42f050]
xor eax, esp
push eax
lea eax, [esp + 0x90]
mov dword fs:[0], eax
mov ebx, dword [ebp + 8]
xor esi, esi
cmp ebx, esi
je 0x40625a
mov eax, ebx
lea edx, [eax + 2]
mov cx, word [eax]
inc eax
inc eax
cmp cx, si
jne 0x405a2c
sub eax, edx
sar eax, 1
je 0x40625a
push ebx
call dword [sym.imp.SHLWAPI.dll_PathIsURLW]
test eax, eax
je 0x40625a
cmp dword [ebp + 0x14], esi
je 0x4061fc
cmp dword [ebp + 0x18], esi
jg 0x405a67
cmp dword [ebp + 0x10], 0xffffffff
jne 0x4061fc
mov eax, dword [ebp + 0x10]
cmp dword [ebp + 0xc], eax
jl 0x405ae5
cmp eax, 0xffffffff
je 0x405ae5
cmp dword [0x43059c], 0xffffffff
je 0x4062ce
mov eax, dword [0x4312e4]
mov ecx, 0x4312e4
mov dword [esp + 0x2c], esi
call dword [eax + 0xc]
add eax, 0x10
mov dword [esp + 0x38], eax
push str.DownloadFileChunk_parma_start_and_end_size_error_n
lea eax, [esp + 0x3c]
mov dword [esp + 0x9c], 2
call fcn.004044af
mov edi, dword [esp + 0x3c]
pop ecx
push edi
lea eax, [esp + 0x34]
push eax
call fcn.004036ef
push esi
lea eax, [esp + 0x30]
push eax
mov eax, dword [esp + 0x38]
push dword [eax - 0xc]
push eax
push dword [0x43059c]
call dword [sym.imp.KERNEL32.dll_WriteFile]
mov eax, dword [esp + 0x30]
jmp 0x4062be
lea edi, [esp + 0x4c]
call fcn.00406304
push ebx
lea eax, [esp + 0x40]
push eax
mov dword [esp + 0xa0], 3
call fcn.0040387b
push eax
mov ebx, edi
mov byte [esp + 0x9c], 4
call fcn.0040640a
movzx edi, al
mov byte [esp + 0x98], 3
mov eax, dword [esp + 0x3c]
add eax, 0xfffffff0
call fcn.00404c04
cmp edi, esi
je 0x40618e
cmp dword [esp + 0x80], 3
jne 0x40618e
push esi
push esi
push esi
push esi
push 0x4291f8
call dword [sym.imp.WININET.dll_InternetOpenW]
cmp eax, esi
mov dword [esp + 0x18], eax
jne 0x405bdf
cmp dword [0x43059c], 0xffffffff
je 0x405bd1
mov eax, dword [0x4312e4]
mov ecx, 0x4312e4
mov dword [esp + 0x3c], esi
call dword [eax + 0xc]
add eax, 0x10
mov dword [esp + 0x38], eax
push str.DownloadFileChunk__InternetOpen_error_n
lea eax, [esp + 0x3c]
mov byte [esp + 0x9c], 6
call fcn.004044af
mov edi, dword [esp + 0x3c]
pop ecx
push edi
lea eax, [esp + 0x34]
push eax
call fcn.004036ef
push esi
lea eax, [esp + 0x40]
push eax
mov eax, dword [esp + 0x38]
push dword [eax - 0xc]
push eax
push dword [0x43059c]
call dword [sym.imp.KERNEL32.dll_WriteFile]
mov eax, dword [esp + 0x30]
add eax, 0xfffffff0
call fcn.00404c04
lea eax, [edi - 0x10]
call fcn.00404c04
lea ecx, [esp + 0x4c]
call fcn.00406397
jmp 0x4062ce
mov eax, dword [0x4312e4]
mov edi, 0x4312e4
mov ecx, edi
mov dword [esp + 0x20], 0xbb8
call dword [eax + 0xc]
add eax, 0x10
mov dword [esp + 0x30], eax
cmp dword [ebp + 0x1c], esi
mov byte [esp + 0x98], 7
jne 0x405c21
push dword [ebp + 0x10]
lea eax, [esp + 0x34]
push dword [ebp + 0xc]
push str.Range:_bytes_d__d_r_n
call fcn.004044af
add esp, 0xc
mov ebx, dword [sym.imp.WININET.dll_InternetSetOptionW]
push 4
lea eax, [esp + 0x24]
push eax
push 2
push dword [esp + 0x24]
call ebx
cmp eax, esi
mov dword [esp + 0x14], eax
jne 0x405cb9
cmp dword [0x43059c], 0xffffffff
je 0x406163
mov eax, dword [0x4312e4]
mov ecx, edi
mov dword [esp + 0x3c], esi
call dword [eax + 0xc]
add eax, 0x10
mov dword [esp + 0x38], eax
mov byte [esp + 0x98], 8
push str.DownloadFileChunk__InternetSetOption1_error_n
lea eax, [esp + 0x3c]
call fcn.004044af
mov edi, dword [esp + 0x3c]
pop ecx
push edi
lea eax, [esp + 0x30]
push eax
call fcn.004036ef
push esi
lea eax, [esp + 0x40]
push eax
mov eax, dword [esp + 0x34]
push dword [eax - 0xc]
push eax
push dword [0x43059c]
call dword [sym.imp.KERNEL32.dll_WriteFile]
mov eax, dword [esp + 0x2c]
add eax, 0xfffffff0
call fcn.00404c04
lea eax, [edi - 0x10]
call fcn.00404c04
jmp 0x406163
push 4
lea eax, [esp + 0x24]
push eax
push 5
push dword [esp + 0x24]
call ebx
cmp eax, esi
mov dword [esp + 0x14], eax
jne 0x405d04
cmp dword [0x43059c], 0xffffffff
je 0x406163
mov eax, dword [0x4312e4]
mov ecx, edi
mov dword [esp + 0x3c], esi
call dword [eax + 0xc]
add eax, 0x10
mov dword [esp + 0x38], eax
mov byte [esp + 0x98], 9
push str.DownloadFileChunk__InternetSetOption2_error_n
jmp 0x405c6d
push 4
lea eax, [esp + 0x24]
push eax
push 5
push dword [esp + 0x24]
call ebx
cmp eax, esi
mov dword [esp + 0x14], eax
jne 0x405d4f
cmp dword [0x43059c], 0xffffffff
je 0x406163
mov eax, dword [0x4312e4]
mov ecx, edi
mov dword [esp + 0x3c], esi
call dword [eax + 0xc]
add eax, 0x10
mov dword [esp + 0x38], eax
mov byte [esp + 0x98], 0xa
push str.DownloadFileChunk__InternetSetOption3_error_n
jmp 0x405c6d
push 4
lea eax, [esp + 0x24]
push eax
push 6
push dword [esp + 0x24]
call ebx
cmp eax, esi
mov dword [esp + 0x14], eax
jne 0x405d9a
cmp dword [0x43059c], 0xffffffff
je 0x406163
mov eax, dword [0x4312e4]
mov ecx, edi
mov dword [esp + 0x3c], esi
call dword [eax + 0xc]
add eax, 0x10
mov dword [esp + 0x38], eax
mov byte [esp + 0x98], 0xb
push str.DownloadFileChunk__InternetSetOption4_error_n
jmp 0x405c6d
push 4
lea eax, [esp + 0x24]
push eax
push 6
push dword [esp + 0x24]
call ebx
cmp eax, esi
mov dword [esp + 0x14], eax
jne 0x405de5
cmp dword [0x43059c], 0xffffffff
je 0x406163
mov eax, dword [0x4312e4]
mov ecx, edi
mov dword [esp + 0x3c], esi
call dword [eax + 0xc]
add eax, 0x10
mov dword [esp + 0x38], eax
mov byte [esp + 0x98], 0xc
push str.DownloadFileChunk__InternetSetOption5_error_n
jmp 0x405c6d
push esi
push 0x44000000
push 0xffffffffffffffff
push dword [esp + 0x3c]
push dword [ebp + 8]
push dword [esp + 0x2c]
call dword [sym.imp.WININET.dll_InternetOpenUrlW]
cmp eax, esi
mov dword [esp + 0x2c], eax
jne 0x405e97
cmp dword [0x43059c], 0xffffffff
je 0x405e8e
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov ebx, eax
mov eax, dword [0x4312e4]
mov ecx, edi
mov dword [esp + 0x3c], esi
call dword [eax + 0xc]
add eax, 0x10
mov dword [esp + 0x38], eax
mov byte [esp + 0x98], 0xd
push dword [esp + 0x30]
lea eax, [esp + 0x3c]
push dword [ebp + 8]
push ebx
push str.DownloadFileChunk__InternetOpenUrl_Errorcode_d__fileurl_s_header_s_n
call fcn.004044af
add esp, 0x10
mov edi, dword [esp + 0x38]
push edi
lea eax, [esp + 0x2c]
push eax
call fcn.004036ef
push esi
lea eax, [esp + 0x40]
push eax
mov eax, dword [esp + 0x30]
push dword [eax - 0xc]
push eax
push dword [0x43059c]
call dword [sym.imp.KERNEL32.dll_WriteFile]
mov eax, dword [esp + 0x28]
add eax, 0xfffffff0
call fcn.00404c04
lea eax, [edi - 0x10]
call fcn.00404c04
mov dword [esp + 0x14], esi
jmp 0x406153
mov ebx, dword [sym.imp.WININET.dll_HttpQueryInfoW]
push esi
lea ecx, [esp + 0x44]
push ecx
lea ecx, [esp + 0x2c]
push ecx
push 0x20000013
push eax
mov dword [esp + 0x38], esi
mov dword [esp + 0x54], 4
call ebx
cmp eax, esi
mov dword [esp + 0x14], eax
jne 0x405f3f
cmp dword [0x43059c], 0xffffffff
je 0x406153
mov eax, dword [0x4312e4]
mov ecx, edi
mov dword [esp + 0x3c], esi
call dword [eax + 0xc]
add eax, 0x10
mov dword [esp + 0x38], eax
mov byte [esp + 0x98], 0xe
push str.DownloadFileChunk__HttpQueryInfo_Error_n
lea eax, [esp + 0x3c]
call fcn.004044af
mov edi, dword [esp + 0x3c]
pop ecx
push edi
lea eax, [esp + 0x2c]
push eax
call fcn.004036ef
push esi
lea eax, [esp + 0x40]
push eax
mov eax, dword [esp + 0x30]
push dword [eax - 0xc]
push eax
push dword [0x43059c]
call dword [sym.imp.KERNEL32.dll_WriteFile]
mov eax, dword [esp + 0x28]
add eax, 0xfffffff0
call fcn.00404c04
lea eax, [edi - 0x10]
call fcn.00404c04
jmp 0x406153
cmp dword [esp + 0x24], 0xc8
je 0x405fa0
cmp dword [esp + 0x24], 0x130
je 0x405fa0
cmp dword [esp + 0x24], 0xce
je 0x405fa0
cmp dword [0x43059c], 0xffffffff
je 0x405e8e
mov eax, dword [0x4312e4]
mov ecx, edi
mov dword [esp + 0x3c], esi
call dword [eax + 0xc]
add eax, 0x10
mov dword [esp + 0x38], eax
mov byte [esp + 0x98], 0xf
push dword [esp + 0x24]
lea eax, [esp + 0x3c]
push str.DownloadFileChunk__HttpQueryInfo_status_d_n
call fcn.004044af
pop ecx
pop ecx
jmp 0x405e51
push esi
lea eax, [esp + 0x48]
push eax
lea eax, [esp + 0x3c]
push eax
push 0x20000005
push dword [esp + 0x3c]
mov dword [esp + 0x48], esi
mov dword [esp + 0x58], 4
call ebx
cmp eax, esi
mov dword [esp + 0x14], eax
jne 0x405ffe
cmp dword [0x43059c], 0xffffffff
je 0x406153
mov eax, dword [0x4312e4]
mov ecx, edi
mov dword [esp + 0x3c], esi
call dword [eax + 0xc]
add eax, 0x10
mov dword [esp + 0x38], eax
mov byte [esp + 0x98], 0x10
push str.DownloadFileChunk__HttpQueryInfo2_Error_n
jmp 0x405ef3
mov ebx, dword [ebp + 0x18]
cmp dword [esp + 0x34], ebx
jbe 0x40604c
cmp dword [0x43059c], 0xffffffff
je 0x405e8e
mov eax, dword [0x4312e4]
mov ecx, edi
mov dword [esp + 0x3c], esi
call dword [eax + 0xc]
add eax, 0x10
mov dword [esp + 0x38], eax
push ebx
mov byte [esp + 0x9c], 0x11
push dword [esp + 0x38]
lea eax, [esp + 0x40]
push str.DownloadFileChunk__HttpQueryInfo2_return_and_dwContentLength__d_large_nBufferSize__d__n
call fcn.004044af
add esp, 0xc
jmp 0x405e51
mov ebx, 0x2000
push ebx
call fcn.0040d361
push ebx
push esi
push eax
mov dword [esp + 0x38], eax
mov dword [esp + 0x48], esi
call fcn.00410b00
add esp, 0x10
jmp 0x4060a3
cmp dword [esp + 0x1c], esi
je 0x406141
push dword [esp + 0x1c]
mov eax, dword [ebp + 0x14]
mov ecx, dword [esp + 0x3c]
push dword [esp + 0x2c]
add ecx, eax
push ecx
call fcn.00415540
mov eax, dword [esp + 0x28]
add dword [esp + 0x44], eax
push ebx
push esi
push dword [esp + 0x3c]
call fcn.00410b00
add esp, 0x18
lea eax, [esp + 0x1c]
push eax
push ebx
push dword [esp + 0x30]
mov dword [esp + 0x28], esi
push dword [esp + 0x38]
call dword [sym.imp.WININET.dll_InternetReadFile]
cmp eax, esi
mov dword [esp + 0x14], eax
jne 0x40606c
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp dword [0x43059c], 0xffffffff
mov ebx, eax
je 0x406149
mov eax, dword [0x4312e4]
mov ecx, edi
mov dword [esp + 0x48], esi
call dword [eax + 0xc]
add eax, 0x10
mov dword [esp + 0x38], eax
push ebx
push str.DownloadFileChunk__InternetReadFile_Failed__errorcode_d_n
lea eax, [esp + 0x40]
mov byte [esp + 0xa0], 0x12
call fcn.004044af
mov edi, dword [esp + 0x40]
pop ecx
pop ecx
push edi
lea eax, [esp + 0x40]
push eax
call fcn.004036ef
push esi
lea eax, [esp + 0x4c]
push eax
mov eax, dword [esp + 0x44]
push dword [eax - 0xc]
push eax
push dword [0x43059c]
call dword [sym.imp.KERNEL32.dll_WriteFile]
mov eax, dword [esp + 0x3c]
add eax, 0xfffffff0
call fcn.00404c04
lea eax, [edi - 0x10]
call fcn.00404c04
jmp 0x406149
mov dword [esp + 0x14], 1
push dword [esp + 0x28]
call fcn.0040e404
pop ecx
cmp dword [esp + 0x2c], esi
je 0x406163
push dword [esp + 0x2c]
call dword [sym.imp.WININET.dll_InternetCloseHandle]
push dword [esp + 0x18]
call dword [sym.imp.WININET.dll_InternetCloseHandle]
mov eax, dword [esp + 0x30]
add eax, 0xfffffff0
call fcn.00404c04
lea ecx, [esp + 0x4c]
call fcn.00406397
cmp dword [esp + 0x14], esi
setne al
jmp 0x4062d0
cmp dword [0x43059c], 0xffffffff
je 0x405bd1
mov eax, dword [0x4312e4]
mov ecx, 0x4312e4
mov dword [esp + 0x48], esi
call dword [eax + 0xc]
add eax, 0x10
mov dword [esp + 0x3c], eax
push str.DownloadFileChunk__CUrlParser_Parse_error_n
lea eax, [esp + 0x40]
mov byte [esp + 0x9c], 5
call fcn.004044af
mov edi, dword [esp + 0x40]
pop ecx
push edi
lea eax, [esp + 0x3c]
push eax
call fcn.004036ef
push esi
lea eax, [esp + 0x4c]
push eax
mov eax, dword [esp + 0x40]
push dword [eax - 0xc]
push eax
push dword [0x43059c]
call dword [sym.imp.KERNEL32.dll_WriteFile]
mov eax, dword [esp + 0x38]
jmp 0x405bc1
cmp dword [0x43059c], 0xffffffff
je 0x4062ce
mov eax, dword [0x4312e4]
mov ecx, 0x4312e4
mov dword [esp + 0x38], esi
call dword [eax + 0xc]
add eax, 0x10
mov dword [esp + 0x3c], eax
push str.DownloadFileChunk_parma_pBuffer_error_n
lea eax, [esp + 0x40]
mov dword [esp + 0x9c], 1
call fcn.004044af
pop ecx
push esi
mov esi, dword [esp + 0x40]
lea eax, [esp + 0x3c]
push eax
push dword [esi - 0xc]
push esi
push dword [0x43059c]
call dword [sym.imp.KERNEL32.dll_WriteFile]
lea eax, [esi - 0x10]
jmp 0x4062c9
cmp dword [0x43059c], 0xffffffff
je 0x4062ce
mov eax, dword [0x4312e4]
mov ecx, 0x4312e4
mov dword [esp + 0x30], esi
call dword [eax + 0xc]
add eax, 0x10
mov dword [esp + 0x3c], eax
push str.DownloadFileChunk_parma_pszFileUrl_error_n
lea eax, [esp + 0x40]
mov dword [esp + 0x9c], esi
call fcn.004044af
mov edi, dword [esp + 0x40]
pop ecx
push edi
lea eax, [esp + 0x3c]
push eax
call fcn.004036ef
push esi
lea eax, [esp + 0x34]
push eax
mov eax, dword [esp + 0x40]
push dword [eax - 0xc]
push eax
push dword [0x43059c]
call dword [sym.imp.KERNEL32.dll_WriteFile]
mov eax, dword [esp + 0x38]
add eax, 0xfffffff0
call fcn.00404c04
lea eax, [edi - 0x10]
call fcn.00404c04
xor al, al
mov ecx, dword [esp + 0x90]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret