Function at 0x10021521
Capabilities:
Create thread

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x28
mov dword [ebp - 0x24], ecx
mov dword [ebp - 4], 0
mov eax, dword [ebp - 0x24]
cmp dword [eax + 8], 0
je 0x10021586
mov ecx, dword [ebp + 8]
and ecx, 0xff
test ecx, ecx
je 0x10021550
mov dword [ebp - 0x28], 0x10041d84
jmp 0x10021557
mov dword [ebp - 0x28], 0x10041d88
mov edx, dword [ebp + 0x18]
push edx
mov eax, dword [ebp + 0xc]
push eax
mov ecx, dword [ebp + 0x10]
or cl, 0x80
push ecx
mov edx, dword [ebp - 0x28]
push edx
push str.EnterModeProcess:__s__Mode__0x_X__Expect_Port:___d__TimeOut___d
push 3
mov eax, dword [ebp - 0x24]
mov ecx, dword [eax + 8]
mov edx, dword [ebp - 0x24]
mov eax, dword [edx + 8]
mov edx, dword [eax]
push ecx
call dword [edx + 0x1c]
add esp, 0x1c
mov eax, dword [ebp + 8]
and eax, 0xff
test eax, eax
jne 0x100215d7
mov ecx, dword [ebp - 0x24]
cmp dword [ecx + 0x10bbc], 0
jne 0x100215d7
mov edx, dword [ebp - 0x24]
cmp dword [edx + 8], 0
je 0x100215cd
mov eax, dword [ebp - 0x24]
mov ecx, dword [eax + 0xba4]
push ecx
push 0x10041dd4
push 1
mov edx, dword [ebp - 0x24]
mov eax, dword [edx + 8]
mov ecx, dword [ebp - 0x24]
mov edx, dword [ecx + 8]
mov ecx, dword [edx]
push eax
call dword [ecx + 0x1c]
add esp, 0x10
mov eax, 7
jmp 0x1002195d
mov edx, dword [ebp + 8]
and edx, 0xff
mov eax, dword [ebp - 0x24]
mov dword [eax + 0x10e20], edx
mov ecx, dword [ebp - 0x24]
mov edx, dword [ebp + 0x10]
mov dword [ecx + 0x10e24], edx
mov eax, dword [ebp - 0x24]
mov ecx, dword [ebp + 0x14]
mov dword [eax + 0x10e28], ecx
mov edx, dword [ebp - 0x24]
mov eax, dword [ebp + 0x18]
mov dword [edx + 0x10e2c], eax
mov ecx, dword [ebp - 0x24]
cmp dword [ecx + 0x10e28], 0
jne 0x10021630
push 0
push 0
push 1
push 0
call dword [sym.imp.KERNEL32.dll_CreateEventA]
mov edx, dword [ebp - 0x24]
mov dword [edx + 0x10e28], eax
mov ecx, dword [ebp - 0x24]
call fcn.10021441
mov eax, dword [ebp + 8]
and eax, 0xff
test eax, eax
je 0x100216f9
mov ecx, dword [ebp - 0x24]
mov edx, dword [ebp + 0x1c]
mov dword [ecx + 0x10e40], edx
cmp dword [ebp + 0xc], 0
jle 0x10021675
mov eax, dword [ebp - 0x24]
mov dword [eax + 0x10e58], 1
mov ecx, dword [ebp - 0x24]
mov edx, dword [ebp + 0xc]
mov dword [ecx + 0x10e5c], edx
jmp 0x1002168f
mov eax, dword [ebp - 0x24]
mov dword [eax + 0x10e58], 0
mov ecx, dword [ebp - 0x24]
mov dword [ecx + 0x10e5c], 0
mov edx, dword [ebp - 0x24]
cmp dword [edx + 0x10cd8], 1
jne 0x100216bd
mov eax, dword [ebp - 0x24]
mov byte [eax + 0xb9d], 0
mov ecx, dword [ebp - 0x24]
xor edx, edx
mov dl, byte [ecx + 0xb9d]
push edx
push 1
push 3
mov ecx, dword [ebp - 0x24]
call fcn.1001c7cf
mov ecx, dword [ebp - 0x24]
call fcn.1001f120
push eax
mov eax, dword [ebp - 0x24]
push eax
mov ecx, 0x10046280
call fcn.100263e0
mov ecx, dword [ebp - 0x24]
mov edx, dword [ecx + 0x10e4c]
push edx
call dword [sym.imp.KERNEL32.dll_ResetEvent]
mov eax, dword [ebp - 0x24]
mov ecx, dword [eax + 0x10e50]
push ecx
call dword [sym.imp.KERNEL32.dll_ResetEvent]
jmp 0x1002181b
mov edx, dword [ebp - 0x24]
cmp dword [edx + 0x10e44], 0xffffffff
jne 0x1002176c
mov eax, dword [ebp - 0x24]
push eax
push 0x10021160
push 1
mov ecx, dword [ebp - 0x24]
mov ecx, dword [ecx + 0x10bc4]
call fcn.1001e216
mov edx, dword [ebp - 0x24]
mov dword [edx + 0x10e44], eax
mov eax, dword [ebp - 0x24]
cmp dword [eax + 0x10e44], 0
jge 0x1002176c
mov ecx, dword [ebp - 0x24]
cmp dword [ecx + 8], 0
je 0x10021762
mov edx, dword [ebp - 0x24]
mov eax, dword [edx + 0x10e44]
push eax
push str.RegisterCallBack_failed___ID___d
push 1
mov ecx, dword [ebp - 0x24]
mov edx, dword [ecx + 8]
mov eax, dword [ebp - 0x24]
mov ecx, dword [eax + 8]
mov eax, dword [ecx]
push edx
call dword [eax + 0x1c]
add esp, 0x10
mov eax, 2
jmp 0x1002195d
mov ecx, dword [ebp - 0x24]
mov edx, dword [ecx + 0x10e48]
push edx
call dword [sym.imp.KERNEL32.dll_ResetEvent]
mov eax, dword [ebp - 0x24]
xor ecx, ecx
mov cl, byte [eax + 0x10cd4]
test ecx, ecx
jne 0x1002181b
mov edx, dword [ebp - 0x24]
xor eax, eax
mov al, byte [edx + 0xb9c]
shl eax, 8
or al, 2
push eax
push 0
push 0
mov ecx, dword [ebp - 0x24]
mov ecx, dword [ecx + 0x10bb8]
mov edx, dword [ebp - 0x24]
mov eax, dword [edx + 0x10bb8]
mov edx, dword [eax]
call dword [edx + 0x2c]
mov eax, dword [ebp - 0x24]
xor ecx, ecx
mov cl, byte [eax + 0xb9c]
shl ecx, 8
or ecx, 2
push ecx
push 0
push 0
mov edx, dword [ebp - 0x24]
mov ecx, dword [edx + 0x10bc0]
mov eax, dword [ebp - 0x24]
mov edx, dword [eax + 0x10bc0]
mov eax, dword [edx]
call dword [eax + 0x18]
mov ecx, dword [ebp - 0x24]
cmp dword [ecx + 8], 0
je 0x1002181b
push 2
mov edx, dword [ebp - 0x24]
xor eax, eax
mov al, byte [edx + 0xb9c]
push eax
push str.Set_Endian___High:__d__Low:__d_
push 3
mov ecx, dword [ebp - 0x24]
mov edx, dword [ecx + 8]
mov eax, dword [ebp - 0x24]
mov ecx, dword [eax + 8]
mov eax, dword [ecx]
push edx
call dword [eax + 0x1c]
add esp, 0x14
mov ecx, dword [ebp - 0x24]
mov edx, dword [ecx + 0x10e34]
push edx
call dword [sym.imp.KERNEL32.dll_ResetEvent]
mov eax, dword [ebp - 0x24]
mov ecx, dword [eax + 0x10e28]
push ecx
call dword [sym.imp.KERNEL32.dll_ResetEvent]
push 0
push 0
mov edx, dword [ebp - 0x24]
push edx
push 0x10021e47
push 0
push 0
call fcn.1002a6ef
add esp, 0x18
mov ecx, dword [ebp - 0x24]
mov dword [ecx + 0x10e30], eax
mov edx, dword [ebp - 0x24]
cmp dword [edx + 0x10e30], 0
jne 0x1002189f
mov eax, dword [ebp - 0x24]
cmp dword [eax + 8], 0
je 0x10021895
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.Create_mode_thread_failed__error:
push 1
mov ecx, dword [ebp - 0x24]
mov edx, dword [ecx + 8]
mov eax, dword [ebp - 0x24]
mov ecx, dword [eax + 8]
mov eax, dword [ecx]
push edx
call dword [eax + 0x1c]
add esp, 0x10
mov eax, 4
jmp 0x1002195d
mov ecx, dword [ebp - 0x24]
mov dword [ecx + 0x10e38], 1
cmp dword [ebp + 0x14], 0
jne 0x1002195b
push 1
push 0
push 0
push 0
lea edx, [ebp - 0x20]
push edx
call dword [sym.imp.USER32.dll_PeekMessageA]
test eax, eax
je 0x100218ee
mov eax, dword [ebp - 0x24]
cmp dword [eax + 0x10e38], 0
je 0x100218ee
lea ecx, [ebp - 0x20]
push ecx
call dword [sym.imp.USER32.dll_TranslateMessage]
lea edx, [ebp - 0x20]
push edx
call dword [sym.imp.USER32.dll_DispatchMessageA]
jmp 0x100218b6
push 0
mov eax, dword [ebp - 0x24]
mov ecx, dword [eax + 0x10e28]
push ecx
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
neg eax
sbb eax, eax
and eax, 8
mov dword [ebp - 4], eax
mov edx, dword [ebp - 0x24]
mov eax, dword [edx + 0x10e28]
push eax
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov ecx, dword [ebp - 0x24]
mov dword [ecx + 0x10e28], 0
cmp dword [ebp - 4], 0
je 0x1002195b
mov edx, dword [ebp - 0x24]
cmp dword [edx + 8], 0
je 0x10021956
mov eax, dword [ebp - 4]
push eax
push str.EnterModeProcess___failed__error___d
push 1
mov ecx, dword [ebp - 0x24]
mov edx, dword [ecx + 8]
mov eax, dword [ebp - 0x24]
mov ecx, dword [eax + 8]
mov eax, dword [ecx]
push edx
call dword [eax + 0x1c]
add esp, 0x10
mov eax, dword [ebp - 4]
jmp 0x1002195d
xor eax, eax
mov esp, ebp
pop ebp
ret 0x18