Function at 0x403230
Capabilities:
Create tcp socket
Create udp socket
Get hostname
Get local ipv4 addresses
Get socket information
Resolve dns
Set socket configuration

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x304
push ebx
mov ebx, dword [ebp + 0x10]
xor eax, eax
mov ecx, 1
push esi
cmp bx, ax
push edi
mov dword [ebp - 4], eax
mov dword [ebp - 0x1c], ecx
mov dword [ebp - 8], eax
jne 0x4032d0
lea eax, [ebp - 0x204]
mov dword [ebp - 8], ecx
push eax
push 0x411c30
call fcn.00406fa0
add esp, 8
mov edi, str.null
lea esi, [ebp - 0x204]
mov ecx, 5
xor edx, edx
repe cmpsb byte [esi], byte es:[edi]
je 0x4032d0
lea eax, [ebp - 0x204]
push eax
call fcn.00406f00
add esp, 4
cmp eax, 0xffffffff
jne 0x4032d0
lea ecx, [ebp - 0x204]
lea edx, [ebp - 0x104]
push ecx
push str._nUnable_to_switch_to_Working_Directory:_s_n
push edx
call fcn.004057b0
add esp, 0xc
lea eax, [ebp - 0x104]
push eax
call fcn.00404310
mov dword [ebp - 4], 1
add esp, 4
mov eax, dword [ebp - 4]
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
push 8
call fcn.004058d0
mov ecx, dword [ebp + 0x14]
mov esi, dword [ebp + 8]
mov edx, dword [ebp + 0x18]
add esp, 4
mov edi, ebx
and ecx, 0xffff
and edi, 0xffff
push ecx
push edi
push edx
mov dword [esi], eax
call fcn.00402c50
add esp, 0xc
push 0
push 1
push 2
call sub.WSOCK32.dll_socket
mov ecx, dword [esi]
mov dword [ecx], eax
mov edx, dword [esi]
mov eax, dword [edx]
cmp eax, 0xffffffff
jne 0x403334
push str.Failed_to_allocate_socket._n
call fcn.00404310
mov dword [ebp - 4], 1
add esp, 4
mov eax, dword [ebp - 4]
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
lea ecx, [ebp - 0x1c]
push 4
push ecx
push 4
push 0xffff
push eax
call sub.WSOCK32.dll_setsockopt
cmp eax, 0xffffffff
jne 0x40336a
push str.fatal_error:_server_cannot_setsocket_SO_REUSEADDR_n
call fcn.00404310
mov dword [ebp - 4], 1
add esp, 4
mov eax, dword [ebp - 4]
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
xor edx, edx
mov dword [ebp - 0x18], edx
mov word [ebp - 0x18], 2
mov dword [ebp - 0x14], edx
mov dword [ebp - 0x10], edx
push edx
mov dword [ebp - 0xc], edx
call sub.WSOCK32.dll_htonl
push ebx
mov dword [ebp - 0x14], eax
call sub.WSOCK32.dll_htons
mov word [ebp - 0x16], ax
mov eax, dword [ebp - 8]
test eax, eax
je 0x4033cb
lea eax, [ebp - 0x304]
push 0x100
push eax
call sub.WSOCK32.dll_gethostname
test eax, eax
je 0x4033cb
push str.Network_error__could_not_get_local_host_name.
call fcn.00404310
mov dword [ebp - 4], 1
add esp, 4
mov eax, dword [ebp - 4]
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
mov ebx, dword [ebp + 0xc]
test ebx, ebx
jne 0x4033da
push ebx
call sub.WSOCK32.dll_htonl
jmp 0x40341e
push str.Default
push ebx
call fcn.00409a80
add esp, 8
test eax, eax
jne 0x4033f4
push eax
call sub.WSOCK32.dll_htonl
jmp 0x40341e
push ebx
call sub.WSOCK32.dll_gethostbyname
test eax, eax
jne 0x403417
push str.Usage_Error:_Invalid_hostname_specified_n
call fcn.004043c0
add esp, 4
mov eax, 1
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
mov ecx, dword [eax + 0xc]
mov edx, dword [ecx]
mov eax, dword [edx]
mov edx, dword [esi]
mov dword [ebp - 0x14], eax
lea ecx, [ebp - 0x18]
push 0x10
mov eax, dword [edx]
push ecx
push eax
call sub.WSOCK32.dll_bind
cmp eax, 0xffffffff
jne 0x403475
mov edx, dword [ebp + 0x1c]
lea ecx, [ebp - 0x24]
push ecx
push 0
push 9
push 0
push edx
call fcn.00401c10
mov esi, dword [ebp + 0x18]
add esp, 0x14
test esi, esi
mov dword [ebp - 4], 1
je 0x4035b0
push edi
lea eax, [ebp - 0x80]
push str.ERROR:_Failed_to_bind_Launcher_to_port__d_n
push eax
call fcn.004057b0
add esp, 0xc
jmp 0x40356f
mov eax, dword [ebp - 8]
test eax, eax
je 0x403532
mov ecx, dword [esi]
lea edx, [ebp + 0x10]
mov dword [ebp + 0x10], 0x10
push edx
mov edx, dword [ecx]
lea eax, [ebp - 0x18]
push eax
push edx
call sub.WSOCK32.dll_getsockname
test eax, eax
jne 0x4034d5
call dword [sym.imp.KERNEL32.dll_GetCurrentProcessId]
push eax
mov eax, dword [ebp - 0x16]
push eax
call sub.WSOCK32.dll_ntohs
and eax, 0xffff
lea ecx, [ebp - 0xb4]
push eax
push str.port_d:pid_d
push ecx
call fcn.004057b0
add esp, 0x10
lea edx, [ebp - 0xb4]
push edx
call fcn.00404340
jmp 0x40352f
call sub.WSOCK32.dll_WSAGetLastError
mov ecx, eax
sub ecx, 0x271e
je 0x403508
sub ecx, 8
je 0x4034fd
push eax
lea eax, [ebp - 0x44]
push 0x411d70
push eax
call fcn.004057b0
add esp, 0xc
jmp 0x403519
lea ecx, [ebp - 0x44]
push str.WSAEINVAL
push ecx
jmp 0x403511
lea edx, [ebp - 0x44]
push str.WSAEFAULT
push edx
call fcn.004057b0
add esp, 8
push str.Port_error__could_not_find_port_number._Error:
call fcn.00404310
add esp, 4
lea eax, [ebp - 0x44]
push eax
call fcn.00404310
add esp, 4
mov ecx, dword [esi]
push 5
mov edx, dword [ecx]
push edx
call sub.WSOCK32.dll_listen
cmp eax, 0xffffffff
jne 0x403588
push str.Failed_to_listen_n
call fcn.00404310
mov esi, dword [ebp + 0x18]
add esp, 4
test esi, esi
mov dword [ebp - 4], 1
je 0x4035b0
lea eax, [ebp - 0x80]
push str.ERROR:_Failed_to_listen_n
push eax
call fcn.004057b0
add esp, 8
lea ecx, [ebp - 0x80]
push ecx
push 1
push esi
call fcn.004029d0
mov eax, dword [ebp - 4]
add esp, 0xc
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
mov eax, dword [esi]
lea edx, [ebp - 0x20]
mov dword [ebp - 0x20], 1
push edx
mov ecx, dword [eax]
push 0x8004667e
push ecx
call sub.WSOCK32.dll_ioctlsocket
cmp eax, 0xffffffff
je 0x4035b0
mov edx, dword [esi]
mov dword [edx + 4], 0xa
mov eax, dword [ebp - 4]
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret