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

Disassembly:
push 0xffffffffffffffff
push 0x4d4bf0
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
push 0xf003f
push 0
push 0
call dword [sym.imp.ADVAPI32.dll_OpenSCManagerW]
mov ebx, eax
test ebx, ebx
mov dword [esp + 0x18], ebx
jne 0x403ab7
call fcn.004a08e6
xor ecx, ecx
test eax, eax
setne cl
test ecx, ecx
jne 0x403a2e
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 + 0x18], eax
mov dword [esp + 0x4c], 0
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push 0x51b9b8
lea ecx, [esp + 0x20]
push str._s_:_OpenSCManager_failed___d__n
push ecx
call fcn.00410070
mov esi, dword [esp + 0x28]
add esp, 0x10
push esi
call fcn.004accd0
add eax, 0x40
push eax
call fcn.004acc3c
lea eax, [esi - 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 0x403a9e
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
mov eax, 1
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 0xf01ff
push 0x51b9b8
push ebx
call dword [sym.imp.ADVAPI32.dll_OpenServiceW]
mov esi, eax
test esi, esi
jne 0x403b77
call fcn.004a08e6
xor ecx, ecx
test eax, eax
setne cl
test ecx, ecx
jne 0x403aec
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 + 0x18], eax
mov dword [esp + 0x4c], 1
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
lea ecx, [esp + 0x1c]
push str.OpenService_failed___d__n
push ecx
call fcn.00410070
mov esi, dword [esp + 0x24]
add esp, 0xc
push esi
call fcn.004accd0
add eax, 0x40
push eax
call fcn.004acc3c
add esp, 8
push ebx
call dword [sym.imp.ADVAPI32.dll_CloseServiceHandle]
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 0x403b5e
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
mov eax, 2
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 + 0x1c]
push ecx
push 0x24
lea edx, [esp + 0x28]
push edx
push 0
push esi
call dword [sym.imp.ADVAPI32.dll_QueryServiceStatusEx]
test eax, eax
jne 0x403c3e
call fcn.004a08e6
xor ecx, ecx
test eax, eax
setne cl
test ecx, ecx
jne 0x403bae
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 + 0x18], eax
mov dword [esp + 0x4c], 2
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
lea ecx, [esp + 0x1c]
push str.QueryServiceStatusEx_failed___d__n
push ecx
call fcn.00410070
mov edi, dword [esp + 0x24]
add esp, 0xc
push edi
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
push ebx
call esi
lea eax, [edi - 0x10]
mov dword [esp + 0x4c], 0xffffffff
lea edx, [eax + 0xc]
or ecx, 0xffffffff
lock xadd dword [edx], ecx
dec ecx
test ecx, ecx
jg 0x403c25
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
mov eax, 3
mov ecx, dword [esp + 0x44]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x3c
ret
mov eax, dword [esp + 0x24]
cmp eax, 1
mov ebp, dword [sym.imp.KERNEL32.dll_GetTickCount]
je 0x403d08
cmp eax, 3
je 0x403c91
push str.Cannot_start_the_service_because_it_is_already_running_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
push ebx
call esi
mov eax, 4
mov ecx, dword [esp + 0x44]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x3c
ret
call ebp
mov ebx, dword [esp + 0x34]
mov edi, eax
mov eax, 0xcccccccd
mul dword [esp + 0x38]
shr edx, 3
cmp edx, 0x3e8
jae 0x403cb4
mov edx, 0x3e8
jmp 0x403cc1
cmp edx, 0x2710
jbe 0x403cc1
mov edx, 0x2710
push edx
call dword [sym.imp.KERNEL32.dll_Sleep]
lea ecx, [esp + 0x1c]
push ecx
push 0x24
lea edx, [esp + 0x28]
push edx
push 0
push esi
call dword [sym.imp.ADVAPI32.dll_QueryServiceStatusEx]
test eax, eax
je 0x403d89
cmp dword [esp + 0x34], ebx
jbe 0x403cef
call ebp
jmp 0x403cfd
call ebp
sub eax, edi
cmp eax, dword [esp + 0x38]
ja 0x403dfb
cmp dword [esp + 0x24], 3
je 0x403c91
mov ebx, dword [esp + 0x18]
push 0
push 0
push esi
call dword [sym.imp.ADVAPI32.dll_StartServiceW]
test eax, eax
jne 0x403e3a
lea ecx, [esp + 0x18]
call fcn.00410110
mov dword [esp + 0x4c], 4
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
lea ecx, [esp + 0x1c]
push str.StartService_failed___d__n
push ecx
call fcn.00410070
mov edx, dword [esp + 0x24]
add esp, 0xc
push edx
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
push ebx
call esi
lea ecx, [esp + 0x18]
call fcn.00410230
mov eax, 7
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], 3
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
lea eax, [esp + 0x18]
push str.QueryServiceStatusEx_failed___d__n
push eax
call fcn.00410070
mov ecx, dword [esp + 0x20]
add esp, 0xc
push ecx
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 edx, dword [esp + 0x18]
push edx
call esi
lea ecx, [esp + 0x14]
call fcn.00410230
mov eax, 5
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 str.Timeout_waiting_for_service_to_stop_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 + 0x18]
push eax
call esi
mov eax, 6
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 str.Service_start_pending..._n
call fcn.004accd0
add eax, 0x40
push eax
call fcn.004acc3c
add esp, 8
lea eax, [esp + 0x1c]
push eax
push 0x24
lea ecx, [esp + 0x28]
push ecx
push 0
push esi
call dword [sym.imp.ADVAPI32.dll_QueryServiceStatusEx]
test eax, eax
jne 0x403ed7
lea ecx, [esp + 0x18]
call fcn.00410110
mov dword [esp + 0x4c], 5
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
lea edx, [esp + 0x1c]
push str.QueryServiceStatusEx_failed___d__n
push edx
call fcn.00410070
mov eax, dword [esp + 0x24]
add esp, 0xc
push eax
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
push ebx
call esi
lea ecx, [esp + 0x18]
call fcn.00410230
mov eax, 8
mov ecx, dword [esp + 0x44]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x3c
ret
call ebp
cmp dword [esp + 0x24], 2
mov ecx, dword [esp + 0x34]
mov edi, eax
mov dword [esp + 0x18], ecx
jne 0x403fb4
mov edi, edi
mov eax, 0xcccccccd
mul dword [esp + 0x38]
shr edx, 3
cmp edx, 0x3e8
jae 0x403f0b
mov edx, 0x3e8
jmp 0x403f18
cmp edx, 0x2710
jbe 0x403f18
mov edx, 0x2710
push edx
call dword [sym.imp.KERNEL32.dll_Sleep]
lea edx, [esp + 0x1c]
push edx
push 0x24
lea eax, [esp + 0x28]
push eax
push 0
push esi
call dword [sym.imp.ADVAPI32.dll_QueryServiceStatusEx]
test eax, eax
je 0x403f63
mov ecx, dword [esp + 0x18]
cmp dword [esp + 0x34], ecx
jbe 0x403f50
call ebp
mov edx, dword [esp + 0x34]
mov edi, eax
mov dword [esp + 0x18], edx
jmp 0x403f5a
call ebp
sub eax, edi
cmp eax, dword [esp + 0x38]
ja 0x403fb4
cmp dword [esp + 0x24], 2
je 0x403ef0
jmp 0x403fb4
lea ecx, [esp + 0x18]
call fcn.00410110
mov dword [esp + 0x4c], 6
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
lea eax, [esp + 0x1c]
push str.QueryServiceStatusEx_failed___d__n
push eax
call fcn.00410070
mov ecx, dword [esp + 0x24]
add esp, 0xc
push ecx
call fcn.004accd0
add eax, 0x40
push eax
call fcn.004acc3c
add esp, 8
lea ecx, [esp + 0x18]
mov dword [esp + 0x4c], 0xffffffff
call fcn.00410230
cmp dword [esp + 0x24], 4
jne 0x403fe7
push str.Service_started_successfully._n
call fcn.004accd0
add eax, 0x40
push eax
call fcn.004acc3c
add esp, 8
xor eax, 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
lea ecx, [esp + 0x18]
call fcn.00410110
push str.Service_not_started.__n
mov dword [esp + 0x50], 7
call fcn.004accd0
add eax, 0x40
push eax
call fcn.004acc3c
mov edx, dword [esp + 0x34]
mov eax, dword [esp + 0x2c]
push edx
push eax
lea ecx, [esp + 0x28]
push str.Current_State:__d__Exit_Code:__d
push ecx
call fcn.00410070
mov edx, dword [esp + 0x30]
add esp, 0x18
push edx
call fcn.004accd0
add eax, 0x40
push eax
call fcn.004acc3c
add esp, 8
lea ecx, [esp + 0x18]
call fcn.00410230
push esi
mov esi, dword [sym.imp.ADVAPI32.dll_CloseServiceHandle]
call esi
push ebx
call esi
mov eax, 0xb
mov ecx, dword [esp + 0x44]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x3c
ret