Function at 0x40f810
Capabilities:
Check for time delay via gettickcount
Query service status
Resolve function by parsing pe exports
Start service

Disassembly:
push 0xffffffffffffffff
push 0x4466d8
mov eax, dword fs:[0]
push eax
sub esp, 0x54
push ebx
push ebp
push esi
push edi
mov eax, dword [0x4630d0]
xor eax, esp
push eax
lea eax, [esp + 0x68]
mov dword fs:[0], eax
push 0xf003f
push 0
push 0
mov dword [esp + 0x7c], 0
call dword [sym.imp.ADVAPI32.dll_OpenSCManagerW]
mov edi, eax
test edi, edi
mov dword [esp + 0x14], edi
jne 0x40f8cf
call dword [sym.imp.KERNEL32.dll_GetLastError]
push str.OpenSCManager_failed_with_error
lea ecx, [esp + 0x28]
mov dword [esp + 0x18], eax
call fcn.004010e0
lea ecx, [esp + 0x14]
push ecx
lea edx, [esp + 0x20]
mov ebx, 1
push edx
mov ecx, eax
mov byte [esp + 0x78], bl
call fcn.00403070
lea ecx, [esp + 0x1c]
mov byte [esp + 0x70], bl
call fcn.0040fd60
lea ecx, [esp + 0x24]
mov byte [esp + 0x70], 0
call fcn.0040fd60
lea ecx, [esp + 0x78]
mov dword [esp + 0x70], 0xffffffff
call fcn.0040fd60
mov eax, 0x64
mov ecx, dword [esp + 0x68]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x60
ret
mov eax, dword [esp + 0x7c]
mov ebx, 1
cmp dword [eax - 4], ebx
jle 0x40f8f1
mov eax, dword [eax - 0xc]
push eax
lea ecx, [esp + 0x80]
call fcn.00401bf0
mov eax, dword [esp + 0x7c]
push 0xf01ff
push eax
push edi
call dword [sym.imp.ADVAPI32.dll_OpenServiceW]
mov esi, eax
test esi, esi
jne 0x40f95a
call dword [sym.imp.KERNEL32.dll_GetLastError]
push str.OpenService_failed_with_error
lea ecx, [esp + 0x20]
mov dword [esp + 0x18], eax
call fcn.004010e0
lea ecx, [esp + 0x14]
push ecx
lea edx, [esp + 0x28]
push edx
mov ecx, eax
mov byte [esp + 0x78], 3
call fcn.00403070
lea ecx, [esp + 0x24]
mov byte [esp + 0x70], 3
call fcn.0040fd60
lea ecx, [esp + 0x1c]
mov byte [esp + 0x70], 0
call fcn.0040fd60
push edi
call dword [sym.imp.ADVAPI32.dll_CloseServiceHandle]
jmp 0x40f8a5
lea eax, [esp + 0x18]
push eax
push 0x24
lea ecx, [esp + 0x4c]
push ecx
push 0
push esi
call dword [sym.imp.ADVAPI32.dll_QueryServiceStatusEx]
test eax, eax
jne 0x40f9ce
call dword [sym.imp.KERNEL32.dll_GetLastError]
push str.QueryServiceStatusEx_failed_with_error
lea ecx, [esp + 0x20]
mov dword [esp + 0x18], eax
call fcn.004010e0
lea edx, [esp + 0x14]
push edx
lea ecx, [esp + 0x28]
push ecx
mov bl, 5
mov ecx, eax
mov byte [esp + 0x78], bl
call fcn.00403070
lea ecx, [esp + 0x24]
mov byte [esp + 0x70], bl
call fcn.0040fd60
lea ecx, [esp + 0x1c]
mov byte [esp + 0x70], 0
call fcn.0040fd60
push esi
mov esi, dword [sym.imp.ADVAPI32.dll_CloseServiceHandle]
call esi
push edi
call esi
jmp 0x40f8a5
mov eax, dword [esp + 0x48]
cmp eax, ebx
mov ebp, dword [sym.imp.KERNEL32.dll_GetTickCount]
je 0x40fa73
cmp eax, 3
je 0x40fa00
push str.Cannot_start_the_service_because_it_is_already_running
lea ecx, [esp + 0x28]
call fcn.004010e0
lea ecx, [esp + 0x24]
jmp 0x40f9b3
call ebp
mov ebx, dword [esp + 0x58]
mov edi, eax
mov eax, 0xcccccccd
mul dword [esp + 0x5c]
shr edx, 3
cmp edx, 0x3e8
jae 0x40fa23
mov edx, 0x3e8
jmp 0x40fa30
cmp edx, 0x2710
jbe 0x40fa30
mov edx, 0x2710
push edx
call dword [sym.imp.KERNEL32.dll_Sleep]
lea edx, [esp + 0x18]
push edx
push 0x24
lea eax, [esp + 0x4c]
push eax
push 0
push esi
call dword [sym.imp.ADVAPI32.dll_QueryServiceStatusEx]
test eax, eax
je 0x40facb
cmp dword [esp + 0x58], ebx
jbe 0x40fa5a
call ebp
jmp 0x40fa68
call ebp
sub eax, edi
cmp eax, dword [esp + 0x5c]
ja 0x40fb2a
cmp dword [esp + 0x48], 3
je 0x40fa00
mov edi, dword [esp + 0x14]
push 0
push 0
push esi
call dword [sym.imp.ADVAPI32.dll_StartServiceW]
test eax, eax
jne 0x40fb5b
call dword [sym.imp.KERNEL32.dll_GetLastError]
push str.StartService_failed_with_error
lea ecx, [esp + 0x28]
mov dword [esp + 0x20], eax
call fcn.004010e0
lea edx, [esp + 0x1c]
push edx
lea ecx, [esp + 0x30]
push ecx
mov bl, 0xb
mov ecx, eax
mov byte [esp + 0x78], bl
call fcn.00403070
lea ecx, [esp + 0x2c]
mov byte [esp + 0x70], bl
call fcn.0040fd60
lea ecx, [esp + 0x24]
jmp 0x40f9b3
call dword [sym.imp.KERNEL32.dll_GetLastError]
push str.QueryServiceStatusEx_failed_with_error
lea ecx, [esp + 0x30]
mov dword [esp + 0x20], eax
call fcn.004010e0
lea ecx, [esp + 0x1c]
push ecx
lea edx, [esp + 0x28]
mov bl, 8
push edx
mov ecx, eax
mov byte [esp + 0x78], bl
call fcn.00403070
lea ecx, [esp + 0x24]
mov byte [esp + 0x70], bl
call fcn.0040fd60
lea ecx, [esp + 0x2c]
mov byte [esp + 0x70], 0
call fcn.0040fd60
push esi
mov esi, dword [sym.imp.ADVAPI32.dll_CloseServiceHandle]
call esi
mov eax, dword [esp + 0x14]
push eax
call esi
jmp 0x40f8a5
push str.Timeout_waiting_for_service_to_stop
lea ecx, [esp + 0x30]
call fcn.004010e0
lea ecx, [esp + 0x2c]
mov byte [esp + 0x70], 0
call fcn.0040fd60
push esi
mov esi, dword [sym.imp.ADVAPI32.dll_CloseServiceHandle]
call esi
mov ecx, dword [esp + 0x14]
push ecx
call esi
jmp 0x40f8a5
cmp dword [esp + 0x80], 0
je 0x40fc63
lea edx, [esp + 0x18]
push edx
push 0x24
lea eax, [esp + 0x4c]
push eax
push 0
push esi
call dword [sym.imp.ADVAPI32.dll_QueryServiceStatusEx]
test eax, eax
jne 0x40fbc7
call dword [sym.imp.KERNEL32.dll_GetLastError]
push 0x44b758
lea ecx, [esp + 0x40]
mov dword [esp + 0x20], eax
call fcn.004010e0
lea ecx, [esp + 0x1c]
push ecx
lea edx, [esp + 0x38]
mov bl, 0xd
push edx
mov ecx, eax
mov byte [esp + 0x78], bl
call fcn.00403070
lea ecx, [esp + 0x34]
mov byte [esp + 0x70], bl
call fcn.0040fd60
lea ecx, [esp + 0x3c]
jmp 0x40f9b3
call ebp
cmp dword [esp + 0x48], 2
mov ebx, dword [esp + 0x58]
mov edi, eax
jne 0x40fc5f
lea ebx, [ebx]
mov eax, 0xcccccccd
mul dword [esp + 0x5c]
shr edx, 3
cmp edx, 0x3e8
jae 0x40fbfb
mov edx, 0x3e8
jmp 0x40fc08
cmp edx, 0x2710
jbe 0x40fc08
mov edx, 0x2710
push edx
call dword [sym.imp.KERNEL32.dll_Sleep]
lea eax, [esp + 0x18]
push eax
push 0x24
lea ecx, [esp + 0x4c]
push ecx
push 0
push esi
call dword [sym.imp.ADVAPI32.dll_QueryServiceStatusEx]
test eax, eax
je 0x40fc4b
cmp dword [esp + 0x58], ebx
jbe 0x40fc38
call ebp
mov ebx, dword [esp + 0x58]
mov edi, eax
jmp 0x40fc42
call ebp
sub eax, edi
cmp eax, dword [esp + 0x5c]
ja 0x40fc5f
cmp dword [esp + 0x48], 2
je 0x40fbe0
jmp 0x40fc5f
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.QueryServiceStatusEx_failed___d__n
call fcn.00431b6c
add esp, 8
mov edi, dword [esp + 0x14]
push esi
mov esi, dword [sym.imp.ADVAPI32.dll_CloseServiceHandle]
call esi
push edi
call esi
lea ecx, [esp + 0x78]
mov dword [esp + 0x70], 0xffffffff
call fcn.0040fd60
xor eax, eax
mov ecx, dword [esp + 0x68]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x60
ret