Function at 0x40d500
Capabilities:
Connect to http server
Create http request
Download and write a file
Read data from internet
Receive and write data from server to client
Receive data
Send data
Send http request
Write file on windows

Disassembly:
push ebp
mov ebp, esp
push 0xffffffffffffffff
push 0x410682
mov eax, dword fs:[0]
push eax
mov dword fs:[0], esp
push ecx
sub esp, 0x940
push ebx
push esi
push edi
mov dword [ebp - 0x10], esp
mov dword [ebp - 0x14], 0
lea ecx, [ebp - 0x18]
call sub.MFC42u.DLL_CString::CString_2
mov dword [ebp - 4], 0
lea ecx, [ebp - 0x1c]
call sub.MFC42u.DLL_CString::CString_2
mov byte [ebp - 4], 1
mov word [ebp - 0x20], 0
mov dword [ebp - 0x24], 1
mov dword [ebp - 0x28], 0
mov dword [ebp - 0x2c], 0
mov dword [ebp - 0x30], 0
mov dword [ebp - 0x34], 0
mov dword [ebp - 0x38], 0
mov dword [ebp - 0x3c], 0x84400000
mov dword [ebp - 0x40], 0x400
mov byte [ebp - 0x440], 0
mov ecx, 0xff
xor eax, eax
lea edi, [ebp - 0x43f]
rep stosd dword es:[edi], eax
stosw word es:[edi], ax
stosb byte es:[edi], al
mov dword [ebp - 0x444], 0
mov eax, dword [0x4125a8]
mov dword [ebp - 0x44c], eax
mov ecx, dword [0x4125ac]
mov dword [ebp - 0x448], ecx
mov dword [ebp - 0x454], 0
xor edx, edx
mov dword [ebp - 0x450], edx
lea eax, [ebp - 0x44c]
mov dword [ebp - 0x454], eax
mov dword [ebp - 0x458], str.PPLive_DAC
mov byte [ebp - 4], 2
lea ecx, [ebp - 0x20]
push ecx
lea edx, [ebp - 0x1c]
push edx
lea eax, [ebp - 0x18]
push eax
lea ecx, [ebp - 0x14]
push ecx
mov edx, dword [ebp + 8]
push edx
call sub.MFC42u.DLL_AfxParseURL
mov dword [ebp - 0x904], eax
cmp dword [ebp - 0x904], 0
jne 0x40d630
lea ecx, [ebp - 0x884]
call dword [sym.imp.MSVCRT.dll_public:_void___thiscall_exception::constructor_void_]
push 0x413848
lea eax, [ebp - 0x884]
push eax
call sub.MSVCRT.dll__CxxThrowException
push 0
push 0
push 0
push 1
mov ecx, dword [ebp - 0x458]
push ecx
call dword [sym.imp.WININET.dll_InternetOpenW]
mov dword [ebp - 0x28], eax
cmp dword [ebp - 0x28], 0
jne 0x40d66b
lea ecx, [ebp - 0x890]
call dword [sym.imp.MSVCRT.dll_public:_void___thiscall_exception::constructor_void_]
push 0x413848
lea edx, [ebp - 0x890]
push edx
call sub.MSVCRT.dll__CxxThrowException
lea ecx, [ebp - 0x18]
call fcn.00401910
mov dword [ebp - 0x908], eax
push 0
push 0
push 3
push 0x411628
push 0x411628
mov ax, word [ebp - 0x20]
push eax
mov ecx, dword [ebp - 0x908]
push ecx
mov edx, dword [ebp - 0x28]
push edx
call dword [sym.imp.WININET.dll_InternetConnectW]
mov dword [ebp - 0x2c], eax
cmp dword [ebp - 0x2c], 0
jne 0x40d6c5
lea ecx, [ebp - 0x89c]
call dword [sym.imp.MSVCRT.dll_public:_void___thiscall_exception::constructor_void_]
push 0x413848
lea eax, [ebp - 0x89c]
push eax
call sub.MSVCRT.dll__CxxThrowException
lea ecx, [ebp - 0x1c]
call fcn.00401910
mov dword [ebp - 0x90c], eax
push 0
mov ecx, dword [ebp - 0x3c]
push ecx
lea edx, [ebp - 0x454]
push edx
push 0x411628
push str.HTTP_1.0
mov eax, dword [ebp - 0x90c]
push eax
push 0x412574
mov ecx, dword [ebp - 0x2c]
push ecx
call dword [sym.imp.WININET.dll_HttpOpenRequestW]
mov dword [ebp - 0x30], eax
cmp dword [ebp - 0x30], 0
jne 0x40d726
lea ecx, [ebp - 0x8a8]
call dword [sym.imp.MSVCRT.dll_public:_void___thiscall_exception::constructor_void_]
push 0x413848
lea edx, [ebp - 0x8a8]
push edx
call sub.MSVCRT.dll__CxxThrowException
push 0
push 0
push 0
push 0
mov eax, dword [ebp - 0x30]
push eax
call dword [sym.imp.WININET.dll_HttpSendRequestW]
test eax, eax
jne 0x40d759
lea ecx, [ebp - 0x8b4]
call dword [sym.imp.MSVCRT.dll_public:_void___thiscall_exception::constructor_void_]
push 0x413848
lea ecx, [ebp - 0x8b4]
push ecx
call sub.MSVCRT.dll__CxxThrowException
mov dword [ebp - 0x34], 4
push 0
lea edx, [ebp - 0x34]
push edx
lea eax, [ebp - 0x38]
push eax
push 0x20000013
mov ecx, dword [ebp - 0x30]
push ecx
call dword [sym.imp.WININET.dll_HttpQueryInfoW]
test eax, eax
jne 0x40d79a
lea ecx, [ebp - 0x8c0]
call dword [sym.imp.MSVCRT.dll_public:_void___thiscall_exception::constructor_void_]
push 0x413848
lea edx, [ebp - 0x8c0]
push edx
call sub.MSVCRT.dll__CxxThrowException
mov dword [ebp - 0x45c], 0
mov eax, dword [ebp - 0x38]
mov dword [ebp - 0x910], eax
mov ecx, dword [ebp - 0x910]
sub ecx, 0xc8
mov dword [ebp - 0x910], ecx
cmp dword [ebp - 0x910], 0x69
ja case.0x40d7d6.1
mov eax, dword [ebp - 0x910]
xor edx, edx
mov dl, byte [eax + 0x40daf7]
jmp dword [edx*4 + 0x40daef]
mov dword [ebp - 0x45c], 1
cmp dword [ebp - 0x45c], 0
jne 0x40d80d
lea ecx, [ebp - 0x8cc]
call dword [sym.imp.MSVCRT.dll_public:_void___thiscall_exception::constructor_void_]
push 0x413848
lea ecx, [ebp - 0x8cc]
push ecx
call sub.MSVCRT.dll__CxxThrowException
mov dword [ebp - 0x460], 1
mov dword [ebp - 0x464], 0
mov byte [ebp - 0x864], 0
mov ecx, 0xff
xor eax, eax
lea edi, [ebp - 0x863]
rep stosd dword es:[edi], eax
stosw word es:[edi], ax
stosb byte es:[edi], al
mov dword [ebp - 0x868], 0x400
push 0
lea edx, [ebp - 0x868]
push edx
lea eax, [ebp - 0x864]
push eax
push 5
mov ecx, dword [ebp - 0x30]
push ecx
call dword [sym.imp.WININET.dll_HttpQueryInfoA]
test eax, eax
jne 0x40d86e
mov dword [ebp - 0x460], 0
cmp dword [ebp - 0x460], 0
je 0x40d88d
lea edx, [ebp - 0x864]
push edx
call dword [sym.imp.MSVCRT.dll_atoi]
add esp, 4
mov dword [ebp - 0x464], eax
xor eax, eax
cmp dword [ebp + 0xc], 0
setne al
mov dword [ebp - 0x86c], eax
cmp dword [ebp - 0x86c], 0
je 0x40d8ed
push 0
push 0x80
push 2
push 0
push 3
push 0x40000000
mov ecx, dword [ebp + 0xc]
push ecx
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov dword [ebp - 0x444], eax
cmp dword [ebp - 0x444], 0xffffffff
jne 0x40d8ed
lea ecx, [ebp - 0x8d8]
call dword [sym.imp.MSVCRT.dll_public:_void___thiscall_exception::constructor_void_]
push 0x413848
lea edx, [ebp - 0x8d8]
push edx
call sub.MSVCRT.dll__CxxThrowException
mov dword [ebp - 0x870], 0x400
cmp dword [ebp - 0x460], 0
je 0x40d924
cmp dword [ebp - 0x464], 0x400
jb 0x40d918
mov dword [ebp - 0x870], 0x400
jmp 0x40d924
mov eax, dword [ebp - 0x464]
mov dword [ebp - 0x870], eax
mov dword [ebp - 0x34], 0
lea ecx, [ebp - 0x34]
push ecx
mov edx, dword [ebp - 0x870]
push edx
lea eax, [ebp - 0x440]
push eax
mov ecx, dword [ebp - 0x30]
push ecx
call dword [sym.imp.WININET.dll_InternetReadFile]
test eax, eax
jne 0x40d968
lea ecx, [ebp - 0x8e4]
call dword [sym.imp.MSVCRT.dll_public:_void___thiscall_exception::constructor_void_]
push 0x413848
lea edx, [ebp - 0x8e4]
push edx
call sub.MSVCRT.dll__CxxThrowException
cmp dword [ebp - 0x34], 0
je 0x40da10
mov dword [ebp - 0x874], 0
cmp dword [ebp - 0x86c], 0
je 0x40d9c7
push 0
lea eax, [ebp - 0x874]
push eax
mov ecx, dword [ebp - 0x34]
push ecx
lea edx, [ebp - 0x440]
push edx
mov eax, dword [ebp - 0x444]
push eax
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
jne 0x40d9c7
lea ecx, [ebp - 0x8f0]
call dword [sym.imp.MSVCRT.dll_public:_void___thiscall_exception::constructor_void_]
push 0x413848
lea ecx, [ebp - 0x8f0]
push ecx
call sub.MSVCRT.dll__CxxThrowException
cmp dword [ebp - 0x460], 0
je 0x40da0e
mov edx, dword [ebp - 0x464]
sub edx, dword [ebp - 0x34]
mov dword [ebp - 0x464], edx
cmp dword [ebp - 0x464], 0
jne 0x40d9ea
jmp 0x40da1c
cmp dword [ebp - 0x464], 0x400
jb 0x40da02
mov dword [ebp - 0x870], 0x400
jmp 0x40da0e
mov eax, dword [ebp - 0x464]
mov dword [ebp - 0x870], eax
jmp 0x40da12
jmp 0x40da1c
cmp dword [ebp - 0x34], 0
jne 0x40d924
cmp dword [ebp - 0x460], 0
je 0x40da4b
cmp dword [ebp - 0x464], 0
je 0x40da4b
lea ecx, [ebp - 0x8fc]
call dword [sym.imp.MSVCRT.dll_public:_void___thiscall_exception::constructor_void_]
push 0x413848
lea ecx, [ebp - 0x8fc]
push ecx
call sub.MSVCRT.dll__CxxThrowException
jmp 0x40da5a
mov dword [ebp - 4], 1
cmp dword [ebp - 0x30], 0
je 0x40da71
mov edx, dword [ebp - 0x30]
push edx
call dword [sym.imp.WININET.dll_InternetCloseHandle]
cmp dword [ebp - 0x2c], 0
je 0x40da81
mov eax, dword [ebp - 0x2c]
push eax
call dword [sym.imp.WININET.dll_InternetCloseHandle]
cmp dword [ebp - 0x28], 0
je 0x40da91
mov ecx, dword [ebp - 0x28]
push ecx
call dword [sym.imp.WININET.dll_InternetCloseHandle]
cmp dword [ebp - 0x444], 0
je 0x40dab4
mov edx, dword [ebp - 0x444]
push edx
call dword [sym.imp.KERNEL32.dll_FlushFileBuffers]
mov eax, dword [ebp - 0x444]
push eax
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov ecx, dword [ebp - 0x24]
mov dword [ebp - 0x900], ecx
mov byte [ebp - 4], 0
lea ecx, [ebp - 0x1c]
call sub.MFC42u.DLL_CString::CString
mov dword [ebp - 4], 0xffffffff
lea ecx, [ebp - 0x18]
call sub.MFC42u.DLL_CString::CString
mov eax, dword [ebp - 0x900]
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret