Function at 0x40d8f0
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.0040d640
test al, al
je 0x40d963
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 0x40d96c
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.00403820
call fcn.00406dd0
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 0x40d999
sub esp, 0x1c
mov dword [esp + 0x2c], esp
mov eax, str.Service_is_already_stopped._n
mov ecx, esp
call fcn.00403580
call fcn.00406dd0
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 0x40da21
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.00403820
call fcn.00406dd0
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 0x40da67
cmp dword [esp + 0x1c], 1
je 0x40da92
call dword [sym.imp.KERNEL32.dll_GetTickCount]
sub eax, dword [esp + 0x10]
cmp eax, 0x7530
ja 0x40daa3
cmp dword [esp + 0x1c], 3
je 0x40d9a4
mov esi, dword [sym.imp.KERNEL32.dll_GetTickCount]
push edi
call fcn.0040db60
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 0x40dab4
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.00403580
call fcn.00406dd0
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.00403580
call fcn.00406dd0
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 0x40d981
sub esp, 0x1c
mov dword [esp + 0x30], esp
mov eax, str.Service_stop_timed_out._n
jmp 0x40d981
cmp dword [esp + 0x1c], 1
je 0x40dafa
jmp 0x40dac0
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 0x40db1e
cmp dword [esp + 0x1c], 1
je 0x40dafa
call esi
sub eax, dword [esp + 0x10]
cmp eax, 0x7530
ja 0x40db49
cmp dword [esp + 0x1c], 1
jne 0x40dac0
sub esp, 0x1c
mov eax, str.Service_stopped_successfully_n
mov ecx, esp
mov dword [esp + 0x30], esp
call fcn.00403580
call fcn.00406dd0
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.00403580
call fcn.00406dd0
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 0x40d981