Function at 0x402ca0
Capabilities:
Create thread

Disassembly:
push ebp
push edi
push esi
push ebx
sub esp, 0x3c
mov esi, dword [esp + 0x60]
mov ebx, dword [esp + 0x50]
cmp esi, 0x10000
ja 0x402e90
mov eax, dword [ebx + 4]
test eax, eax
je 0x402d01
mov dword [esp + 0xc], 0
mov dword [esp + 8], 0xffffffff
mov dword [esp + 4], eax
mov eax, dword [ebx + 8]
mov dword [esp], eax
call dword [sym.imp.KERNEL32.dll_SignalObjectAndWait]
mov eax, dword [ebx + 8]
sub esp, 0x10
mov edi, dword [sym.imp.KERNEL32.dll_CloseHandle]
mov dword [esp], eax
call edi
mov eax, dword [ebx + 4]
sub esp, 4
mov dword [esp], eax
call edi
sub esp, 4
mov eax, dword [ebx]
test eax, eax
je 0x402d13
mov dword [esp], eax
call dword [sym.imp.KERNEL32.dll_CloseHandle]
sub esp, 4
xor eax, eax
test esi, esi
jne 0x402d21
add esp, 0x3c
pop ebx
pop esi
pop edi
pop ebp
ret
mov eax, dword [esp + 0x58]
mov dword [esp + 4], 0
mov dword [esp + 8], eax
mov eax, dword [esp + 0x54]
mov dword [esp], eax
call sub.msvcrt.dll_memset
lea ecx, [ebx + 4]
mov eax, ebx
mov dword [ebx], 0
mov dword [ebx + 0x18], 0
xor edx, edx
and ecx, 0xfffffffc
sub eax, ecx
add eax, 0x1c
and eax, 0xfffffffc
mov dword [ecx + edx], 0
add edx, 4
cmp edx, eax
jb 0x402d5c
mov eax, dword [esp + 0x54]
xor edx, edx
mov dword [esp + 8], esi
mov dword [esp + 0xc], 0
mov dword [0x406438], eax
mov eax, dword [esp + 0x5c]
mov dword [0x40643c], eax
mov eax, dword [esp + 0x58]
shr eax, 1
shld edx, eax, 0x10
shl eax, 0x10
mov dword [esp], eax
mov dword [esp + 4], edx
call fcn.004030a0
mov edx, dword [esp + 0x5c]
mov dword [0x406444], esi
mov esi, dword [sym.imp.KERNEL32.dll_GetCurrentProcess]
lea eax, [edx + eax*2]
mov dword [0x406440], eax
call esi
mov ebp, eax
call dword [sym.imp.KERNEL32.dll_GetCurrentThread]
mov edi, eax
call esi
mov dword [esp + 0x18], 2
mov dword [esp + 0x14], 0
mov dword [esp + 0x10], 0
mov dword [esp + 0xc], ebx
mov dword [esp + 8], ebp
mov dword [esp + 4], edi
mov dword [esp], eax
call dword [sym.imp.KERNEL32.dll_DuplicateHandle]
sub esp, 0x1c
test eax, eax
je 0x402ea6
mov dword [esp + 0xc], 0
mov dword [esp + 8], 0
mov dword [esp + 4], 1
mov dword [esp], 0
call dword [sym.imp.KERNEL32.dll_CreateEventA]
sub esp, 0x10
test eax, eax
mov dword [ebx + 8], eax
je 0x402ef3
lea eax, [esp + 0x2c]
mov dword [esp + 0x10], 0
mov dword [esp + 0xc], ebx
mov dword [esp + 8], 0x402c40
mov dword [esp + 4], 0
mov dword [esp + 0x14], eax
mov dword [esp], 0
call dword [sym.imp.KERNEL32.dll_CreateThread]
sub esp, 0x18
test eax, eax
mov dword [ebx + 4], eax
je 0x402ebc
mov dword [esp + 4], 0xf
mov dword [esp], eax
call dword [sym.imp.KERNEL32.dll_SetThreadPriority]
sub esp, 8
xor eax, eax
add esp, 0x3c
pop ebx
pop esi
pop edi
pop ebp
ret
call dword [sym.imp.msvcrt.dll__errno]
mov dword [eax], 0x16
mov eax, 0xffffffff
jmp 0x402d19
call dword [sym.imp.msvcrt.dll__errno]
mov dword [eax], 3
mov eax, 0xffffffff
jmp 0x402d19
mov eax, dword [ebx]
mov esi, dword [sym.imp.KERNEL32.dll_CloseHandle]
mov dword [esp], eax
call esi
mov eax, dword [ebx + 8]
sub esp, 4
mov dword [esp], eax
call esi
sub esp, 4
mov dword [ebx], 0
call dword [sym.imp.msvcrt.dll__errno]
mov dword [eax], 0xb
mov eax, 0xffffffff
jmp 0x402d19
mov dword [esp], 0
call dword [sym.imp.KERNEL32.dll_CloseHandle]
jmp 0x402ed4