Function at 0x421cf0
Capabilities:
Create thread

Disassembly:
mov eax, 0x43848
call fcn.00435100
mov eax, dword [0x457a00]
xor eax, esp
mov dword [esp + 0x43844], eax
push esi
mov esi, ecx
movzx ecx, word [esi + 4]
cmp cx, 2
push edi
jbe 0x4220e8
cmp cx, 0x3ff
ja 0x4220e8
xor eax, eax
push ebx
mov dword [esp + 0x43841], eax
mov dword [esp + 0x43845], eax
mov dword [esp + 0x43849], eax
mov word [esp + 0x4384d], ax
mov byte [esp + 0x4384f], al
movzx eax, cx
push ebp
push eax
lea ecx, [esp + 0x43848]
push str..COM_d
push ecx
mov byte [esp + 0x43850], 0
xor ebp, ebp
call fcn.00430b35
mov dl, byte [esi + 0x15]
add esp, 0xc
neg dl
push ebp
lea eax, [esp + 0x43848]
sbb edx, edx
and edx, 0x40000000
push edx
push 3
push ebp
push ebp
push 0xc0000000
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileA]
or ebx, 0xffffffff
cmp eax, ebx
mov dword [esi + 0x2c], eax
jne 0x421dc3
push 0x100
lea edi, [esi + 0x50]
push ebp
push edi
call fcn.00433570
add esp, 0xc
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.fail_to_open_the_port.
jmp 0x421eac
push 0x1000
push 0x1000
push eax
call dword [sym.imp.KERNEL32.dll_SetupComm]
test eax, eax
jne 0x421dfb
push 0x100
lea edi, [esi + 0x50]
push ebp
push edi
call fcn.00433570
add esp, 0xc
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.fail_to_set_buffer_size.
jmp 0x421eac
mov edx, dword [esi + 0x2c]
lea ecx, [esp + 0x14]
push ecx
push edx
call dword [sym.imp.KERNEL32.dll_GetCommState]
test eax, eax
jne 0x421e2e
push 0x100
lea edi, [esi + 0x50]
push ebp
push edi
call fcn.00433570
add esp, 0xc
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.fail_to_get_comm_state.
jmp 0x421eac
mov eax, dword [esi + 0x18]
mov ecx, dword [esp + 0x1c]
lea edx, [esp + 0x14]
mov dword [esp + 0x18], eax
mov eax, dword [esi + 0x2c]
and ecx, 0xffffdfff
push edx
or ecx, 0x1000
push eax
mov byte [esp + 0x30], 0
mov byte [esp + 0x2f], 0
mov byte [esp + 0x2e], 8
mov byte [esp + 0x34], 0
mov byte [esp + 0x33], 0
mov byte [esp + 0x35], 0
mov byte [esp + 0x31], 0
mov byte [esp + 0x32], 0
mov word [esp + 0x2c], bp
mov word [esp + 0x2a], bp
mov dword [esp + 0x24], ecx
call dword [sym.imp.KERNEL32.dll_SetCommState]
test eax, eax
jne 0x421ecf
push 0x100
lea edi, [esi + 0x50]
push ebp
push edi
call fcn.00433570
add esp, 0xc
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.fail_to_set_comm_state.
push str._s_System_Code:_d
push edi
call fcn.00430b35
mov eax, dword [esi + 0x2c]
add esp, 0x10
cmp eax, ebp
mov dword [esi + 0x298], 1
je 0x421f46
cmp eax, ebx
jmp 0x421f3f
mov edx, dword [esi + 0x2c]
lea ecx, [esp + 0x30]
mov dword [esp + 0x30], ebx
mov dword [esp + 0x34], ebx
push ecx
mov ebx, 1
push edx
mov dword [esp + 0x40], 0x2710
mov dword [esp + 0x48], 0x32
mov dword [esp + 0x44], ebx
call dword [sym.imp.KERNEL32.dll_SetCommTimeouts]
test eax, eax
jne 0x421f61
push 0x100
lea edi, [esi + 0x50]
push ebp
push edi
call fcn.00433570
add esp, 0xc
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.fail_to_set_timeout.
push str._s_System_Code:_d
push edi
call fcn.00430b35
mov eax, dword [esi + 0x2c]
add esp, 0x10
cmp eax, ebp
mov dword [esi + 0x298], ebx
je 0x421f46
cmp eax, 0xffffffff
je 0x421f46
call fcn.00422ef0
xor al, al
pop ebp
pop ebx
pop edi
pop esi
mov ecx, dword [esp + 0x43844]
xor ecx, esp
call fcn.0042fb8f
add esp, 0x43848
ret
mov eax, dword [esi + 0x2c]
mov edi, dword [sym.imp.KERNEL32.dll_PurgeComm]
push 0xa
push eax
call edi
test eax, eax
jne 0x421f93
push 0x100
lea edi, [esi + 0x50]
push ebp
push edi
call fcn.00433570
add esp, 0xc
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.fail_to_flush_comm_port.
jmp 0x421f21
cmp byte [esi + 0x16], 0
je 0x42200f
mov ecx, dword [esi + 0x2c]
push 2
push ecx
call dword [sym.imp.KERNEL32.dll_SetCommMask]
test eax, eax
jne 0x421fcc
push 0x100
lea edi, [esi + 0x50]
push ebp
push edi
call fcn.00433570
add esp, 0xc
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.fail_to_set_rx_event.
jmp 0x421f21
lea edx, [esi + 0x178]
push edx
push ebp
push esi
push 0x422150
push ebp
push ebp
call dword [sym.imp.KERNEL32.dll_CreateThread]
cmp eax, ebp
mov dword [esi + 0x17c], eax
jne 0x42200f
push 0x100
lea edi, [esi + 0x50]
push ebp
push edi
call fcn.00433570
add esp, 0xc
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.fail_to_start_monitor_tread.
jmp 0x421f21
mov eax, dword [esi + 0x2c]
push 0xf
push eax
call edi
test eax, eax
jne 0x42203e
push 0x100
lea edi, [esi + 0x50]
push ebp
push edi
call fcn.00433570
add esp, 0xc
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.fail_to_purgecomm.
jmp 0x421f21
push ebx
lea ecx, [esp + 0x14]
push ecx
push 0x100
lea ecx, [esp + 0x50]
mov dword [esp + 0x1c], ebp
call fcn.004217a0
mov ecx, dword [esp + 0x1c]
add esp, 0xc
cmp ecx, ebp
jne 0x422084
push 0x100
lea edi, [esi + 0x50]
push ebp
push edi
call fcn.00433570
add esp, 0xc
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.comm_port_missing
jmp 0x421f21
xor edi, edi
cmp ecx, ebp
jle 0x4220de
movzx edx, word [esi + 4]
lea eax, [esp + 0x44]
cmp word [eax], dx
je 0x4220ac
add edi, ebx
add eax, 0x438
cmp edi, ecx
jl 0x422092
mov byte [esi + 0x14], bl
mov al, bl
jmp 0x421f48
push 0x100
lea ebp, [esi + 0x195]
push 0
push ebp
call fcn.00433570
imul edi, edi, 0x438
lea eax, [esp + edi + 0x17f]
mov edx, ebp
add esp, 0xc
sub edx, eax
mov cl, byte [eax]
mov byte [edx + eax], cl
add eax, ebx
test cl, cl
jne 0x4220d3
mov byte [esi + 0x14], bl
mov al, bl
jmp 0x421f48
push 0x100
lea edi, [esi + 0x50]
push 0
push edi
call fcn.00433570
add esp, 0xc
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.port_number_is_invalid.
push str._s_System_Code:_d
push edi
call fcn.00430b35
mov eax, dword [esi + 0x2c]
add esp, 0x10
test eax, eax
mov dword [esi + 0x298], 1
je 0x422130
cmp eax, 0xffffffff
je 0x422130
call fcn.00422ef0
mov ecx, dword [esp + 0x4384c]
pop edi
pop esi
xor ecx, esp
xor al, al
call fcn.0042fb8f
add esp, 0x43848
ret