Function at 0x10022140
Capabilities:
Hook routines via microsoft detours
Resume thread

Disassembly:
sub esp, 0x2d8
mov eax, dword [0x10088064]
xor eax, esp
mov dword [esp + 0x2d4], eax
push esi
mov esi, dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
call esi
cmp dword [0x1008a51c], eax
je 0x10022180
mov eax, 0x10dd
pop esi
mov ecx, dword [esp + 0x2d4]
xor ecx, esp
call fcn.1005c833
add esp, 0x2d8
ret
cmp dword [0x1008a518], 0
push ebx
push ebp
push edi
je 0x1002224d
call esi
cmp dword [0x1008a51c], eax
jne 0x1002255e
mov edi, dword [0x1008a530]
test edi, edi
je 0x1002220a
mov ebp, dword [sym.imp.KERNEL32.dll_VirtualProtect]
nop
lea eax, [esp + 0x10]
push eax
mov eax, dword [edi + 0x10]
push dword [edi + 0x14]
movzx eax, byte [eax + 0x36]
push eax
push dword [edi + 0xc]
call ebp
cmp dword [edi + 4], 0
jne 0x100221f7
mov ebx, dword [edi + 0x10]
test ebx, ebx
je 0x100221f7
push 0x48
push 0
mov esi, ebx
push ebx
and esi, 0xffff0000
call sub.msvcrt.dll_memset
mov eax, dword [esi + 8]
add esp, 0xc
mov dword [ebx + 0x40], eax
mov dword [esi + 8], ebx
mov dword [edi + 0x10], 0
mov esi, dword [edi]
push 0x18
push edi
call fcn.1005cd99
add esp, 8
mov edi, esi
test esi, esi
jne 0x100221b0
mov dword [0x1008a530], 0
call fcn.10021e50
mov edi, dword [0x1008a52c]
test edi, edi
je 0x1002254a
mov ebx, dword [sym.imp.KERNEL32.dll_ResumeThread]
nop dword [eax]
push dword [edi + 4]
call ebx
mov esi, dword [edi]
push 8
push edi
call fcn.1005cd99
add esp, 8
mov edi, esi
test esi, esi
jne 0x10022230
jmp 0x1002254a
mov esi, dword [0x1008a530]
xor ebx, ebx
mov dword [esp + 0x10], ebx
test esi, esi
je 0x100222cb
nop dword [eax]
mov ecx, dword [esi + 0x10]
cmp dword [esi + 4], ebx
je 0x10022286
movzx eax, byte [ecx + 0x36]
push eax
lea eax, [ecx + 0x20]
push eax
push dword [esi + 0xc]
call sub.msvcrt.dll_memcpy
mov ecx, dword [esi + 8]
add esp, 0xc
mov eax, dword [esi + 0xc]
mov dword [ecx], eax
jmp 0x100222c5
mov edx, dword [esi + 0xc]
xor ebp, ebp
mov ecx, dword [ecx + 0x44]
lea eax, [edx + 5]
mov byte [edx], 0xe9
sub ecx, eax
lea edi, [edx + 5]
mov dword [edx + 1], ecx
mov ecx, dword [esi + 0x10]
mov edx, dword [ecx + 0x40]
sub edx, edi
cmp edi, dword [ecx + 0x40]
cmova edx, ebp
test edx, edx
je 0x100222c0
push edx
push 0xcc
push edi
call sub.msvcrt.dll_memset
mov ecx, dword [esi + 0x10]
add esp, 0xc
mov eax, dword [esi + 8]
mov dword [eax], ecx
mov esi, dword [esi]
test esi, esi
jne 0x10022260
mov ebp, dword [0x1008a52c]
test ebp, ebp
je 0x100223cc
nop dword [eax]
lea eax, [esp + 0x18]
mov dword [esp + 0x18], 0x10001
push eax
push dword [ebp + 4]
call dword [sym.imp.KERNEL32.dll_GetThreadContext]
test eax, eax
je 0x100223bf
mov esi, dword [0x1008a530]
test esi, esi
je 0x100223bf
mov ebx, dword [esp + 0xd0]
cmp dword [esi + 4], 0
je 0x10022360
mov ecx, dword [esi + 0x10]
cmp ebx, ecx
jb 0x100223b5
lea eax, [ecx + 4]
cmp ebx, eax
jae 0x100223b5
xor eax, eax
lea edi, [ecx + 0x38]
mov ch, byte [eax + edi]
mov dl, bl
sub dl, byte [esi + 0x10]
mov cl, ch
shr cl, 3
cmp cl, dl
je 0x10022355
inc eax
cmp eax, 8
jb 0x10022334
xor ch, ch
movzx eax, ch
add eax, dword [esi + 0xc]
jmp 0x10022399
and ch, 7
movzx eax, ch
add eax, dword [esi + 0xc]
jmp 0x10022399
mov ecx, dword [esi + 0xc]
cmp ebx, ecx
jb 0x100223b5
mov edi, dword [esi + 0x10]
movzx eax, byte [edi + 0x36]
add eax, ecx
cmp ebx, eax
jae 0x100223b5
xor edx, edx
mov ah, byte [edx + edi + 0x38]
mov cl, bl
sub cl, byte [esi + 0xc]
mov al, ah
and al, 7
cmp al, cl
je 0x10022391
inc edx
cmp edx, 8
jb 0x10022376
xor eax, eax
jmp 0x10022397
movzx eax, ah
shr eax, 3
add eax, edi
mov dword [esp + 0xd0], eax
lea eax, [esp + 0x18]
push eax
push dword [ebp + 4]
call dword [sym.imp.KERNEL32.dll_SetThreadContext]
mov ebx, dword [esp + 0xd0]
mov esi, dword [esi]
test esi, esi
jne 0x10022313
mov ebp, dword [ebp]
test ebp, ebp
jne 0x100222e0
xor ebx, ebx
call dword [sym.imp.KERNEL32.dll_GetCurrentProcess]
mov edi, dword [0x1008a530]
mov ebp, eax
test edi, edi
je 0x10022461
lea eax, [esp + 0x14]
push eax
mov eax, dword [edi + 0x10]
push dword [edi + 0x14]
movzx eax, byte [eax + 0x36]
push eax
push dword [edi + 0xc]
call dword [sym.imp.KERNEL32.dll_VirtualProtect]
mov eax, dword [edi + 0x10]
movzx eax, byte [eax + 0x36]
push eax
push dword [edi + 0xc]
push ebp
call dword [sym.imp.KERNEL32.dll_FlushInstructionCache]
cmp dword [edi + 4], 0
je 0x1002244e
mov ebx, dword [edi + 0x10]
test ebx, ebx
je 0x1002244a
push 0x48
push 0
mov esi, ebx
push ebx
and esi, 0xffff0000
call sub.msvcrt.dll_memset
mov eax, dword [esi + 8]
add esp, 0xc
mov dword [ebx + 0x40], eax
mov dword [esi + 8], ebx
mov ebx, 1
mov dword [edi + 0x10], 0
mov dword [esp + 0x10], ebx
jmp 0x1002244e
mov ebx, dword [esp + 0x10]
mov esi, dword [edi]
push 0x18
push edi
call fcn.1005cd99
add esp, 8
mov edi, esi
test esi, esi
jne 0x100223e2
mov dword [0x1008a530], 0
test ebx, ebx
je 0x100224e5
cmp dword [0x1008a4f0], 0
jne 0x100224e5
mov ecx, dword [0x1008a528]
mov ebx, 0x1008a528
test ecx, ecx
je 0x100224e5
mov ebp, dword [sym.imp.KERNEL32.dll_VirtualFree]
cmp dword [ecx], 0x52727464
jne 0x100224dc
lea edi, [ecx + 0x10000]
xor esi, esi
lea edx, [ecx + 0x88]
mov eax, dword [edx]
test eax, eax
je 0x100224b5
cmp eax, ecx
jb 0x100224dc
cmp eax, edi
jae 0x100224dc
inc esi
add edx, 0x48
cmp esi, 0x38d
jb 0x100224a7
mov eax, dword [ecx + 4]
push 0x8000
push 0
push ecx
mov dword [ebx], eax
call ebp
mov dword [0x1008a520], 0
jmp 0x100224df
lea ebx, [ecx + 4]
mov ecx, dword [ebx]
test ecx, ecx
jne 0x10022491
call dword [sym.imp.KERNEL32.dll_GetCurrentProcess]
mov esi, dword [0x1008a528]
mov edi, eax
test esi, esi
je 0x10022522
mov ebx, dword [sym.imp.KERNEL32.dll_VirtualProtect]
mov ebp, dword [sym.imp.KERNEL32.dll_FlushInstructionCache]
lea eax, [esp + 0x14]
push eax
push 0x20
push 0x10000
push esi
call ebx
push 0x10000
push esi
push edi
call ebp
mov esi, dword [esi + 4]
test esi, esi
jne 0x10022503
mov edi, dword [0x1008a52c]
test edi, edi
je 0x1002254a
mov ebx, dword [sym.imp.KERNEL32.dll_ResumeThread]
push dword [edi + 4]
call ebx
mov esi, dword [edi]
push 8
push edi
call fcn.1005cd99
add esp, 8
mov edi, esi
test esi, esi
jne 0x10022532
mov dword [0x1008a52c], 0
mov dword [0x1008a51c], 0
mov ecx, dword [esp + 0x2e4]
mov eax, dword [0x1008a518]
pop edi
pop ebp
pop ebx
pop esi
xor ecx, esp
call fcn.1005c833
add esp, 0x2d8
ret