Function at 0x408140
Capabilities:
Query service status
Start service

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x38
mov eax, dword [0x416008]
xor eax, ebp
mov dword [ebp - 8], eax
push ebx
mov ebx, dword [ebp + 8]
push esi
mov esi, ecx
push edi
mov dword [esi], 0x80070057
test ebx, ebx
je 0x408404
push 1
push 0
mov dword [esi], 0
push 0
mov dword [ebx], 0
call dword [sym.imp.ADVAPI32.dll_OpenSCManagerW]
mov edi, eax
mov dword [ebp - 0x24], edi
test edi, edi
je 0x4083e7
push 0x14
push str.TrustedInstaller
push edi
call dword [sym.imp.ADVAPI32.dll_OpenServiceW]
mov dword [ebp - 0x30], eax
test eax, eax
je 0x4083ae
lea ecx, [ebp - 0xc]
mov dword [ebp - 0xc], 0
push ecx
push 0x24
push ebx
push 0
push eax
mov dword [ebp - 0x34], 0
mov dword [ebp - 0x28], 0
mov dword [ebp - 0x2c], 0
mov byte [ebp - 0x1d], 0
call dword [sym.imp.ADVAPI32.dll_QueryServiceStatusEx]
test eax, eax
je 0x40838d
lea esp, [esp]
mov eax, dword [ebx + 4]
cmp eax, 1
jne 0x408216
cmp byte [ebp - 0x1d], 0
jne 0x40835a
push 0
push 0
push dword [ebp - 0x30]
call dword [sym.imp.ADVAPI32.dll_StartServiceW]
test eax, eax
je 0x4082f7
mov dword [esi], 0
mov byte [ebp - 0x1d], 1
jmp 0x4082b9
cmp eax, 3
je 0x408224
cmp eax, 2
jne 0x40838a
lea eax, [ebp - 0x1c]
push eax
call dword [sym.imp.KERNEL32.dll_QueryPerformanceFrequency]
test eax, eax
je 0x408261
lea eax, [ebp - 0x14]
push eax
call dword [sym.imp.KERNEL32.dll_QueryPerformanceCounter]
test eax, eax
je 0x408261
push 0
push 0x3e8
push dword [ebp - 0x10]
push dword [ebp - 0x14]
call fcn.00410200
push dword [ebp - 0x18]
push dword [ebp - 0x1c]
push edx
push eax
call fcn.00410150
jmp 0x408267
call dword [sym.imp.KERNEL32.dll_GetTickCount64]
mov ecx, eax
mov edi, edx
mov eax, dword [ebp - 0x28]
or eax, dword [ebp - 0x2c]
mov edx, dword [ebx + 0x14]
jne 0x40828d
push eax
push 0xfa
mov dword [ebp - 0x28], ecx
mov dword [ebp - 0x2c], edi
mov dword [ebp - 0x34], edx
call dword [sym.imp.KERNEL32.dll_SleepEx]
jmp 0x4082b9
cmp edx, dword [ebp - 0x34]
ja 0x4082ab
sub ecx, dword [ebp - 0x28]
sbb edi, dword [ebp - 0x2c]
test edi, edi
ja 0x408384
jb 0x4082ab
cmp ecx, dword [ebx + 0x18]
ja 0x408384
mov dword [ebp - 0x28], 0
mov dword [ebp - 0x2c], 0
lea eax, [ebp - 0xc]
push eax
push 0x24
push ebx
push 0
push dword [ebp - 0x30]
call dword [sym.imp.ADVAPI32.dll_QueryServiceStatusEx]
test eax, eax
jne 0x4081e0
push dword [ebp - 0x30]
mov edi, dword [ebp - 0x24]
mov ebx, dword [sym.imp.ADVAPI32.dll_CloseServiceHandle]
call ebx
push edi
call ebx
mov eax, esi
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 8]
xor ecx, ebp
call fcn.0040975a
mov esp, ebp
pop ebp
ret
call dword [sym.imp.KERNEL32.dll_GetLastError]
test eax, eax
jle 0x40830b
movzx eax, ax
or eax, 0x80070000
test eax, eax
mov edi, dword [ebp - 0x24]
jne 0x408337
push dword [ebp - 0x30]
mov ebx, dword [sym.imp.ADVAPI32.dll_CloseServiceHandle]
mov dword [esi], 0x8007065b
call ebx
push edi
call ebx
mov eax, esi
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 8]
xor ecx, ebp
call fcn.0040975a
mov esp, ebp
pop ebp
ret
push dword [ebp - 0x30]
mov ebx, dword [sym.imp.ADVAPI32.dll_CloseServiceHandle]
mov dword [esi], eax
call ebx
push edi
call ebx
mov eax, esi
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 8]
xor ecx, ebp
call fcn.0040975a
mov esp, ebp
pop ebp
ret
push dword [ebp - 0x30]
mov edi, dword [ebp - 0x24]
mov ebx, dword [sym.imp.ADVAPI32.dll_CloseServiceHandle]
mov dword [esi], 1
call ebx
push edi
call ebx
mov eax, esi
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 8]
xor ecx, ebp
call fcn.0040975a
mov esp, ebp
pop ebp
ret
mov dword [esi], 0x800705b4
mov edi, dword [ebp - 0x24]
push dword [ebp - 0x30]
mov ebx, dword [sym.imp.ADVAPI32.dll_CloseServiceHandle]
call ebx
push edi
call ebx
mov eax, esi
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 8]
xor ecx, ebp
call fcn.0040975a
mov esp, ebp
pop ebp
ret
call dword [sym.imp.KERNEL32.dll_GetLastError]
test eax, eax
jle 0x4083c2
movzx eax, ax
or eax, 0x80070000
test eax, eax
jne 0x4083c9
mov eax, 0x8007065b
mov ebx, dword [sym.imp.ADVAPI32.dll_CloseServiceHandle]
push edi
mov dword [esi], eax
call ebx
mov eax, esi
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 8]
xor ecx, ebp
call fcn.0040975a
mov esp, ebp
pop ebp
ret
call dword [sym.imp.KERNEL32.dll_GetLastError]
test eax, eax
jle 0x4083fb
movzx eax, ax
or eax, 0x80070000
test eax, eax
jne 0x408402
mov eax, 0x8007065b
mov dword [esi], eax
mov ecx, dword [ebp - 8]
mov eax, esi
pop edi
pop esi
xor ecx, ebp
pop ebx
call fcn.0040975a
mov esp, ebp
pop ebp
ret