Function at 0x406680
Capabilities:
Check for time delay via gettickcount
Enumerate services
Query service status
Stop service

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x54
push ebx
push esi
push edi
mov edi, dword [sym.imp.KERNEL32.dll_GetTickCount]
mov esi, ecx
mov dword [ebp - 0x10], esi
call edi
mov ecx, dword [esi + 4]
mov ebx, dword [sym.imp.ADVAPI32.dll_QueryServiceStatus]
mov dword [ebp - 8], eax
lea eax, [ebp - 0x30]
push eax
push ecx
call ebx
test eax, eax
jne 0x4066bc
call dword [sym.imp.KERNEL32.dll_GetLastError]
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 8
mov eax, dword [ebp - 0x2c]
cmp eax, 1
je 0x4068ba
cmp eax, 3
jne 0x406702
lea ecx, [ecx]
mov edx, dword [ebp - 0x18]
push edx
call dword [sym.imp.KERNEL32.dll_Sleep]
mov ecx, dword [esi + 4]
lea eax, [ebp - 0x30]
push eax
push ecx
call ebx
test eax, eax
je 0x4066ad
cmp dword [ebp - 0x2c], 1
je 0x4068ba
call edi
sub eax, dword [ebp - 8]
cmp eax, dword [ebp + 0xc]
ja 0x406748
cmp dword [ebp - 0x2c], 3
je 0x4066d0
cmp byte [ebp + 8], 0
je 0x406866
mov ecx, dword [esi + 4]
mov edi, dword [sym.imp.ADVAPI32.dll_EnumDependentServicesW]
lea edx, [ebp - 4]
push edx
lea eax, [ebp + 8]
push eax
push 0
push 0
push 1
push ecx
call edi
test eax, eax
jne 0x406860
mov ebx, dword [sym.imp.KERNEL32.dll_GetLastError]
call ebx
cmp eax, 0xea
je 0x406756
call ebx
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 8
pop edi
pop esi
mov eax, 0x5b4
pop ebx
mov esp, ebp
pop ebp
ret 8
mov edx, dword [ebp + 8]
push edx
push 8
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
mov ebx, eax
mov dword [ebp - 0x14], ebx
test ebx, ebx
je 0x4066ad
mov edx, dword [ebp + 8]
lea eax, [ebp - 4]
push eax
mov eax, dword [esi + 4]
lea ecx, [ebp + 8]
push ecx
push edx
push ebx
push 1
push eax
call edi
test eax, eax
je 0x4066ad
cmp dword [ebp - 4], 0
mov dword [ebp - 0xc], 0
jbe 0x40684a
mov edx, dword [ebp - 0x10]
mov eax, dword [edx]
mov ecx, 9
mov esi, ebx
lea edi, [ebp - 0x54]
rep movsd dword es:[edi], dword [esi]
mov ecx, dword [ebp - 0x54]
push 0x24
push ecx
push eax
call dword [sym.imp.ADVAPI32.dll_OpenServiceW]
mov esi, eax
test esi, esi
je 0x4066ad
lea ecx, [ebp - 0x30]
push ecx
mov edi, 1
push edi
push esi
call dword [sym.imp.ADVAPI32.dll_ControlService]
test eax, eax
je 0x4066ad
cmp dword [ebp - 0x2c], edi
je 0x406829
lea ebx, [ebx]
mov edx, dword [ebp - 0x18]
push edx
call dword [sym.imp.KERNEL32.dll_Sleep]
lea eax, [ebp - 0x30]
push eax
push esi
call dword [sym.imp.ADVAPI32.dll_QueryServiceStatus]
test eax, eax
je 0x4066ad
cmp dword [ebp - 0x2c], edi
je 0x406829
call dword [sym.imp.KERNEL32.dll_GetTickCount]
sub eax, dword [ebp - 8]
cmp eax, dword [ebp + 0xc]
ja 0x406748
cmp dword [ebp - 0x2c], edi
jne 0x4067f0
push esi
call dword [sym.imp.ADVAPI32.dll_CloseServiceHandle]
mov eax, dword [ebp - 0xc]
add eax, edi
add ebx, 0x24
mov dword [ebp - 0xc], eax
cmp eax, dword [ebp - 4]
jb 0x4067a4
mov esi, dword [ebp - 0x10]
mov ebx, dword [ebp - 0x14]
push ebx
push 0
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call dword [sym.imp.KERNEL32.dll_HeapFree]
mov ebx, dword [sym.imp.ADVAPI32.dll_QueryServiceStatus]
mov edi, dword [sym.imp.KERNEL32.dll_GetTickCount]
mov edx, dword [esi + 4]
lea ecx, [ebp - 0x30]
push ecx
push 1
push edx
call dword [sym.imp.ADVAPI32.dll_ControlService]
test eax, eax
je 0x4066ad
cmp dword [ebp - 0x2c], 1
je 0x4068ba
mov eax, dword [ebp - 0x18]
push eax
call dword [sym.imp.KERNEL32.dll_Sleep]
mov edx, dword [esi + 4]
lea ecx, [ebp - 0x30]
push ecx
push edx
call ebx
test eax, eax
je 0x4066ad
cmp dword [ebp - 0x2c], 1
je 0x4068ba
call edi
sub eax, dword [ebp - 8]
cmp eax, dword [ebp + 0xc]
ja 0x406748
cmp dword [ebp - 0x2c], 1
jne 0x406884
pop edi
pop esi
xor eax, eax
pop ebx
mov esp, ebp
pop ebp
ret 8