Function at 0x402160
Capabilities:
Connect socket
Create thread
Initialize winsock library
Terminate process

Disassembly:
sub esp, 0x1bc
push ebx
push ebp
push esi
lea eax, [esp + 0x38]
push edi
xor edi, edi
push eax
push 0x101
mov dword [esp + 0x28], 0x300
mov dword [esp + 0x30], edi
mov dword [esp + 0x24], edi
call sub.WS2_32.dll_WSAStartup
cmp eax, edi
je 0x4021ab
push str.I_cant_find_winsock.dll._n
call dword [sym.imp.MSVCRT.dll_printf]
add esp, 4
or eax, 0xffffffff
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x1bc
ret
mov ax, word [esp + 0x3c]
cmp al, 1
jne 0x402a28
xor ecx, ecx
mov cl, ah
cmp cl, al
jne 0x402a28
push str.127.0.0.1
mov word [esp + 0x30], 2
call fcn.00401c80
add esp, 4
mov dword [esp + 0x30], eax
push 0x300
call sub.WS2_32.dll_htons
push edi
push 1
push 2
mov word [esp + 0x3a], ax
call sub.WS2_32.dll_socket
cmp eax, 0xffffffff
mov dword [0x407480], eax
jne 0x40221c
push str.socket
call fcn.00401d10
add esp, 4
mov eax, 0xfffffffd
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x1bc
ret
mov ecx, dword [esp + 0x1d0]
mov ebx, dword [sym.imp.MSVCRT.dll_printf]
cmp ecx, 1
mov byte [0x4060ec], 2
jle 0x402436
mov edx, dword [esp + 0x1d4]
dec ecx
mov dword [esp + 0x18], ecx
lea ebp, [edx + 4]
mov esi, dword [ebp]
mov edi, 0x40500c
mov cl, byte [esi]
mov dl, byte [edi]
mov al, cl
cmp cl, dl
jne 0x402278
test al, al
je 0x402274
mov dl, byte [esi + 1]
mov cl, byte [edi + 1]
mov al, dl
cmp dl, cl
jne 0x402278
add esi, 2
add edi, 2
test al, al
jne 0x402250
xor eax, eax
jmp 0x40227d
sbb eax, eax
sbb eax, 0xffffffff
test eax, eax
jne 0x402291
call fcn.00401ae0
push 0
call dword [sym.imp.MSVCRT.dll_exit]
add esp, 4
mov eax, dword [ebp]
mov esi, dword [sym.imp.MSVCRT.dll__stricmp]
push str.PALARM
push eax
call esi
add esp, 8
test eax, eax
je 0x402404
mov ecx, dword [ebp]
push str.PROCESS
push ecx
call esi
add esp, 8
test eax, eax
je 0x402404
mov edx, dword [ebp]
push str.DALARM
push edx
call esi
add esp, 8
test eax, eax
je 0x4023f4
mov eax, dword [ebp]
push str.DIAG
push eax
call esi
add esp, 8
test eax, eax
je 0x4023f4
mov ecx, dword [ebp]
push str.HOLD
push ecx
call esi
add esp, 8
test eax, eax
jne 0x402314
push str.Hold_Lists_are_not_available_via_GSM
call dword [sym.imp.MSVCRT.dll_puts]
add esp, 4
jmp 0x40241d
mov edx, dword [ebp]
push str.EVENT
push edx
call esi
add esp, 8
test eax, eax
jne 0x402344
mov byte [0x4060ec], 8
mov dword [0x405054], 1
mov dword [esp + 0x20], 0x500
jmp 0x40241d
mov eax, dword [ebp]
push 0x404fb0
push eax
call esi
add esp, 8
test eax, eax
jne 0x402374
mov byte [0x4060ec], 0xa
mov dword [0x405054], 1
mov dword [esp + 0x20], 0x400
jmp 0x40241d
mov ecx, dword [ebp]
push 0x404fac
push ecx
call esi
add esp, 8
test eax, eax
jne 0x402390
xor dword [esp + 0x1c], 1
jmp 0x40241d
mov edx, dword [ebp]
push str.NAME
push edx
call esi
add esp, 8
test eax, eax
jne 0x4023ab
xor dword [0x405050], 1
jmp 0x40241d
mov eax, dword [ebp]
push eax
call fcn.00401c80
add esp, 4
mov dword [esp + 0x30], eax
test eax, eax
jne 0x40241d
push str.127.0.0.1
call fcn.00401c80
add esp, 4
mov dword [esp + 0x30], eax
mov ecx, dword [ebp]
push ecx
push str....Unknown_command_line_parameter___s__ignored._n
call ebx
add esp, 8
push str....Hint:_Try___PALARM__DALARM__DIAG__EVENT__SOE___n
call ebx
add esp, 4
push str....Hint:_Run_as__ALMDUMP1_____for_help._n
call ebx
add esp, 4
jmp 0x40241d
push str.Diagnostic_alarms_are_not_available_via_GSM
call dword [sym.imp.MSVCRT.dll_puts]
add esp, 4
jmp 0x40241d
mov byte [0x4060ec], 2
mov dword [esp + 0x20], 0x300
mov dword [0x405054], 0
mov eax, dword [esp + 0x18]
add ebp, 4
dec eax
mov dword [esp + 0x18], eax
jne 0x402248
mov eax, dword [0x407480]
xor edi, edi
lea edx, [esp + 0x2c]
push 0x10
push edx
push eax
call sub.WS2_32.dll_connect
cmp eax, 0xffffffff
jne 0x402463
push str.connect
call fcn.00401d10
add esp, 4
or eax, 0xffffffff
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x1bc
ret
mov eax, dword [0x404010]
mov word [eax + 2], 0x100
add eax, 2
add eax, 2
mov word [eax], 1
add eax, 2
mov byte [eax], 0
mov ecx, dword [0x404010]
sub eax, ecx
inc eax
push eax
push ecx
call fcn.00401ff0
mov esi, dword [sym.imp.MSVCRT.dll__beginthread]
add esp, 8
push edi
push edi
push 0x4012c0
call esi
add esp, 0xc
push edi
push edi
push 0x401aa0
call esi
mov eax, dword [0x404014]
add esp, 0xc
cmp eax, edi
je 0x4024cc
push 0x1f4
call dword [sym.imp.KERNEL32.dll_Sleep]
cmp dword [0x404014], edi
jne 0x4024b9
push str.Available_Units:
call dword [sym.imp.MSVCRT.dll_puts]
mov eax, dword [0x4060e8]
add esp, 4
xor esi, esi
cmp eax, edi
jle 0x402512
mov ebp, 0x406100
mov edi, 0x406160
push edi
call dword [sym.imp.MSVCRT.dll_puts]
mov eax, dword [0x4060e8]
add esp, 4
mov dword [ebp], 0
inc esi
add edi, 0x28
add ebp, 4
cmp esi, eax
jl 0x4024ef
xor edi, edi
mov al, byte [0x406160]
mov dword [esp + 0x10], edi
test al, al
mov dword [esp + 0x18], edi
je 0x4025cd
mov ebp, 0x406160
mov dword [esp + 0x24], ebp
mov ecx, dword [0x404010]
mov ax, word [esp + 0x20]
mov word [ecx + 2], ax
mov edi, ebp
lea edx, [ecx + 2]
mov ecx, dword [esp + 0x18]
add edx, 2
inc ecx
xor eax, eax
mov word [edx], cx
or ecx, 0xffffffff
add edx, 2
repne scasb al, byte es:[edi]
not ecx
dec ecx
mov edi, ebp
mov byte [edx], cl
or ecx, 0xffffffff
inc edx
repne scasb al, byte es:[edi]
not ecx
sub edi, ecx
mov eax, ecx
mov esi, edi
mov edi, edx
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, eax
xor eax, eax
and ecx, 3
rep movsb byte es:[edi], byte [esi]
mov edi, ebp
or ecx, 0xffffffff
repne scasb al, byte es:[edi]
not ecx
dec ecx
add edx, ecx
mov cx, word [esp + 0x1c]
mov word [edx], ax
add edx, 2
mov word [edx], cx
mov eax, dword [0x404010]
sub edx, eax
add edx, 2
push edx
push eax
call fcn.00401ff0
mov ebp, dword [esp + 0x2c]
mov edx, dword [esp + 0x20]
add ebp, 0x28
add esp, 8
inc edx
mov dword [esp + 0x24], ebp
mov al, byte [ebp]
mov dword [esp + 0x18], edx
test al, al
jne 0x402530
xor edi, edi
cmp dword [0x405054], edi
je 0x402625
mov ebp, dword [sym.imp.MSVCRT.dll__getch]
push str.Hit__ESC__to_exit:
call ebx
add esp, 4
call ebp
push 0x404590
mov esi, eax
call ebx
lea eax, [esi + 1]
add esp, 4
cmp eax, 0x40
ja case.0x402603.3
xor edx, edx
mov dl, byte [eax + 0x402a60]
jmp dword [edx*4 + 0x402a4c]
push edi
call dword [sym.imp.MSVCRT.dll_exit]
add esp, 4
call fcn.00401bc0
push str._nNote:_No_commands_are_supported_for_EVENTs_or_SOEs._n_n
call ebx
add esp, 4
jmp case.0x402603.3
mov ebp, dword [sym.imp.MSVCRT.dll_scanf]
mov byte [0x406080], 0xff
push 0x3e8
call dword [sym.imp.KERNEL32.dll_Sleep]
mov eax, dword [esp + 0x10]
lea eax, [eax + eax*4]
lea ecx, [eax*8 + 0x406160]
push ecx
push str.Unit__s_Cmd__AAck__RReset__LLock__UUnlock__DDump__Unit___Help_:
call ebx
add esp, 8
call dword [sym.imp.MSVCRT.dll__getch]
push 0x404590
mov esi, eax
call ebx
lea eax, [esi + 1]
add esp, 4
cmp eax, 0x76
ja case.0x40267c.20
xor edx, edx
mov dl, byte [eax + 0x402afc]
jmp dword [edx*4 + 0x402aa4]
push edi
call dword [sym.imp.MSVCRT.dll_exit]
add esp, 4
call fcn.00401bc0
jmp case.0x40267c.1
mov eax, dword [esp + 0x10]
push eax
push str.Sending_ACK_ALL_to_unit__d_n
call ebx
mov al, byte [esp + 0x18]
mov cl, byte [0x4060ec]
add esp, 8
mov byte [0x406080], al
mov byte [0x406081], cl
mov byte [0x406082], 1
mov word [0x406083], 0xffff
mov byte [0x406085], 4
jmp 0x40296d
mov eax, dword [esp + 0x10]
lea edx, [eax + eax*4]
lea eax, [edx*8 + 0x406160]
push eax
push str.Sending_RESET_ALL_to_unit__s_n
call ebx
mov al, byte [esp + 0x18]
mov cl, byte [0x4060ec]
add esp, 8
mov byte [0x406080], al
mov byte [0x406081], cl
mov byte [0x406082], 1
mov word [0x406083], di
mov byte [0x406085], 6
jmp 0x40296d
mov eax, dword [esp + 0x10]
lea edx, [eax + eax*4]
lea eax, [edx*8 + 0x406160]
push eax
push str.Sending_SILENCE_to_unit__s_n
call ebx
mov cl, byte [0x4060ec]
add esp, 8
mov byte [0x406081], cl
mov byte [0x406082], 1
mov word [0x406083], di
mov byte [0x406085], 0xa
xor al, al
jmp 0x402968
push str.UNIT____Enter_unit_number:
call ebx
add esp, 4
lea edx, [esp + 0x10]
push edx
push 0x404db0
call ebp
mov eax, dword [esp + 0x18]
mov ecx, dword [0x4060e8]
add esp, 8
cmp eax, ecx
jl case.0x40267c.1
mov dword [esp + 0x10], edi
jmp case.0x40267c.1
push str.ACK____Enter_drop_number:
call ebx
add esp, 4
lea ecx, [esp + 0x14]
push ecx
push 0x404db0
call ebp
mov al, byte [esp + 0x18]
mov dl, byte [0x4060ec]
mov cx, word [esp + 0x1c]
add esp, 8
mov byte [0x406080], al
mov byte [0x406081], dl
mov byte [0x406082], 1
mov word [0x406083], cx
mov byte [0x406085], 7
jmp 0x40296d
push str.ACK____Enter_number_of_alarms_to_ACK:
call ebx
add esp, 4
lea edx, [esp + 0x14]
push edx
push 0x404db0
call ebp
mov al, byte [esp + 0x18]
mov cl, byte [0x4060ec]
mov dx, word [esp + 0x1c]
add esp, 8
mov byte [0x406080], al
mov byte [0x406081], cl
mov byte [0x406082], 1
mov word [0x406083], dx
mov byte [0x406085], 4
jmp 0x40296d
push str.RESET____Enter_drop_number:
call ebx
add esp, 4
lea eax, [esp + 0x14]
push eax
push 0x404db0
call ebp
mov al, byte [esp + 0x18]
mov cl, byte [0x4060ec]
mov dx, word [esp + 0x1c]
add esp, 8
mov byte [0x406080], al
mov byte [0x406081], cl
mov byte [0x406082], 1
mov word [0x406083], dx
mov byte [0x406085], 8
jmp 0x40296d
push str.LOCK____Enter_drop_number:
call ebx
add esp, 4
lea eax, [esp + 0x14]
push eax
push 0x404db0
call ebp
mov al, byte [esp + 0x18]
mov cl, byte [0x4060ec]
mov dx, word [esp + 0x1c]
add esp, 8
mov byte [0x406080], al
mov byte [0x406081], cl
mov byte [0x406082], 1
mov word [0x406083], dx
mov byte [0x406085], 2
jmp 0x40296d
push str.UNLOCK____Enter_drop_number:
call ebx
add esp, 4
lea eax, [esp + 0x14]
push eax
push 0x404db0
call ebp
mov al, byte [esp + 0x18]
mov cl, byte [0x4060ec]
mov dx, word [esp + 0x1c]
add esp, 8
mov byte [0x406080], al
mov byte [0x406081], cl
mov byte [0x406082], 1
mov word [0x406083], dx
mov byte [0x406085], 3
jmp 0x40296d
mov eax, dword [esp + 0x10]
lea eax, [eax + eax*4]
lea ecx, [eax*8 + 0x406160]
push ecx
push str.Sending_DUMP_REQUEST_to_unit__s_n
call ebx
mov al, byte [esp + 0x18]
mov dl, byte [0x4060ec]
mov cx, word [esp + 0x24]
add esp, 8
mov byte [0x406080], al
mov byte [0x406081], dl
mov byte [0x406082], 1
mov word [0x406083], cx
mov byte [0x406085], 0xff
jmp 0x40296d
push str._n__Unknown_command___ignored._n
call ebx
add esp, 4
or al, 0xff
mov byte [0x406080], al
cmp al, 0xff
je 0x402632
mov edx, dword [0x404010]
mov eax, dword [esp + 0x28]
add edx, 2
or ecx, 0xffffffff
mov word [edx], 0x700
add edx, 2
mov word [edx], ax
inc eax
mov dword [esp + 0x28], eax
mov eax, dword [esp + 0x10]
add edx, 2
lea eax, [eax + eax*4]
lea edi, [eax*8 + 0x406160]
xor eax, eax
repne scasb al, byte es:[edi]
not ecx
dec ecx
mov byte [edx], cl
mov eax, dword [esp + 0x10]
inc edx
lea ecx, [eax + eax*4]
xor eax, eax
lea edi, [ecx*8 + 0x406160]
or ecx, 0xffffffff
repne scasb al, byte es:[edi]
not ecx
sub edi, ecx
mov eax, ecx
mov esi, edi
mov edi, edx
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, eax
and ecx, 3
rep movsb byte es:[edi], byte [esi]
mov eax, dword [esp + 0x10]
lea ecx, [eax + eax*4]
xor eax, eax
lea edi, [ecx*8 + 0x406160]
or ecx, 0xffffffff
repne scasb al, byte es:[edi]
movzx ax, byte [0x406085]
not ecx
dec ecx
add edx, ecx
mov word [edx], ax
mov cx, word [0x406083]
add edx, 2
mov word [edx], cx
mov eax, dword [0x404010]
sub edx, eax
add edx, 2
push edx
push eax
call fcn.00401ff0
add esp, 8
xor edi, edi
jmp 0x402632
call sub.WS2_32.dll_WSACleanup
push str.Bad_winsock.dll_version._n
call dword [sym.imp.MSVCRT.dll_printf]
add esp, 4
mov eax, 0xfffffffe
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x1bc
ret