Function at 0x407847
Capabilities:
Get socket status
Initialize winsock library
Print debug messages
Read .ini file
Read and send data from client to server
Send data
Send data on socket

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x3ac
mov dword [ebp - 0x19c], 0
mov dword [ebp - 4], 0xffffffff
mov eax, dword [ebp + 0xc]
push eax
push 0
push str.WMC____4.4X___wmc_Connect:_AppName_s_n
push 0x421120
call dword [sym.imp.USER32.dll_wsprintfA]
add esp, 0x10
push 0x421120
call dword [sym.imp.KERNEL32.dll_OutputDebugStringA]
cmp dword [0x4206be], 0
je 0x4078c1
mov ecx, dword [ebp + 0xc]
push ecx
mov edx, dword [0x4206be]
mov eax, dword [edx + 4]
push eax
push str.WMC____4.4X___wmc_Connect:_AppName_s_still_connected___n
push 0x421120
call dword [sym.imp.USER32.dll_wsprintfA]
add esp, 0x10
push 0x421120
call dword [sym.imp.KERNEL32.dll_OutputDebugStringA]
xor eax, eax
jmp 0x407d0e
mov dword [0x4206c8], 0
mov dword [0x4206cc], 0
push 0
push 0xffffffffffffffff
call sub.WINDCS32.dll_Ordinal_69
push eax
push str._s_syslogging.ini
lea ecx, [ebp - 0x2a0]
push ecx
call dword [sym.imp.USER32.dll_wsprintfA]
add esp, 0xc
lea edx, [ebp - 0x2a0]
push edx
push 1
push str.EnableUserLogging
push str.Global
call dword [sym.imp.KERNEL32.dll_GetPrivateProfileIntA]
mov dword [0x42123c], eax
call fcn.0040779a
mov eax, dword [ebp + 8]
mov dword [0x42065c], eax
lea ecx, [ebp - 0x198]
push ecx
push 0x101
call sub.WSOCK32.dll_WSAStartup
test eax, eax
je 0x40793b
xor eax, eax
jmp 0x407d0e
push 0x13
mov edx, dword [ebp + 0xc]
push edx
push 0x420648
call fcn.00413a90
add esp, 0xc
push 0xfe08
push 0x42
call dword [sym.imp.KERNEL32.dll_GlobalAlloc]
push eax
call dword [sym.imp.KERNEL32.dll_GlobalLock]
mov dword [0x42066e], eax
push 0xff0
push 0x42
call dword [sym.imp.KERNEL32.dll_GlobalAlloc]
mov dword [0x420672], eax
push 0xfa5c
push 0x42
call dword [sym.imp.KERNEL32.dll_GlobalAlloc]
mov dword [0x420662], eax
push 0xfa5c
push 0x42
call dword [sym.imp.KERNEL32.dll_GlobalAlloc]
mov dword [0x420666], eax
push 0xfe08
push 0x42
call dword [sym.imp.KERNEL32.dll_GlobalAlloc]
mov dword [0x42066a], eax
cmp dword [0x42066e], 0
je 0x4079d3
cmp dword [0x420672], 0
je 0x4079d3
cmp dword [0x420662], 0
je 0x4079d3
cmp dword [0x42066a], 0
jne 0x4079fd
push str.WMC___wmc_Connect:_Out_of_memory____call_wmc_Disconnect___..._n
push 0x421120
call dword [sym.imp.USER32.dll_wsprintfA]
add esp, 8
push 0x421120
call dword [sym.imp.KERNEL32.dll_OutputDebugStringA]
call fcn.00407e29
xor eax, eax
jmp 0x407d0e
push 0x421220
call dword [sym.imp.KERNEL32.dll_InitializeCriticalSection]
push 0x421240
call dword [sym.imp.KERNEL32.dll_InitializeCriticalSection]
mov dword [ebp - 8], 0x100007f
mov eax, dword [ebp - 8]
push eax
call fcn.004077bd
add esp, 4
mov dword [ebp - 4], eax
cmp dword [ebp - 4], 0xffffffff
jne 0x407a3b
call sub.WSOCK32.dll_WSACleanup
xor eax, eax
jmp 0x407d0e
push 0x10022
push 0x42
call dword [sym.imp.KERNEL32.dll_GlobalAlloc]
push eax
call dword [sym.imp.KERNEL32.dll_GlobalLock]
mov dword [ebp - 0x19c], eax
cmp dword [ebp - 0x19c], 0
jne 0x407a73
mov ecx, dword [ebp - 4]
push ecx
call sub.WSOCK32.dll_closesocket
call sub.WSOCK32.dll_WSACleanup
xor eax, eax
jmp 0x407d0e
push 0x780
push 0x42
call dword [sym.imp.KERNEL32.dll_GlobalAlloc]
mov edx, dword [ebp - 0x19c]
mov dword [edx + 0xfe20], eax
mov eax, dword [ebp - 0x19c]
cmp dword [eax + 0xfe20], 0
jne 0x407ad8
mov ecx, dword [ebp - 4]
push ecx
call sub.WSOCK32.dll_closesocket
mov edx, dword [ebp - 0x19c]
push edx
call dword [sym.imp.KERNEL32.dll_GlobalHandle]
push eax
call dword [sym.imp.KERNEL32.dll_GlobalUnlock]
mov eax, dword [ebp - 0x19c]
push eax
call dword [sym.imp.KERNEL32.dll_GlobalHandle]
push eax
call dword [sym.imp.KERNEL32.dll_GlobalFree]
call sub.WSOCK32.dll_WSACleanup
xor eax, eax
jmp 0x407d0e
mov ecx, dword [ebp - 0x19c]
mov edx, dword [0x4206be]
mov dword [ecx], edx
mov eax, dword [ebp - 0x19c]
mov dword [0x4206be], eax
mov ecx, dword [ebp - 0x19c]
mov edx, dword [ebp - 8]
mov dword [ecx + 8], edx
mov eax, dword [ebp - 0x19c]
mov ecx, dword [ebp - 4]
mov dword [eax + 4], ecx
mov edx, dword [ebp - 0x19c]
add edx, 0x18
mov eax, dword [ebp - 0x19c]
mov dword [eax + 0xc], edx
mov ecx, dword [ebp - 0x19c]
mov edx, dword [ecx + 0xc]
add edx, 0x20
mov eax, dword [ebp - 0x19c]
mov dword [eax + 0x10], edx
mov dword [0x421238], 0
mov ecx, dword [ebp + 0xc]
push ecx
mov edx, dword [ebp - 0x19c]
mov eax, dword [edx + 4]
push eax
push str.WMC____4.4X___wmc_Connect:_Init_wmc_communication_for_Appl_s_n
push 0x421120
call dword [sym.imp.USER32.dll_wsprintfA]
add esp, 0x10
push 0x421120
call dword [sym.imp.KERNEL32.dll_OutputDebugStringA]
push 0x21
push 0x7d19
mov ecx, dword [ebp + 8]
push ecx
mov edx, dword [ebp - 4]
push edx
call sub.WSOCK32.dll_WSAAsyncSelect
push 0x421220
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
push 0x20
push 0
mov eax, dword [0x42066e]
push eax
call fcn.00413a30
add esp, 0xc
mov ecx, dword [0x42066e]
mov edx, dword [ebp + 8]
mov dword [ecx], edx
mov eax, dword [0x42066e]
mov dword [eax + 4], 0x7d05
mov ecx, dword [ebp + 0xc]
push ecx
call fcn.00414050
add esp, 4
add eax, 1
mov edx, dword [0x42066e]
mov word [edx + 8], ax
mov eax, dword [0x42066e]
xor ecx, ecx
mov cx, word [eax + 8]
add ecx, 0x20
mov edx, dword [0x42066e]
mov word [edx + 0xc], cx
mov eax, dword [0x42066e]
mov word [eax + 0xe], 0x400
call sub.WINDCS32.dll_sysini_GetAreaForApplikation
mov ecx, dword [0x42066e]
mov byte [ecx + 0x10], al
call sub.WINDCS32.dll_Ordinal_53
mov edx, dword [0x42066e]
mov byte [edx + 0x11], al
mov eax, dword [0x42066e]
xor ecx, ecx
mov cx, word [eax + 8]
push ecx
mov edx, dword [ebp + 0xc]
push edx
mov eax, dword [0x42066e]
add eax, 0x20
push eax
call fcn.00413c30
add esp, 0xc
mov dword [ebp - 0x2a8], 0
mov dword [ebp - 0x2a4], 0x7a120
mov dword [ebp - 0x3ac], 0
cmp dword [ebp - 0x3ac], 0x40
jae 0x407c73
mov ecx, dword [ebp - 0x3ac]
mov edx, dword [ebp - 0x19c]
mov eax, dword [edx + 4]
mov dword [ebp + ecx*4 - 0x3a8], eax
mov ecx, dword [ebp - 0x3ac]
add ecx, 1
mov dword [ebp - 0x3ac], ecx
xor edx, edx
test edx, edx
jne 0x407c45
lea eax, [ebp - 0x2a8]
push eax
push 0
lea ecx, [ebp - 0x3ac]
push ecx
push 0
push 0
call sub.WSOCK32.dll_select
push 0
mov edx, dword [0x42066e]
xor eax, eax
mov ax, word [edx + 0xc]
push eax
mov ecx, dword [0x42066e]
push ecx
mov edx, dword [ebp - 0x19c]
mov eax, dword [edx + 4]
push eax
call sub.WSOCK32.dll_send
cmp eax, 0xffffffff
jne 0x407cfe
call sub.WSOCK32.dll_WSAGetLastError
push eax
mov ecx, dword [ebp - 0x19c]
mov edx, dword [ecx + 4]
push edx
push str.WMC____4.4X___wmc_Connect:_Send_FAILED_with__d___n
push 0x421120
call dword [sym.imp.USER32.dll_wsprintfA]
add esp, 0x10
push 0x421120
call dword [sym.imp.KERNEL32.dll_OutputDebugStringA]
push 0x421220
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
call fcn.00407e29
xor eax, eax
jmp 0x407d0e
push 0x421220
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov eax, 1
mov esp, ebp
pop ebp
ret