Function at 0x401110
Capabilities:
Connect socket
Get socket status
Initialize winsock library
Set socket configuration
Terminate process

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x2f4
mov eax, dword [0x406004]
xor eax, ebp
mov dword [ebp - 4], eax
cmp dword [0x406380], 0
push ebx
push esi
push edi
mov edi, ecx
mov dword [ebp - 0x2dc], 1
movzx ecx, word [0x406388]
mov dword [ebp - 0x2d8], ecx
mov dword [ebp - 0x2e0], 0x20000
mov dword [ebp - 0x2e4], 1
jne 0x4011a3
lea eax, [ebp - 0x2d0]
push eax
push 0x202
call dword [sym.imp.WS2_32.dll_WSAStartup]
test eax, eax
je 0x401193
push str.WSAStartup_failed__n
push 2
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll___acrt_iob_func]
add esp, 4
push eax
call fcn.00401010
add esp, 8
push 0xffffffffffffffff
call dword [sym.imp.KERNEL32.dll_ExitProcess]
mov ecx, dword [ebp - 0x2d8]
mov dword [0x406380], 1
movzx eax, word [edi]
cmp eax, 2
jne 0x4011b7
mov dword [ebp - 0x2d4], 0x10
jmp 0x4011ca
cmp eax, 0x17
jne 0x40140f
mov dword [ebp - 0x2d4], 0x1c
push ecx
call dword [sym.imp.WS2_32.dll_htons]
movzx eax, ax
push 6
mov word [edi + 2], ax
movzx eax, word [edi]
push 1
push eax
call dword [sym.imp.WS2_32.dll_socket]
mov esi, eax
cmp esi, 0xffffffff
jne 0x40120e
push str.socket__
call dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll_perror]
add esp, 4
or eax, esi
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.00402456
mov esp, ebp
pop ebp
ret
mov ebx, dword [sym.imp.WS2_32.dll_setsockopt]
lea eax, [ebp - 0x2dc]
push 4
push eax
push 4
push 0xffff
push esi
call ebx
cmp eax, 0xffffffff
jne 0x401255
push str.setsockopt__
call dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll_perror]
add esp, 4
push esi
call dword [sym.imp.WS2_32.dll_closesocket]
or eax, 0xffffffff
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.00402456
mov esp, ebp
pop ebp
ret
lea eax, [ebp - 0x2e4]
push eax
push 0x8004667e
push esi
call dword [sym.imp.WS2_32.dll_ioctlsocket]
push dword [ebp - 0x2d4]
push edi
push esi
call dword [sym.imp.WS2_32.dll_connect]
cmp eax, 0xffffffff
jne 0x401317
call dword [sym.imp.WS2_32.dll_WSAGetLastError]
cmp eax, 0x2733
jne 0x401384
lea eax, [ebp - 0x2f0]
mov dword [ebp - 0x13c], esi
push eax
push 0
lea eax, [ebp - 0x140]
mov dword [ebp - 0x140], 1
push eax
push 0
lea eax, [esi + 1]
mov dword [ebp - 0x2f0], 5
push eax
mov dword [ebp - 0x2ec], 0
call dword [sym.imp.WS2_32.dll_select]
cmp eax, 1
jne 0x401384
lea eax, [ebp - 0x2e8]
mov dword [ebp - 0x2e8], 4
push eax
lea eax, [ebp - 0x2d4]
push eax
push 0x1007
push 0xffff
push esi
call dword [sym.imp.WS2_32.dll_getsockopt]
cmp dword [ebp - 0x2d4], 0
jne 0x401376
call dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__errno]
mov dword [eax], 0
test esi, esi
jns 0x40138d
cmp dword [0x40637c], 2
jl 0x401428
push ecx
lea edx, [ebp - 0x34]
mov ecx, edi
call fcn.00401040
mov eax, dword [ebp - 0x2d8]
add esp, 4
movzx eax, ax
push eax
lea eax, [ebp - 0x34]
push eax
push str.socket_connect_addr
push str._s:_Could_not_connect_to__s_port__d_n
push 2
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll___acrt_iob_func]
add esp, 4
push eax
call fcn.00401010
add esp, 0x14
or eax, 0xffffffff
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.00402456
mov esp, ebp
pop ebp
ret
call dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__errno]
mov ecx, dword [ebp - 0x2d4]
mov dword [eax], ecx
push esi
call dword [sym.imp.WS2_32.dll_closesocket]
jmp 0x40131b
push 4
lea eax, [ebp - 0x2dc]
push eax
push 1
push 6
push esi
call ebx
mov edi, dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll_perror]
cmp eax, 0xffffffff
jne 0x4013b2
push str.Could_not_set_TCP_NODELAY_on_socket
call edi
add esp, 4
push 4
lea eax, [ebp - 0x2e0]
push eax
push 0x1001
push 0xffff
push esi
call ebx
cmp eax, 0xffffffff
jne 0x4013d7
push str.Could_not_set_send_buffer_for_socket
call edi
add esp, 4
push 4
lea eax, [ebp - 0x2e0]
push eax
push 0x1002
push 0xffff
push esi
call ebx
cmp eax, 0xffffffff
jne 0x4013fc
push str.Could_not_set_receive_buffer_for_socket
call edi
add esp, 4
mov eax, esi
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.00402456
mov esp, ebp
pop ebp
ret
push str.ERROR:_Unsupported_address_family
push 2
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll___acrt_iob_func]
add esp, 4
push eax
call fcn.00401010
add esp, 8
mov ecx, dword [ebp - 4]
or eax, 0xffffffff
pop edi
pop esi
xor ecx, ebp
pop ebx
call fcn.00402456
mov esp, ebp
pop ebp
ret