Function at 0x401c90
Capabilities:
Act as tcp client
Connect socket
Connect tcp socket
Create tcp socket

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x3c
mov eax, dword [0x408004]
xor eax, ebp
mov dword [ebp - 4], eax
push esi
mov esi, ecx
mov al, byte [esi]
cmp al, 5
jne 0x401ee1
push edx
push esi
lea edx, [ebp - 0x38]
lea ecx, [ebp - 0x1c]
call fcn.004014a0
add esp, 8
test eax, eax
jns 0x401cfe
cmp dword [0x408398], 0
je 0x401cde
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
push eax
push str.____SOCKS_thread__08X__DoConnection_could_not_create_socket_structs_n
call fcn.004010b0
add esp, 8
sub esp, 8
mov dl, 1
mov cl, dl
call fcn.00401360
add esp, 8
xor eax, eax
pop esi
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.00403830
mov esp, ebp
pop ebp
ret
mov al, byte [esi + 1]
cmp al, 1
jne 0x401e8d
cmp byte [esi + 3], 4
push 6
push 1
jne 0x401dc4
push 0x17
call dword [sym.imp.WS2_32.dll_socket]
mov esi, eax
cmp esi, 0xffffffff
jne 0x401d6a
cmp dword [0x408398], 0
je 0x401d4a
call dword [sym.imp.WS2_32.dll_WSAGetLastError]
push eax
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
push eax
push str.____SOCKS_thread__08X__DoConnection_socket6___failed_with:__ld_n
call fcn.004010b0
add esp, 0xc
sub esp, 8
mov dl, 4
mov cl, 1
call fcn.00401360
add esp, 8
xor eax, eax
pop esi
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.00403830
mov esp, ebp
pop ebp
ret
push 0x1c
lea eax, [ebp - 0x38]
push eax
push esi
call dword [sym.imp.WS2_32.dll_connect]
cmp eax, 0xffffffff
jne 0x401e6d
cmp dword [0x408398], 0
je 0x401da4
call dword [sym.imp.WS2_32.dll_WSAGetLastError]
push eax
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
push eax
push str.____SOCKS_thread__08X__DoConnection_connect6___failed_with:__ld_n
call fcn.004010b0
add esp, 0xc
sub esp, 8
mov dl, 4
mov cl, 5
call fcn.00401360
add esp, 8
xor eax, eax
pop esi
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.00403830
mov esp, ebp
pop ebp
ret
push 2
call dword [sym.imp.WS2_32.dll_socket]
mov esi, eax
cmp esi, 0xffffffff
jne 0x401e17
cmp dword [0x408398], 0
je 0x401df7
call dword [sym.imp.WS2_32.dll_WSAGetLastError]
push eax
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
push eax
push str.____SOCKS_thread__08X__DoConnection_socket___failed_with:__ld_n
call fcn.004010b0
add esp, 0xc
sub esp, 8
mov dl, 1
mov cl, dl
call fcn.00401360
add esp, 8
xor eax, eax
pop esi
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.00403830
mov esp, ebp
pop ebp
ret
push 0x10
lea eax, [ebp - 0x1c]
push eax
push esi
call dword [sym.imp.WS2_32.dll_connect]
cmp eax, 0xffffffff
jne 0x401e6d
cmp dword [0x408398], 0
je 0x401e4d
call dword [sym.imp.WS2_32.dll_WSAGetLastError]
push eax
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
push eax
push str.____SOCKS_thread__08X__DoConnection_connect___failed_with:__ld_n
call fcn.004010b0
add esp, 0xc
sub esp, 8
mov dl, 1
mov cl, 5
call fcn.00401360
add esp, 8
xor eax, eax
pop esi
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.00403830
mov esp, ebp
pop ebp
ret
sub esp, 8
mov dl, 1
xor cl, cl
call fcn.00401360
add esp, 8
mov eax, esi
pop esi
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.00403830
mov esp, ebp
pop ebp
ret
cmp al, 2
jne 0x401eae
cmp dword [0x408398], 0
je 0x402070
push str.___SOCKS_DoConnection_BIND_n
call fcn.004010b0
mov al, byte [esi + 1]
add esp, 4
cmp al, 3
jne 0x402070
cmp dword [0x408398], 0
je 0x402070
push str.___SOCKS_DoConnection_UDP_ASSOCIATE_n
call fcn.004010b0
add esp, 4
xor eax, eax
pop esi
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.00403830
mov esp, ebp
pop ebp
ret
cmp al, 4
jne 0x402053
push edx
push esi
lea edx, [ebp - 0x38]
lea ecx, [ebp - 0x1c]
call fcn.004014a0
add esp, 8
test eax, eax
jns 0x401f5b
cmp dword [0x408398], 0
mov esi, dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
je 0x401f1c
call esi
push eax
push str.____SOCKS_thread__08X__DoConnection_v4_could_not_create_socket_structs_n
call fcn.004010b0
add esp, 8
xorps xmm0, xmm0
movlpd qword [ebp - 0xc], xmm0
call esi
mov ecx, eax
call fcn.00402de0
push 1
mov byte [ebp - 0xb], 0x5b
lea ecx, [ebp - 0xc]
mov edx, 8
push dword [eax + 4]
lea eax, [ebp - 0x3c]
push eax
call fcn.00401100
add esp, 0xc
xor eax, eax
pop esi
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.00403830
mov esp, ebp
pop ebp
ret
mov al, byte [esi + 1]
cmp al, 1
jne 0x402028
push 6
push 1
push 2
call dword [sym.imp.WS2_32.dll_socket]
mov esi, eax
cmp esi, 0xffffffff
jne 0x401fa4
cmp dword [0x408398], 0
mov esi, dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
je 0x401f1c
call dword [sym.imp.WS2_32.dll_WSAGetLastError]
push eax
call esi
push eax
push str.____SOCKS_thread__08X__DoConnection_v4_socket___failed_with:__ld_n
call fcn.004010b0
add esp, 0xc
jmp 0x401f1c
push 0x10
lea eax, [ebp - 0x1c]
push eax
push esi
call dword [sym.imp.WS2_32.dll_connect]
cmp eax, 0xffffffff
jne 0x401fe5
cmp dword [0x408398], 0
mov esi, dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
je 0x401f1c
call dword [sym.imp.WS2_32.dll_WSAGetLastError]
push eax
call esi
push eax
push str.____SOCKS_thread__08X__DoConnection_v4_connect___failed_with:__ld_n
call fcn.004010b0
add esp, 0xc
jmp 0x401f1c
xorps xmm0, xmm0
movlpd qword [ebp - 0xc], xmm0
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
mov ecx, eax
call fcn.00402de0
push 0
mov byte [ebp - 0xb], 0x5a
lea ecx, [ebp - 0xc]
mov edx, 8
push dword [eax + 4]
lea eax, [ebp - 0x3c]
push eax
call fcn.00401100
add esp, 0xc
mov eax, esi
pop esi
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.00403830
mov esp, ebp
pop ebp
ret
cmp al, 2
jne 0x402070
cmp dword [0x408398], 0
je 0x402070
push str.___SOCKS_DoConnection_v4_BIND_n
call fcn.004010b0
add esp, 4
xor eax, eax
pop esi
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.00403830
mov esp, ebp
pop ebp
ret
cmp dword [0x408398], 0
je 0x402070
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
push eax
push str.____SOCKS_thread__08X__DoConnection_unknown_SOCKS_version_n
call fcn.004010b0
add esp, 8
mov ecx, dword [ebp - 4]
xor eax, eax
xor ecx, ebp
pop esi
call fcn.00403830
mov esp, ebp
pop ebp
ret