Function at 0x667291
Capabilities:
Check for time delay via gettickcount
Query service status
Stop service

Disassembly:
push 0x34
mov eax, 0x69e86d
call fcn.0049be59
xor edi, edi
mov dword [ebp - 4], edi
call dword [sym.imp.KERNEL32.dll_GetTickCount]
push 0xd
pop ebx
push 1
push edi
push edi
mov dword [ebp - 0x3c], eax
call dword [sym.imp.ADVAPI32.dll_OpenSCManagerW]
mov dword [ebp - 0x40], eax
test eax, eax
jne 0x6672df
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov edi, eax
push edi
push str.RunAsSvcHandler::StopSvc
push str._s::OpenSCManager_failed___d_
call fcn.00677869
add esp, 0xc
jmp 0x667493
push 0x24
push dword [ebp + 8]
push eax
call dword [sym.imp.ADVAPI32.dll_OpenServiceW]
mov esi, eax
test esi, esi
jne 0x66731a
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov edi, eax
push edi
push str.RunAsSvcHandler::StopSvc
push str._s::OpenService_failed___d_
call fcn.00677869
add esp, 0xc
push dword [ebp - 0x40]
call dword [sym.imp.ADVAPI32.dll_CloseServiceHandle]
jmp 0x667493
lea eax, [ebp - 0x38]
push eax
push 0x24
lea eax, [ebp - 0x34]
push eax
push edi
push esi
call dword [sym.imp.ADVAPI32.dll_QueryServiceStatusEx]
test eax, eax
jne 0x667350
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov ebx, eax
push ebx
push str.RunAsSvcHandler::StopSvc
push str._s::QueryServiceStatusEx_failed___d_
call fcn.00677869
add esp, 0xc
jmp 0x66747e
cmp dword [ebp - 0x30], 1
jne 0x6673d3
push str.RunAsSvcHandler::StopSvc
push str._s::Service_is_already_stopped.
call fcn.00677869
xor edi, edi
inc edi
jmp 0x66747c
push str.RunAsSvcHandler::StopSvc
push str._s::Service_stop_pending...
call fcn.00677869
mov eax, dword [ebp - 0x1c]
xor edx, edx
pop ecx
pop ecx
push 0xa
pop ecx
div ecx
mov ecx, 0x3e8
cmp eax, ecx
jb 0x66739a
mov ecx, 0x2710
cmp eax, ecx
jbe 0x66739c
mov eax, ecx
push eax
call dword [sym.imp.KERNEL32.dll_Sleep]
lea eax, [ebp - 0x38]
push eax
push 0x24
lea eax, [ebp - 0x34]
push eax
push edi
push esi
call dword [sym.imp.ADVAPI32.dll_QueryServiceStatusEx]
test eax, eax
je 0x667330
cmp dword [ebp - 0x30], 1
je 0x66740e
call dword [sym.imp.KERNEL32.dll_GetTickCount]
sub eax, dword [ebp - 0x3c]
cmp eax, 0x7530
ja 0x667402
cmp dword [ebp - 0x30], 3
je 0x66736d
lea eax, [ebp - 0x34]
push eax
push 1
push esi
call dword [sym.imp.ADVAPI32.dll_ControlService]
test eax, eax
jne 0x667456
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov ebx, eax
push ebx
push str.RunAsSvcHandler::StopSvc
push str._s::ControlService_failed___d_
jmp 0x667343
push str.RunAsSvcHandler::StopSvc
push str._s::Service_stop_timed_out.
jmp 0x667477
push str.RunAsSvcHandler::StopSvc
push str._s::Service_stopped_successfully.
jmp 0x667360
push dword [ebp - 0x1c]
call dword [sym.imp.KERNEL32.dll_Sleep]
lea eax, [ebp - 0x38]
push eax
push 0x24
lea eax, [ebp - 0x34]
push eax
push edi
push esi
call dword [sym.imp.ADVAPI32.dll_QueryServiceStatusEx]
test eax, eax
je 0x667330
cmp dword [ebp - 0x30], 1
je 0x66746a
call dword [sym.imp.KERNEL32.dll_GetTickCount]
sub eax, dword [ebp - 0x3c]
cmp eax, 0x7530
ja 0x66745e
cmp dword [ebp - 0x30], 1
jne 0x66741d
jmp 0x66746d
push str.RunAsSvcHandler::StopSvc
push str._s::Wait_timed_out
jmp 0x667477
xor edi, edi
inc edi
push str.RunAsSvcHandler::StopSvc
push str._s::Service_stopped_successfully
call fcn.00677869
pop ecx
pop ecx
push esi
mov esi, dword [sym.imp.ADVAPI32.dll_CloseServiceHandle]
call esi
push dword [ebp - 0x40]
call esi
dec edi
neg edi
sbb edi, edi
and edi, ebx
mov ecx, dword [ebp + 8]
add ecx, 0xfffffff0
call fcn.0044ec01
mov eax, edi
call fcn.0049be03
ret 4