Function at 0x402140
Capabilities:
Connect socket
Get socket status

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x24c
mov eax, dword [0x411020]
xor eax, ebp
mov dword [ebp - 4], eax
mov dword [ebp - 0x230], 0xffffffff
mov dword [ebp - 0x240], 0xffffffff
mov dword [ebp - 0x244], 0
mov dword [ebp - 0x114], 0
mov byte [ebp - 0x23c], 0
xor eax, eax
mov dword [ebp - 0x23b], eax
mov dword [ebp - 0x237], eax
mov byte [ebp - 0x233], al
cmp dword [ebp + 0xc], 0
jl 0x4021a5
cmp dword [ebp + 0xc], 0x10000
jl 0x4021af
mov eax, 4
jmp 0x402564
mov ecx, dword [ebp + 0xc]
push ecx
push 0x40eaa0
lea edx, [ebp - 0x23c]
push edx
call fcn.004033fc
add esp, 0xc
cmp dword [ebp + 0x10], 0
jge 0x4021d4
mov dword [ebp + 0x10], 0
lea eax, [ebp - 0x23c]
push eax
mov ecx, dword [ebp + 8]
push ecx
call fcn.004020b0
add esp, 8
mov dword [ebp - 0x114], eax
cmp dword [ebp - 0x114], 0
jne 0x402200
mov eax, 3
jmp 0x402564
mov edx, dword [ebp - 0x114]
mov dword [ebp - 0x244], edx
jmp 0x40221d
mov eax, dword [ebp - 0x244]
mov ecx, dword [eax + 0x1c]
mov dword [ebp - 0x244], ecx
cmp dword [ebp - 0x244], 0
je 0x40252d
mov edx, dword [ebp - 0x244]
cmp dword [edx + 4], 2
je 0x402244
mov eax, dword [ebp - 0x244]
cmp dword [eax + 4], 0x17
je 0x402244
jmp 0x40220e
mov ecx, dword [ebp - 0x244]
mov edx, dword [ecx + 0xc]
push edx
mov eax, dword [ebp - 0x244]
mov ecx, dword [eax + 8]
push ecx
mov edx, dword [ebp - 0x244]
mov eax, dword [edx + 4]
push eax
call dword [sym.imp.WS2_32.dll_socket]
mov dword [ebp - 0x230], eax
cmp dword [ebp - 0x230], 0xffffffff
jne 0x402279
jmp 0x40220e
mov ecx, dword [ebp - 0x230]
push ecx
call fcn.00402580
add esp, 4
mov edx, dword [ebp - 0x244]
mov eax, dword [edx + 0x10]
push eax
mov ecx, dword [ebp - 0x244]
mov edx, dword [ecx + 0x18]
push edx
mov eax, dword [ebp - 0x230]
push eax
call dword [sym.imp.WS2_32.dll_connect]
test eax, eax
jge 0x40230a
call dword [sym.imp.WS2_32.dll_WSAGetLastError]
mov dword [ebp - 0x240], eax
cmp dword [ebp - 0x240], 0x2748
jne 0x4022d4
mov dword [ebp - 0x240], 0
jmp 0x40252d
cmp dword [ebp - 0x240], 0x2734
je 0x40230a
cmp dword [ebp - 0x240], 0x2733
je 0x40230a
cmp dword [ebp - 0x240], 0x2726
je 0x40230a
mov ecx, dword [ebp - 0x230]
push ecx
call dword [sym.imp.WS2_32.dll_closesocket]
jmp 0x40220e
mov dword [ebp - 0x220], 0
mov dword [ebp - 0x110], 0
mov dword [ebp - 0x248], 0
jmp 0x402339
mov edx, dword [ebp - 0x248]
add edx, 1
mov dword [ebp - 0x248], edx
mov eax, dword [ebp - 0x248]
cmp eax, dword [ebp - 0x220]
jae 0x402360
mov ecx, dword [ebp - 0x248]
mov edx, dword [ebp + ecx*4 - 0x21c]
cmp edx, dword [ebp - 0x230]
jne 0x40235e
jmp 0x402360
jmp 0x40232a
mov eax, dword [ebp - 0x248]
cmp eax, dword [ebp - 0x220]
jne 0x402399
cmp dword [ebp - 0x220], 0x40
jae 0x402399
mov ecx, dword [ebp - 0x248]
mov edx, dword [ebp - 0x230]
mov dword [ebp + ecx*4 - 0x21c], edx
mov eax, dword [ebp - 0x220]
add eax, 1
mov dword [ebp - 0x220], eax
xor ecx, ecx
jne 0x40231e
mov dword [ebp - 0x24c], 0
jmp 0x4023b8
mov edx, dword [ebp - 0x24c]
add edx, 1
mov dword [ebp - 0x24c], edx
mov eax, dword [ebp - 0x24c]
cmp eax, dword [ebp - 0x110]
jae 0x4023df
mov ecx, dword [ebp - 0x24c]
mov edx, dword [ebp + ecx*4 - 0x10c]
cmp edx, dword [ebp - 0x230]
jne 0x4023dd
jmp 0x4023df
jmp 0x4023a9
mov eax, dword [ebp - 0x24c]
cmp eax, dword [ebp - 0x110]
jne 0x402418
cmp dword [ebp - 0x110], 0x40
jae 0x402418
mov ecx, dword [ebp - 0x24c]
mov edx, dword [ebp - 0x230]
mov dword [ebp + ecx*4 - 0x10c], edx
mov eax, dword [ebp - 0x110]
add eax, 1
mov dword [ebp - 0x110], eax
xor ecx, ecx
jne 0x40239d
cmp dword [ebp + 0x10], 0
jle 0x402443
mov edx, dword [ebp + 0x10]
mov dword [ebp - 0x22c], edx
mov dword [ebp - 0x228], 0
lea eax, [ebp - 0x22c]
mov dword [ebp - 0x224], eax
jmp 0x40244d
mov dword [ebp - 0x224], 0
mov ecx, dword [ebp - 0x224]
push ecx
lea edx, [ebp - 0x110]
push edx
lea eax, [ebp - 0x220]
push eax
push 0
push 0
call dword [sym.imp.WS2_32.dll_select]
mov dword [ebp - 0x240], eax
cmp dword [ebp - 0x240], 0
jge 0x40248d
mov ecx, dword [ebp - 0x230]
push ecx
call dword [sym.imp.WS2_32.dll_closesocket]
jmp 0x40220e
cmp dword [ebp - 0x240], 0
jne 0x4024af
mov dword [ebp - 0x240], 5
mov edx, dword [ebp - 0x230]
push edx
call dword [sym.imp.WS2_32.dll_closesocket]
jmp 0x40252d
mov eax, dword [ebp - 0x244]
mov ecx, dword [eax + 0x10]
push ecx
mov edx, dword [ebp - 0x244]
mov eax, dword [edx + 0x18]
push eax
mov ecx, dword [ebp - 0x230]
push ecx
call dword [sym.imp.WS2_32.dll_connect]
mov dword [ebp - 0x240], eax
cmp dword [ebp - 0x240], 0
jne 0x4024e1
jmp 0x40252d
call dword [sym.imp.WS2_32.dll_WSAGetLastError]
mov dword [ebp - 0x240], eax
lea edx, [ebp - 0x110]
push edx
mov eax, dword [ebp - 0x230]
push eax
call sub.WS2_32.dll___WSAFDIsSet
test eax, eax
jne 0x402528
cmp dword [ebp - 0x240], 0x2748
je 0x40251c
cmp dword [ebp - 0x240], 0x2726
jne 0x402528
mov dword [ebp - 0x240], 0
jmp 0x40252d
jmp 0x40220e
mov ecx, dword [ebp - 0x230]
push ecx
call dword [sym.imp.WS2_32.dll_closesocket]
mov edx, dword [ebp - 0x114]
push edx
call fcn.004033d0
cmp dword [ebp - 0x240], 0
je 0x402558
cmp dword [ebp - 0x240], 5
jne 0x40255f
mov eax, 1
jmp 0x402564
mov eax, 2
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.004036ba
mov esp, ebp
pop ebp
ret