Function at 0x1016a87
Capabilities:
Check for time delay via gettickcount

Disassembly:
mov edi, edi
push ebp
mov ebp, esp
sub esp, 0x18
and dword [ebp - 4], 0
push esi
mov esi, ecx
cmp dword [esi + 4], 1
jne 0x1016aa6
mov eax, 0x8007045b
jmp 0x1016e51
cmp dword [esi + 0x5c], 0
jne 0x1016ab3
xor eax, eax
jmp 0x1016e51
push ebx
mov ebx, dword [ebp + 8]
cmp ebx, 0x20
jg 0x1016e4b
test ebx, ebx
jl 0x1016e4b
call fcn.0102925b
test eax, eax
je 0x1016e44
call fcn.0102903b
test eax, eax
je 0x1016e44
cmp dword [esi + 4], 1
jne 0x1016af2
mov eax, 0x8007045b
jmp 0x1016e50
lea eax, [esi + 0x30]
push eax
mov dword [ebp - 0x18], eax
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
cmp dword [esi + 4], 1
jne 0x1016b11
mov dword [ebp - 4], 0x8007045b
jmp 0x1016e21
push edi
mov edi, dword [ebp + 0x10]
test edi, edi
je 0x1016b4f
mov eax, dword [esi + 0x58]
test eax, eax
je 0x1016b2b
push eax
call sub.msvcrt.dll_void___cdecl_operator_delete_void__
and dword [esi + 0x58], 0
pop ecx
cmp dword [esi + 0x50], 0
je 0x1016b4f
push 0
push edi
push dword [esi + 0x4c]
call dword [sym.imp.KERNEL32.dll_DeleteTimerQueueTimer]
cmp edi, dword [esi + 0x50]
je 0x1016b4b
and dword [ebp - 4], 0
jmp 0x1016e20
and dword [esi + 0x50], 0
cmp dword [esi + 8], 0
je 0x1016b42
lea eax, [ebx*4 + 8]
push eax
call sub.msvcrt.dll_void____cdecl_operator_new_unsigned_int_
test eax, eax
pop ecx
mov dword [ebp - 0xc], eax
jne 0x1016b76
mov dword [ebp - 4], 0x8007000e
jmp 0x1016e20
and dword [ebp - 8], 0
xor eax, eax
lea edi, [ebp + 0x12]
stosw word es:[edi], ax
call dword [sym.imp.KERNEL32.dll_GetTickCount]
xor ecx, ecx
test ebx, ebx
mov dword [ebp - 0x10], eax
jle 0x1016c16
mov edx, dword [ebp + 0xc]
xor edi, edi
cmp edi, dword [esi + 0x2c]
mov dword [ebp - 0x14], edi
jge 0x1016bba
mov ebx, dword [edx + ecx*4]
lea eax, [esi + 0xc]
cmp dword [eax], ebx
je 0x1016bb7
inc edi
add eax, 0x10
cmp edi, dword [esi + 0x2c]
mov dword [ebp - 0x14], edi
jl 0x1016ba7
cmp edi, dword [esi + 0x2c]
jne 0x1016bca
mov eax, dword [edx + ecx*4]
mov edi, dword [ebp - 0xc]
mov ebx, dword [ebp - 8]
mov dword [edi + ebx*4], eax
jmp 0x1016c0d
shl edi, 4
lea eax, [edi + esi]
cmp byte [eax + 0x18], 1
jne 0x1016bee
mov edi, dword [ebp - 0x10]
cmp edi, dword [eax + 0x14]
jb 0x1016be8
or ebx, 0xffffffff
sub ebx, dword [eax + 0x10]
cmp edi, ebx
jbe 0x1016bee
mov byte [eax + 0x19], 1
jmp 0x1016c10
mov edx, dword [edx + ecx*4]
mov edi, dword [ebp - 0xc]
mov ebx, dword [ebp - 8]
mov dword [edi + ebx*4], edx
mov edx, dword [ebp - 0x14]
mov byte [ebp + edx + 0x12], 1
mov edx, dword [ebp + 0xc]
mov byte [eax + 0x19], 0
mov byte [eax + 0x18], 0
inc dword [ebp - 8]
inc ecx
cmp ecx, dword [ebp + 8]
jl 0x1016b97
or dword [ebp + 0xc], 0xffffffff
xor ecx, ecx
cmp dword [esi + 0x2c], ecx
jle 0x1016c6c
lea eax, [esi + 0x19]
cmp byte [eax], 0
je 0x1016c63
mov edx, dword [ebp - 0x10]
cmp edx, dword [eax - 5]
jb 0x1016c58
or edi, 0xffffffff
sub edi, dword [eax - 9]
cmp edx, edi
ja 0x1016c58
mov ebx, dword [ebp - 8]
mov edx, dword [eax - 0xd]
mov edi, dword [ebp - 0xc]
inc dword [ebp - 8]
mov dword [edi + ebx*4], edx
mov byte [ebp + ecx + 0x12], 1
mov byte [eax], 0
mov byte [eax - 1], 0
jmp 0x1016c63
mov edx, dword [eax - 9]
cmp dword [ebp + 0xc], edx
jbe 0x1016c63
mov dword [ebp + 0xc], edx
inc ecx
add eax, 0x10
cmp ecx, dword [esi + 0x2c]
jl 0x1016c24
cmp dword [esi + 4], 1
jne 0x1016c7e
mov dword [ebp - 4], 0x8007045b
jmp 0x1016e20
xor ebx, ebx
cmp dword [ebp - 8], ebx
jle 0x1016d09
mov eax, dword [esi + 8]
mov edi, dword [eax]
push ebx
push ebx
xor edx, edx
push edx
xor ecx, ecx
push ecx
push eax
call dword [edi + 0x14]
lea eax, [ebp + 8]
push eax
push 0x1008418
push dword [esi + 8]
call dword [sym.imp.ole32.dll_CoUnmarshalInterface]
cmp eax, ebx
mov dword [ebp - 4], eax
jl 0x1016d4c
push dword [ebp - 0xc]
mov eax, dword [ebp + 8]
push dword [ebp - 8]
mov ecx, dword [eax]
push eax
call dword [ecx + 0xc]
mov dword [ebp - 4], eax
mov eax, dword [ebp + 8]
mov ecx, dword [eax]
push eax
call dword [ecx + 8]
cmp dword [ebp - 4], ebx
jl 0x1016d4c
call dword [sym.imp.KERNEL32.dll_GetTickCount]
xor edx, edx
cmp dword [esi + 0x2c], ebx
jle 0x1016d06
lea ecx, [esi + 0x14]
cmp byte [ebp + edx + 0x12], 0
je 0x1016cfd
mov edi, dword [ecx - 4]
add edi, eax
mov dword [ecx], edi
mov byte [ecx + 4], 1
mov byte [ecx + 5], 0
inc edx
add ecx, 0x10
cmp edx, dword [esi + 0x2c]
jl 0x1016ce7
mov dword [esi + 0x48], ebx
mov edx, dword [ebp + 0xc]
cmp edx, 0xffffffff
je 0x1016e20
mov ecx, dword [esi + 0x4c]
cmp ecx, 0xffffffff
je 0x1016e20
mov eax, dword [esi + 0x50]
cmp eax, ebx
je 0x1016d8e
mov edi, dword [ebp - 0x10]
add edi, edx
cmp edi, dword [esi + 0x54]
jae 0x1016d44
push ebx
push edx
push eax
push ecx
call dword [sym.imp.KERNEL32.dll_ChangeTimerQueueTimer]
test eax, eax
jne 0x1016e20
mov dword [ebp - 4], ebx
jmp 0x1016e20
mov eax, dword [esi + 0x48]
cmp eax, 3
lea ecx, [eax + 1]
mov dword [esi + 0x48], ecx
jae 0x1016d06
xor ecx, ecx
cmp dword [esi + 0x2c], ebx
jle 0x1016d86
push 0x64
lea eax, [esi + 0x18]
pop edx
cmp byte [ebp + ecx + 0x12], 0
je 0x1016d7d
cmp dword [ebp + 0xc], edx
mov byte [eax + 1], 1
mov byte [eax], 1
jbe 0x1016d7d
mov dword [ebp + 0xc], edx
inc ecx
add eax, 0x10
cmp ecx, dword [esi + 0x2c]
jl 0x1016d67
mov dword [ebp - 4], ebx
jmp 0x1016d09
cmp dword [esi + 4], 1
je 0x1016c72
mov eax, dword [esi + 0x58]
cmp eax, ebx
je 0x1016da9
push eax
call sub.msvcrt.dll_void___cdecl_operator_delete_void__
pop ecx
mov dword [esi + 0x58], ebx
push 8
call sub.msvcrt.dll_void____cdecl_operator_new_unsigned_int_
cmp eax, ebx
pop ecx
je 0x1016dbb
mov dword [eax], esi
mov edi, eax
jmp 0x1016dbd
xor edi, edi
cmp edi, ebx
je 0x1016b6a
call dword [sym.imp.KERNEL32.dll_GetTickCount]
push 0x28
push 0
push dword [ebp + 0xc]
lea ebx, [edi + 4]
push edi
push 0x1016e5b
push dword [esi + 0x4c]
mov dword [ebp + 8], eax
push ebx
mov dword [esi + 0x58], edi
call dword [sym.imp.KERNEL32.dll_CreateTimerQueueTimer]
test eax, eax
jne 0x1016e10
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
call fcn.01009676
mov dword [ebp - 4], eax
xor eax, eax
mov dword [esi + 0x58], eax
push edi
mov dword [ebx], eax
mov dword [edi], eax
call sub.msvcrt.dll_void___cdecl_operator_delete_void__
pop ecx
jmp 0x1016e20
mov eax, dword [ebx]
mov ecx, dword [ebp + 0xc]
mov dword [esi + 0x50], eax
mov eax, dword [ebp + 8]
add eax, ecx
mov dword [esi + 0x54], eax
pop edi
push dword [ebp - 0x18]
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
cmp dword [ebp - 0xc], 0
je 0x1016e39
push dword [ebp - 0xc]
call sub.msvcrt.dll_void___cdecl_operator_delete_void__
pop ecx
mov eax, dword [ebp - 4]
test eax, eax
jl 0x1016e50
xor eax, eax
jmp 0x1016e50
mov eax, 0x8000ffff
jmp 0x1016e50
mov eax, 0x80070057
pop ebx
pop esi
leave
ret 0xc