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

Disassembly:
push 0xffffffffffffffff
push 0x4d4b90
mov eax, dword fs:[0]
push eax
sub esp, 0x30
push ebx
push ebp
push esi
push edi
mov eax, dword [0x54d158]
xor eax, esp
push eax
lea eax, [esp + 0x44]
mov dword fs:[0], eax
mov ebp, dword [sym.imp.KERNEL32.dll_GetTickCount]
call ebp
push 0xf003f
push 0
push 0
mov dword [esp + 0x20], eax
call dword [sym.imp.ADVAPI32.dll_OpenSCManagerW]
mov edi, eax
test edi, edi
mov dword [esp + 0x1c], edi
jne 0x40415d
call fcn.004a08e6
xor ecx, ecx
test eax, eax
setne cl
test ecx, ecx
jne 0x4040da
push 0x80004005
call fcn.004103e0
mov edx, dword [eax]
mov ecx, eax
mov eax, dword [edx + 0xc]
call eax
add eax, 0x10
mov dword [esp + 0x14], eax
mov dword [esp + 0x4c], 0
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
lea ecx, [esp + 0x18]
push str.OpenSCManager_failed___d__n
push ecx
call fcn.00410070
mov esi, dword [esp + 0x20]
add esp, 0xc
push esi
call fcn.004accd0
add eax, 0x40
push eax
call fcn.004acc3c
add esp, 8
lea eax, [esi - 0x10]
mov dword [esp + 0x4c], 0xffffffff
lea edx, [eax + 0xc]
or ecx, 0xffffffff
lock xadd dword [edx], ecx
dec ecx
test ecx, ecx
jg 0x404423
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
mov ecx, dword [esp + 0x44]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x3c
ret
push 0x2c
push 0x51b9b8
push edi
call dword [sym.imp.ADVAPI32.dll_OpenServiceW]
mov esi, eax
test esi, esi
jne 0x4041de
call fcn.004a08e6
xor ecx, ecx
test eax, eax
setne cl
test ecx, ecx
jne 0x40418b
push 0x80004005
call fcn.004103e0
mov edx, dword [eax]
mov ecx, eax
mov eax, dword [edx + 0xc]
call eax
add eax, 0x10
mov dword [esp + 0x14], eax
mov dword [esp + 0x4c], 1
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
lea ecx, [esp + 0x18]
push str.OpenService_failed___d__n
push ecx
call fcn.00410070
mov esi, dword [esp + 0x20]
add esp, 0xc
push esi
call fcn.004accd0
add eax, 0x40
push eax
call fcn.004acc3c
add esp, 8
push edi
call dword [sym.imp.ADVAPI32.dll_CloseServiceHandle]
jmp 0x404121
mov edi, dword [sym.imp.ADVAPI32.dll_QueryServiceStatusEx]
lea ecx, [esp + 0x18]
push ecx
push 0x24
lea edx, [esp + 0x28]
push edx
push 0
push esi
call edi
test eax, eax
jne 0x40428b
call fcn.004a08e6
xor ecx, ecx
test eax, eax
setne cl
test ecx, ecx
jne 0x404217
push 0x80004005
call fcn.004103e0
mov edx, dword [eax]
mov ecx, eax
mov eax, dword [edx + 0xc]
call eax
add eax, 0x10
mov dword [esp + 0x14], eax
mov dword [esp + 0x4c], 2
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
lea ecx, [esp + 0x18]
push str.QueryServiceStatusEx_failed___d__n
push ecx
call fcn.00410070
mov edi, dword [esp + 0x20]
add esp, 0xc
push edi
call fcn.004accd0
add eax, 0x40
push eax
call fcn.004acc3c
lea eax, [edi - 0x10]
add esp, 8
mov dword [esp + 0x4c], 0xffffffff
lea edx, [eax + 0xc]
or ecx, 0xffffffff
lock xadd dword [edx], ecx
dec ecx
test ecx, ecx
jg 0x404413
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
jmp 0x404413
mov eax, dword [esp + 0x24]
cmp eax, 1
jne 0x40429e
push str.Service_is_already_stopped._n
jmp 0x404402
cmp eax, 3
mov ebx, dword [sym.imp.KERNEL32.dll_Sleep]
jne 0x4042f3
lea esp, [esp]
mov ecx, dword [esp + 0x38]
push ecx
call ebx
lea edx, [esp + 0x18]
push edx
push 0x24
lea eax, [esp + 0x28]
push eax
push 0
push esi
call edi
test eax, eax
je 0x404366
cmp dword [esp + 0x24], 1
je 0x4043b1
call ebp
sub eax, dword [esp + 0x14]
cmp eax, 0x7530
ja 0x4043b8
cmp dword [esp + 0x24], 3
je 0x4042b0
mov eax, dword [esp + 0x1c]
push eax
mov ecx, esi
call fcn.00404450
add esp, 4
lea ecx, [esp + 0x20]
push ecx
push 1
push esi
call dword [sym.imp.ADVAPI32.dll_ControlService]
test eax, eax
jne 0x4043bf
lea ecx, [esp + 0x14]
call fcn.00410110
mov dword [esp + 0x4c], 4
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
lea edx, [esp + 0x18]
push str.ControlService_failed___d__n
push edx
call fcn.00410070
mov eax, dword [esp + 0x20]
add esp, 0xc
push eax
call fcn.004accd0
add eax, 0x40
push eax
call fcn.004acc3c
add esp, 8
lea ecx, [esp + 0x14]
call fcn.00410230
jmp 0x404413
lea ecx, [esp + 0x14]
call fcn.00410110
mov dword [esp + 0x4c], 3
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
lea ecx, [esp + 0x18]
push str.QueryServiceStatusEx_failed___d__n
push ecx
call fcn.00410070
mov edx, dword [esp + 0x20]
add esp, 0xc
push edx
call fcn.004accd0
add eax, 0x40
push eax
call fcn.004acc3c
add esp, 8
lea ecx, [esp + 0x14]
call fcn.00410230
jmp 0x404413
push str.Service_stopped_successfully._n
jmp 0x404402
push str.Service_stop_timed_out._n
jmp 0x404402
cmp dword [esp + 0x24], 1
je 0x4043fd
mov ecx, dword [esp + 0x38]
push ecx
call ebx
lea edx, [esp + 0x18]
push edx
push 0x24
lea eax, [esp + 0x28]
push eax
push 0
push esi
call edi
test eax, eax
je 0x404437
cmp dword [esp + 0x24], 1
je 0x4043fd
call ebp
sub eax, dword [esp + 0x14]
cmp eax, 0x7530
ja 0x404413
cmp dword [esp + 0x24], 1
jne 0x4043c6
push str.Service_stopped_successfully_n
call fcn.004accd0
add eax, 0x40
push eax
call fcn.004acc3c
add esp, 8
push esi
mov esi, dword [sym.imp.ADVAPI32.dll_CloseServiceHandle]
call esi
mov eax, dword [esp + 0x1c]
push eax
call esi
mov ecx, dword [esp + 0x44]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x3c
ret
lea ecx, [esp + 0x14]
call fcn.00410110
mov dword [esp + 0x4c], 5
jmp 0x404377