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

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x40
push ebx
push esi
push edi
call fcn.004031b0
mov edi, dword [sym.imp.KERNEL32.dll_lstrcpyA]
push 0
push 0
call edi
push 0
push 0
push 0
push 0
call fcn.00403510
add esp, 0x10
push 1
push 0
push 0
call dword [sym.imp.ADVAPI32.dll_OpenSCManagerA]
mov ebx, eax
test ebx, ebx
mov dword [ebp - 4], ebx
jne 0x404800
call fcn.004031b0
push str.chg::OpenSCManager_Failed
push 0x411a34
call dword [sym.imp.USER32.dll_wsprintfA]
add esp, 8
xor eax, eax
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
mov eax, dword [ebp + 0xc]
push 0xb4
push eax
push ebx
call dword [sym.imp.ADVAPI32.dll_OpenServiceA]
mov esi, eax
test esi, esi
jne 0x404843
call fcn.004031b0
push str.chg::OpenService_Failed
push 0x411a34
call dword [sym.imp.USER32.dll_wsprintfA]
add esp, 8
push esi
mov esi, dword [sym.imp.ADVAPI32.dll_CloseServiceHandle]
call esi
push ebx
call esi
pop edi
pop esi
xor eax, eax
pop ebx
mov esp, ebp
pop ebp
ret
mov ebx, dword [sym.imp.ADVAPI32.dll_QueryServiceStatus]
lea ecx, [ebp - 0x40]
push ecx
push esi
call ebx
test eax, eax
mov dword [ebp + 0xc], eax
jne 0x404874
call fcn.004031b0
push str.chg::QueryServiceStatus_Failed
push 0x411a34
call dword [sym.imp.USER32.dll_wsprintfA]
add esp, 8
jmp 0x4049f0
mov eax, dword [ebp + 8]
mov ecx, dword [ebp - 0x3c]
cmp ecx, eax
je 0x404a08
cmp eax, 0xffff
jne 0x404945
push 0
push 0
call edi
push 0
push 0
push 0
push 0
call fcn.00403510
add esp, 0x10
push 0
push 0
push esi
call dword [sym.imp.ADVAPI32.dll_StartServiceA]
mov dword [ebp + 0xc], eax
call dword [sym.imp.KERNEL32.dll_GetTickCount]
push 0
push 0
mov dword [ebp + 8], eax
call edi
push 0
push 0
push 0
push 0
call fcn.00403510
add esp, 0x10
lea eax, [ebp - 0x24]
push eax
push esi
call ebx
test eax, eax
je 0x40491d
cmp dword [ebp - 0x20], 4
je 0x40491d
push 0x1f4
call dword [sym.imp.KERNEL32.dll_Sleep]
call dword [sym.imp.KERNEL32.dll_GetTickCount]
sub eax, dword [ebp + 8]
cmp eax, 0x2710
jae 0x40491d
push 0
push 0
call edi
push 0
push 0
push 0
push 0
call fcn.00403510
add esp, 0x10
lea ecx, [ebp - 0x24]
push ecx
push esi
call ebx
test eax, eax
jne 0x4048db
mov eax, dword [ebp + 0xc]
test eax, eax
jne 0x404a08
call fcn.004031b0
push str.chg::StartService_Failed
push 0x411a34
call dword [sym.imp.USER32.dll_wsprintfA]
add esp, 8
jmp 0x4049f0
lea ecx, [ebp - 0x40]
push ecx
push eax
push esi
call dword [sym.imp.ADVAPI32.dll_ControlService]
mov dword [ebp + 0xc], eax
mov eax, dword [ebp + 8]
cmp eax, 1
je 0x404961
cmp eax, 5
jne 0x4049cd
call dword [sym.imp.KERNEL32.dll_GetTickCount]
push 0
push 0
mov dword [ebp - 8], eax
call edi
push 0
push 0
push 0
push 0
call fcn.00403510
add esp, 0x10
lea edx, [ebp - 0x24]
push edx
push esi
call ebx
test eax, eax
je 0x4049cd
cmp dword [ebp - 0x20], 1
je 0x4049cd
push 0x1f4
call dword [sym.imp.KERNEL32.dll_Sleep]
call dword [sym.imp.KERNEL32.dll_GetTickCount]
sub eax, dword [ebp - 8]
cmp eax, 0x2710
jae 0x4049cd
push 0
push 0
call edi
push 0
push 0
push 0
push 0
call fcn.00403510
add esp, 0x10
lea eax, [ebp - 0x24]
push eax
push esi
call ebx
test eax, eax
jne 0x40498b
mov eax, dword [ebp + 0xc]
test eax, eax
jne 0x404a08
call fcn.004031b0
mov ecx, dword [ebp + 8]
push ecx
push str.chg::ControlService__WaitServiceStatus___d__Failed
push 0x411a34
call dword [sym.imp.USER32.dll_wsprintfA]
add esp, 0xc
push esi
mov esi, dword [sym.imp.ADVAPI32.dll_CloseServiceHandle]
call esi
mov edx, dword [ebp - 4]
push edx
call esi
pop edi
pop esi
xor eax, eax
pop ebx
mov esp, ebp
pop ebp
ret
push esi
mov esi, dword [sym.imp.ADVAPI32.dll_CloseServiceHandle]
call esi
mov eax, dword [ebp - 4]
push eax
call esi
mov eax, dword [ebp + 0xc]
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret