Function at 0x402772
Capabilities:
Initialize winsock library
Resolve dns

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x5f8
mov dword [ebp - 0x198], 1
and dword [ebp - 0x194], 0
and dword [ebp - 0x1a4], 0
mov eax, dword [sym.imp.WS2_32.dll_WSAAddressToStringA]
mov dword [ebp - 0x1a0], eax
mov eax, dword [sym.imp.KERNEL32.dll_Sleep]
mov dword [ebp - 0x1ec], eax
mov dword [ebp - 0x19c], sub.MSVCRT.dll_memset
mov eax, dword [ebp + 0xc]
mov eax, dword [eax]
mov ecx, dword [ebp + 8]
cmp dword [ecx + eax*4], 0x80000000
je 0x4027d2
mov eax, dword [ebp + 0xc]
mov eax, dword [eax]
mov ecx, dword [ebp + 8]
cmp dword [ecx + eax*4], 0
jne 0x4027d9
xor eax, eax
jmp 0x4029dc
lea eax, [ebp - 0x190]
push eax
push 0x202
call dword [sym.imp.WS2_32.dll_WSAStartup]
lea eax, [ebp - 0x1a4]
push eax
push 0
push 0
push str.www.xunlei.com
call dword [sym.imp.WS2_32.dll_getaddrinfo]
test eax, eax
je 0x402812
push 0x3e8
call dword [ebp - 0x1ec]
jmp 0x4027eb
push dword [ebp - 0x1a4]
call dword [sym.imp.WS2_32.dll_freeaddrinfo]
push 0x40
push 0
lea eax, [ebp - 0x1e8]
push eax
call sub.MSVCRT.dll_memset
add esp, 0xc
lea eax, [ebp - 0x1a4]
push eax
push 0
push 0
push str.www.3_0B6F_415d_B5C7_832F0.com
call dword [sym.imp.WS2_32.dll_getaddrinfo]
test eax, eax
jne 0x402889
mov dword [ebp - 0x194], 0x40
lea eax, [ebp - 0x194]
push eax
lea eax, [ebp - 0x1e8]
push eax
push 0
mov eax, dword [ebp - 0x1a4]
push dword [eax + 0x10]
mov eax, dword [ebp - 0x1a4]
push dword [eax + 0x18]
call dword [ebp - 0x1a0]
push dword [ebp - 0x1a4]
call dword [sym.imp.WS2_32.dll_freeaddrinfo]
xor eax, eax
inc eax
je 0x4029d0
and dword [ebp - 0x5f8], 0
and dword [ebp - 0x5f4], 0
mov eax, dword [ebp + 0xc]
mov eax, dword [eax]
mov ecx, dword [ebp + 8]
mov eax, dword [ecx + eax*4]
mov dword [ebp - 0x5f8], eax
mov eax, dword [ebp + 0xc]
mov eax, dword [eax]
inc eax
mov ecx, dword [ebp + 0xc]
mov dword [ecx], eax
cmp dword [ebp + 0x18], 1
jne 0x402904
push 0x400
push 0
lea eax, [ebp - 0x5f0]
push eax
call sub.MSVCRT.dll_memset
add esp, 0xc
push dword [ebp - 0x5f8]
push 0x40cb44
push str._s._s
lea eax, [ebp - 0x5f0]
push eax
call dword [sym.imp.USER32.dll_wsprintfA]
add esp, 0x10
lea eax, [ebp - 0x5f0]
mov dword [ebp - 0x5f8], eax
lea eax, [ebp - 0x5f4]
push eax
push 0
push 0
push dword [ebp - 0x5f8]
call dword [sym.imp.WS2_32.dll_getaddrinfo]
cmp dword [ebp - 0x5f4], 0
je 0x4029b1
push dword [ebp + 0x14]
push 0
push dword [ebp + 0x10]
call dword [ebp - 0x19c]
add esp, 0xc
lea eax, [ebp + 0x14]
push eax
push dword [ebp + 0x10]
push 0
mov eax, dword [ebp - 0x5f4]
push dword [eax + 0x10]
mov eax, dword [ebp - 0x5f4]
push dword [eax + 0x18]
call dword [sym.imp.WS2_32.dll_WSAAddressToStringA]
movsx eax, byte [ebp - 0x1e8]
test eax, eax
je 0x402989
push dword [ebp + 0x10]
lea eax, [ebp - 0x1e8]
push eax
call dword [sym.imp.KERNEL32.dll_lstrcmpiA]
test eax, eax
jne 0x402989
push dword [ebp - 0x5f4]
call dword [sym.imp.WS2_32.dll_freeaddrinfo]
jmp 0x4029b1
mov eax, dword [ebp + 0x10]
movsx eax, byte [eax]
test eax, eax
jne 0x4029a3
push dword [ebp - 0x5f4]
call dword [sym.imp.WS2_32.dll_freeaddrinfo]
jmp 0x4029b1
push dword [ebp - 0x5f4]
call dword [sym.imp.WS2_32.dll_freeaddrinfo]
jmp 0x4029d0
mov eax, dword [ebp + 0xc]
mov eax, dword [eax]
mov ecx, dword [ebp + 8]
cmp dword [ecx + eax*4], 0x80000000
jne 0x4029cb
and dword [ebp - 0x198], 0
jmp 0x4029d0
jmp 0x402889
call dword [sym.imp.WS2_32.dll_WSACleanup]
mov eax, dword [ebp - 0x198]
leave
ret 0x14