Function at 0x402134
Capabilities:
Create thread

Disassembly:
push ebp
mov ebp, esp
mov eax, 0x1018
call fcn.0042b680
push ebx
push esi
mov esi, ecx
push edi
xor ebx, ebx
mov dword [ebp - 8], 1
lea eax, [esi + 0x2b4]
mov dword [ebp - 0x14], ebx
push eax
mov dword [ebp - 0x10], ebx
mov dword [ebp - 0x18], eax
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
mov dword [esi + 0x18c], ebx
cmp word [esi + 0x2e], bx
jne 0x4026da
push str.COMMS:_Open_port
push dword [esi + 0x2b0]
call fcn.0041e63d
cmp dword [ebp + 8], ebx
pop ecx
pop ecx
jne 0x402195
lea eax, [ebp - 0x1018]
mov dword [ebp + 8], eax
cmp dword [esi + 0x194], 0xffffffff
je 0x4021b7
push str.COMMS:_Port_already_open____closing
push dword [esi + 0x2b0]
call fcn.0041e63d
pop ecx
pop ecx
mov ecx, esi
call fcn.004028b3
mov edi, dword [sym.imp.KERNEL32.dll_ResetEvent]
mov word [esi + 0x1b2], bx
push dword [esi + 0x198]
call edi
push dword [esi + 0x344]
call edi
mov ax, word [esi + 6]
mov dword [esi + 0x210], ebx
mov cl, al
mov dword [esi + 0x214], ebx
and cl, 0x14
mov dword [esi + 0x218], ebx
neg cl
sbb ecx, ecx
mov dword [esi + 0x224], ebx
and ecx, 0xffffffe1
mov dword [esi + 0x21c], ebx
add ecx, 0x20
mov word [esi + 0x240], bx
mov word [esi + 0x242], bx
mov word [esi + 0x244], bx
mov word [esi + 0x246], bx
mov dword [esi + 0x228], ecx
mov ecx, dword [0x453198]
cmp ecx, ebx
je 0x40223b
test al, 4
jne 0x40223b
mov dword [esi + 0x228], ecx
and al, 6
mov edi, 0x1000
neg al
sbb eax, eax
mov ecx, esi
and ax, 0xf400
mov word [esi + 0x29e], bx
add eax, edi
mov dword [esi + 0x20c], eax
mov dword [esi + 0x220], eax
mov eax, dword [esi + 0x250]
mov dword [esi + 0x254], eax
call fcn.00405462
test byte [esi + 6], 0x20
mov word [esi + 8], bx
mov dword [esi + 0x32c], ebx
mov dword [esi + 0x338], ebx
jne 0x4022c6
lea eax, [esi + 0x84]
push str.._
push eax
call fcn.0042b1f0
test byte [esi + 6], 2
pop ecx
pop ecx
je 0x4022b4
lea eax, [esi + 0x84]
push 0x438638
push eax
call fcn.0042b200
pop ecx
pop ecx
lea eax, [esi + 0x32]
push eax
lea eax, [esi + 0x84]
push eax
call fcn.0042b200
pop ecx
pop ecx
lea eax, [esi + 0x32]
push ebx
push eax
mov ecx, esi
call fcn.0040694c
neg ax
sbb eax, eax
inc eax
cmp ax, bx
jne 0x4023e3
test byte [esi + 6], 0x20
je 0x402317
push dword [ebp + 8]
lea eax, [esi + 0x84]
mov ecx, esi
push 0x104
push eax
call fcn.00407287
movzx eax, ax
cmp eax, ebx
mov dword [ebp - 4], eax
jne 0x4023d6
cmp byte [esi + 0x84], bl
je 0x4023e3
lea eax, [esi + 0x84]
push eax
lea eax, [esi + 0x32]
push eax
push str.Open___s__as___s_
push dword [esi + 0x2b0]
call fcn.0041e63d
mov al, byte [esi + 6]
add esp, 0x10
not al
and eax, 4
push ebx
shl eax, 0x1c
push eax
push 3
push ebx
push ebx
lea eax, [esi + 0x84]
push 0xc0000000
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileA]
cmp eax, 0xffffffff
mov dword [esi + 0x194], eax
jne 0x402418
lea eax, [ebp - 0x1018]
push edi
push eax
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
call fcn.00424a92
add esp, 0xc
push eax
push str.COMMS:_Failed_to_open_port____s
push dword [esi + 0x2b0]
call fcn.0041e63d
add esp, 0xc
cmp word [ebp - 0x10], bx
jne 0x40286f
cmp word [esi + 0x306], bx
je 0x40286f
test word [0x453276], 0x3fff
je 0x40286f
push str.COMMS:_Try_to_open_TEC_USB_port_again
push dword [esi + 0x2b0]
call fcn.0041e63d
pop ecx
mov dword [ebp - 0x10], 1
pop ecx
jmp 0x4022c6
push ebx
mov ecx, esi
call fcn.0040722c
jmp 0x40288c
push ebx
mov ecx, esi
call fcn.0040722c
lea ebx, [esi + 0x32]
push ebx
push str.COMMS:_Port_name___s__is_not_known_to_system
push dword [esi + 0x2b0]
call fcn.0041e63d
add esp, 0xc
push ebx
push edi
push dword [ebp + 8]
push 0xa
push 0x454168
call fcn.00420804
jmp 0x402859
test byte [esi + 6], 2
mov word [esi + 0x2c], 1
je 0x4025b0
lea ecx, [ebp - 4]
push ecx
lea ecx, [ebp - 0x14]
push 4
push ecx
push ebx
push ebx
push 0x222400
push eax
mov ecx, esi
call fcn.00402c85
test eax, eax
jne 0x402491
mov ebx, dword [sym.imp.KERNEL32.dll_GetLastError]
lea eax, [ebp - 0x1018]
push edi
push eax
call ebx
push eax
call fcn.004017d5
add esp, 0xc
push eax
push str.COMMS:_Error_from_WILPT_GETVERSION____s
push dword [esi + 0x2b0]
call fcn.0041e63d
add esp, 0xc
lea eax, [ebp - 0x1018]
push edi
push eax
call ebx
push eax
call fcn.004017d5
add esp, 0xc
push eax
push edi
push dword [ebp + 8]
push 0xe
jmp 0x402409
push dword [ebp - 0x14]
push str.Using_WilPt__version_0x_X__to_access_parallel_port
push dword [esi + 0x2b0]
call fcn.0041e63d
mov al, byte [0x453278]
add esp, 0xc
mov byte [0x438188], al
mov al, byte [0x45327a]
mov byte [0x438189], al
mov al, byte [0x45327c]
mov byte [0x43818a], al
lea eax, [ebp - 4]
push eax
push ebx
push ebx
push 8
push 0x438188
push 0x22e404
push dword [esi + 0x194]
mov ecx, esi
call fcn.00402c85
test eax, eax
jne 0x402535
mov ebx, dword [sym.imp.KERNEL32.dll_GetLastError]
lea eax, [ebp - 0x1018]
push edi
push eax
call ebx
push eax
call fcn.004017d5
add esp, 0xc
push eax
push str.COMMS:_Error_from_WILPT_INITIALISE____s
push dword [esi + 0x2b0]
call fcn.0041e63d
add esp, 0xc
lea eax, [ebp - 0x1018]
push edi
push eax
call ebx
push eax
call fcn.004017d5
add esp, 0xc
push eax
lea eax, [esi + 0x32]
push eax
push edi
push dword [ebp + 8]
push 0xc
jmp 0x40259e
lea eax, [ebp - 4]
mov ecx, esi
push eax
push ebx
push ebx
push ebx
push ebx
push 0x226438
push dword [esi + 0x194]
call fcn.00402c85
test eax, eax
jne 0x4025b0
mov ebx, dword [sym.imp.KERNEL32.dll_GetLastError]
lea eax, [ebp - 0x1018]
push edi
push eax
call ebx
push eax
call fcn.004017d5
add esp, 0xc
push eax
push str.COMMS:_Error_from_WILPT_OPEN____s
push dword [esi + 0x2b0]
call fcn.0041e63d
add esp, 0xc
lea eax, [ebp - 0x1018]
push edi
push eax
call ebx
push eax
call fcn.004017d5
add esp, 0xc
push eax
lea eax, [esi + 0x32]
push eax
push edi
push dword [ebp + 8]
push 0xd
push 0x454168
call fcn.00420804
add esp, 0x18
jmp 0x40288c
mov ax, word [esi + 6]
test al, 4
je 0x4026e2
push str.COMMS:_Using_GF1190.Sys_to_access_GF1190_USB_to_LPT_converter
push dword [esi + 0x2b0]
call fcn.0041e63d
lea eax, [ebp - 0xc]
mov dword [esi + 0x34c], ebx
push eax
push ebx
push esi
push 0x4048c3
push ebx
push ebx
call fcn.0042b9c1
add esp, 0x20
cmp eax, ebx
mov dword [esi + 0x33c], eax
jne 0x4025fb
push str.Failed_to_create_GF1190_thread
jmp 0x402863
cmp word [ebp + 0xc], bx
jne 0x402633
lea eax, [ebp - 4]
mov ecx, esi
push eax
lea eax, [ebp - 0x1018]
push edi
push eax
call fcn.00406168
test ax, ax
jne 0x402633
lea eax, [ebp - 0x1018]
push eax
push str.Device_ID____s_
push dword [esi + 0x2b0]
call fcn.0041e63d
add esp, 0xc
cmp word [ebp + 0xc], bx
mov word [esi + 0x248], bx
mov word [esi + 0x308], bx
mov word [esi + 0x30c], bx
jne 0x402658
push ebx
push 1
mov ecx, esi
call fcn.004054f3
mov eax, dword [esi + 0x314]
mov dword [esi + 0x278], ebx
mov dword [esi + 0x274], eax
lea eax, [ebp - 0xc]
push eax
push ebx
push esi
push 0x4040db
push ebx
push ebx
call fcn.0042b9c1
mov dword [esi + 0x1a4], eax
lea eax, [ebp - 0xc]
push eax
push ebx
push esi
push 0x403141
push ebx
push ebx
call fcn.0042b9c1
add esp, 0x30
cmp dword [esi + 0x1a4], ebx
mov dword [esi + 0x1a0], eax
je 0x40285e
cmp eax, ebx
je 0x40285e
test byte [esi + 6], 0x24
jne 0x4026da
lea eax, [ebp - 0xc]
push eax
push ebx
push esi
push 0x4044b4
push ebx
push ebx
call fcn.0042b9c1
add esp, 0x18
cmp eax, ebx
mov dword [esi + 0x1a8], eax
je 0x40285e
mov dword [ebp - 8], ebx
jmp 0x402895
test al, 0x20
jne 0x402633
mov eax, 0x8000
push eax
push eax
push dword [esi + 0x194]
call dword [sym.imp.KERNEL32.dll_SetupComm]
cmp eax, ebx
mov dword [ebp - 4], eax
jne 0x40272f
lea eax, [ebp - 0x1018]
push edi
push eax
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
call fcn.00424a92
add esp, 0xc
push eax
push str.COMMS:_Error_from_SetupComm____s
push dword [esi + 0x2b0]
call fcn.0041e63d
add esp, 0xc
lea eax, [esi + 0x1b4]
push eax
push dword [esi + 0x194]
call dword [sym.imp.KERNEL32.dll_GetCommTimeouts]
cmp eax, ebx
mov dword [ebp - 4], eax
je 0x402754
mov word [esi + 0x1c8], 1
jmp 0x40277f
lea eax, [ebp - 0x1018]
push edi
push eax
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
call fcn.00424a92
add esp, 0xc
push eax
push str.COMMS:_Error_from_GetCommTimeouts____s
push dword [esi + 0x2b0]
call fcn.0041e63d
add esp, 0xc
lea eax, [esi + 0x1e8]
push eax
push dword [esi + 0x194]
call dword [sym.imp.KERNEL32.dll_GetCommState]
cmp eax, ebx
mov dword [ebp - 4], eax
je 0x4027a4
mov word [esi + 0x204], 1
jmp 0x4027cf
lea eax, [ebp - 0x1018]
push edi
push eax
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
call fcn.00424a92
add esp, 0xc
push eax
push str.COMMS:_Error_from_GetCommState____s
push dword [esi + 0x2b0]
call fcn.0041e63d
add esp, 0xc
push 0x1c
lea eax, [esi + 0x1cc]
push 0x438168
push eax
call fcn.0042b2e0
add esp, 0xc
cmp word [0x452eec], bx
je 0x4027f5
and dword [esi + 0x1d4], 0xfffffff7
push ebx
push ebx
mov ecx, esi
call fcn.00402ce1
cmp ax, bx
je 0x402808
mov dword [ebp - 8], eax
jmp 0x402886
push 0x9c2
push dword [esi + 0x194]
call dword [sym.imp.KERNEL32.dll_SetCommMask]
cmp eax, ebx
mov dword [ebp - 4], eax
jne 0x402633
lea eax, [ebp - 0x1018]
push edi
push eax
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
call fcn.00424a92
add esp, 0xc
push eax
push str.COMMS:_Error_from_SetCommMask____s
push dword [esi + 0x2b0]
call fcn.0041e63d
push str.Failed_in_call_to_SetCommMask
push dword [ebp + 8]
call fcn.0042b1f0
add esp, 0x14
jmp 0x40288c
push str.Failed_to_create_comms_threads
push dword [ebp + 8]
call fcn.0042b1f0
pop ecx
pop ecx
jmp 0x40288c
lea eax, [esi + 0x32]
push eax
push edi
push dword [ebp + 8]
push 0xb
push 0x454168
call fcn.00420804
add esp, 0x14
cmp word [ebp - 8], bx
je 0x402895
mov ecx, esi
call fcn.004028b3
jmp 0x40289f
mov word [esi + 0x2e], 1
mov word [esi + 0x30], bx
push dword [ebp - 0x18]
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov ax, word [ebp - 8]
pop edi
pop esi
pop ebx
leave
ret 8