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

Disassembly:
sub esp, 0x30
push ebx
push ebp
push esi
mov esi, dword [sym.imp.KERNEL32.dll_GetTickCount]
call esi
mov dword [esp + 0x10], eax
mov eax, edi
call fcn.0040b6d0
test al, al
je 0x40b9e3
mov edx, dword [edi + 0xc]
mov ebp, dword [sym.imp.ADVAPI32.dll_QueryServiceStatusEx]
lea eax, [esp + 0xc]
push eax
push 0x24
lea ecx, [esp + 0x20]
push ecx
push 0
push edx
call ebp
test eax, eax
jne 0x40b9ec
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
sub esp, 0x1c
mov esi, esp
xor eax, eax
mov dword [esi + 0x18], 7
mov dword [esi + 0x14], 0
mov dword [esp + 0x30], esp
mov word [esi + 4], ax
push 0x21
mov eax, str.QueryServiceStatusEx_FAILED___d__n
call fcn.00409c70
call fcn.00409500
add esp, 0x20
xor al, al
pop esi
pop ebp
pop ebx
add esp, 0x30
ret
mov eax, dword [esp + 0x1c]
cmp eax, 1
jne 0x40ba19
sub esp, 0x1c
mov dword [esp + 0x2c], esp
mov eax, str.Service_is_already_stopped._n
mov ecx, esp
call fcn.004095a0
call fcn.00409500
add esp, 0x1c
xor al, al
pop esi
pop ebp
pop ebx
add esp, 0x30
ret
mov ebx, dword [sym.imp.KERNEL32.dll_Sleep]
cmp eax, 3
jne 0x40baa1
sub esp, 0x1c
mov esi, esp
mov dword [esp + 0x30], esp
xor ecx, ecx
mov dword [esi + 0x18], 7
mov dword [esi + 0x14], 0
push 0x18
mov eax, str.Service_stop_pending..._n
mov word [esi + 4], cx
call fcn.00409c70
call fcn.00409500
mov edx, dword [esp + 0x4c]
add esp, 0x1c
push edx
call ebx
mov edx, dword [edi + 0xc]
lea eax, [esp + 0xc]
push eax
push 0x24
lea ecx, [esp + 0x20]
push ecx
push 0
push edx
call ebp
test eax, eax
je 0x40bae7
cmp dword [esp + 0x1c], 1
je 0x40bb12
call dword [sym.imp.KERNEL32.dll_GetTickCount]
sub eax, dword [esp + 0x10]
cmp eax, 0x7530
ja 0x40bb23
cmp dword [esp + 0x1c], 3
je 0x40ba24
mov esi, dword [sym.imp.KERNEL32.dll_GetTickCount]
push edi
call fcn.0040bbe0
mov ecx, dword [edi + 0xc]
lea eax, [esp + 0x18]
push eax
push 1
push ecx
call dword [sym.imp.ADVAPI32.dll_ControlService]
test eax, eax
jne 0x40bb34
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
sub esp, 0x1c
mov eax, str.ControlService_FAILED___d__n
mov ecx, esp
mov dword [esp + 0x34], esp
call fcn.004095a0
call fcn.00409500
add esp, 0x20
xor al, al
pop esi
pop ebp
pop ebx
add esp, 0x30
ret
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
sub esp, 0x1c
mov eax, str.QueryServiceStatusEx_FAILED___d__n
mov ecx, esp
mov dword [esp + 0x34], esp
call fcn.004095a0
call fcn.00409500
add esp, 0x20
xor al, al
pop esi
pop ebp
pop ebx
add esp, 0x30
ret
sub esp, 0x1c
mov dword [esp + 0x30], esp
mov eax, str.Service_stopped_successfully._n
jmp 0x40ba01
sub esp, 0x1c
mov dword [esp + 0x30], esp
mov eax, str.Service_stop_timed_out._n
jmp 0x40ba01
cmp dword [esp + 0x1c], 1
je 0x40bb7a
jmp 0x40bb40
mov edx, dword [esp + 0x30]
push edx
call ebx
mov edx, dword [edi + 0xc]
lea eax, [esp + 0xc]
push eax
push 0x24
lea ecx, [esp + 0x20]
push ecx
push 0
push edx
call ebp
test eax, eax
je 0x40bb9e
cmp dword [esp + 0x1c], 1
je 0x40bb7a
call esi
sub eax, dword [esp + 0x10]
cmp eax, 0x7530
ja 0x40bbc9
cmp dword [esp + 0x1c], 1
jne 0x40bb40
sub esp, 0x1c
mov eax, str.Service_stopped_successfully_n
mov ecx, esp
mov dword [esp + 0x30], esp
call fcn.004095a0
call fcn.00409500
add esp, 0x1c
mov al, 1
pop esi
pop ebp
pop ebx
add esp, 0x30
ret
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
sub esp, 0x1c
mov eax, str.QueryServiceStatusEx_FAILED___d__n
mov ecx, esp
mov dword [esp + 0x34], esp
call fcn.004095a0
call fcn.00409500
add esp, 0x20
pop esi
pop ebp
xor al, al
pop ebx
add esp, 0x30
ret
sub esp, 0x1c
mov dword [esp + 0x30], esp
mov eax, str.Wait_timed_out_n
jmp 0x40ba01