Function at 0x40cd80
Capabilities:
Modify service
Query service status
Start service

Disassembly:
push ebp
mov ebp, esp
push 0xffffffffffffffff
push 0x4461f0
mov eax, dword fs:[0]
push eax
sub esp, 0x9c
mov eax, dword [0x45c3a4]
xor eax, ebp
mov dword [ebp - 0x14], eax
push ebx
push esi
push edi
push eax
lea eax, [ebp - 0xc]
mov dword fs:[0], eax
mov dword [ebp - 0x10], esp
push 0xf003f
push 0
push 0
mov dword [ebp - 0x40], 0
mov dword [ebp - 0x3c], 0
mov dword [ebp - 4], 0
call dword [sym.imp.ADVAPI32.dll_OpenSCManagerW]
mov edi, eax
mov dword [ebp - 0x44], edi
test edi, edi
jne 0x40ce0f
lea eax, [ebp - 0x38]
push eax
lea ecx, [ebp - 0xa8]
mov dword [ebp - 0x38], str.OpenSCManager
call fcn.0041bb11
push 0x4589e8
lea eax, [ebp - 0xa8]
push eax
mov dword [ebp - 0xa8], vtable.std::runtime_error.0
call fcn.0041de2b
push 0xf01ff
push str.TermService
push edi
call dword [sym.imp.ADVAPI32.dll_OpenServiceW]
mov esi, eax
mov dword [ebp - 0x40], esi
test esi, esi
jne 0x40ce51
lea eax, [ebp - 0x38]
push eax
lea ecx, [ebp - 0x50]
mov dword [ebp - 0x38], str.OpenService
call fcn.0041bb11
push 0x4589e8
lea eax, [ebp - 0x50]
push eax
mov dword [ebp - 0x50], vtable.std::runtime_error.0
call fcn.0041de2b
lea eax, [ebp - 0x18]
push eax
push 0
push 0
push esi
mov dword [ebp - 0x18], 0
call dword [sym.imp.ADVAPI32.dll_QueryServiceConfigW]
test eax, eax
jne 0x40cffe
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 0x7a
je 0x40cea2
lea eax, [ebp - 0x38]
push eax
lea ecx, [ebp - 0x74]
mov dword [ebp - 0x38], str.QueryServiceConfig___1
call fcn.0041bb11
push 0x4589e8
lea eax, [ebp - 0x74]
push eax
mov dword [ebp - 0x74], vtable.std::runtime_error.0
call fcn.0041de2b
mov eax, dword [ebp - 0x18]
push eax
mov dword [ebp - 0x38], eax
mov dword [ebp - 0x18], 0
call fcn.0041b051
add esp, 4
mov ebx, eax
lea eax, [ebp - 0x18]
push eax
push dword [ebp - 0x38]
mov dword [ebp - 0x3c], ebx
push ebx
push esi
call dword [sym.imp.ADVAPI32.dll_QueryServiceConfigW]
test eax, eax
jne 0x40cf01
lea eax, [ebp - 0x38]
push eax
lea ecx, [ebp - 0x9c]
mov dword [ebp - 0x38], str.QueryServiceConfig___2
call fcn.0041bb11
push 0x4589e8
lea eax, [ebp - 0x9c]
push eax
mov dword [ebp - 0x9c], vtable.std::runtime_error.0
call fcn.0041de2b
test ebx, ebx
je 0x40cffe
cmp dword [ebx + 4], 4
jne 0x40cf6d
push 0
push 0
push 0
push 0
push 0
push 0
push 0
push 0xffffffffffffffff
push 3
push 0xffffffffffffffff
push esi
call dword [sym.imp.ADVAPI32.dll_ChangeServiceConfigW]
test eax, eax
jne 0x40cf56
lea eax, [ebp - 0x38]
push eax
lea ecx, [ebp - 0x5c]
mov dword [ebp - 0x38], str.ChangeServiceConfig
call fcn.0041bb11
push 0x4589e8
lea eax, [ebp - 0x5c]
push eax
mov dword [ebp - 0x5c], vtable.std::runtime_error.0
call fcn.0041de2b
push str.CSessionMonitor::RecoverTerminalService
push str.Terminal_Service_enabled
push 0x462e98
call fcn.00402460
add esp, 0xc
lea eax, [ebp - 0x34]
push eax
push esi
call dword [sym.imp.ADVAPI32.dll_QueryServiceStatus]
test eax, eax
jne 0x40cfa4
lea eax, [ebp - 0x38]
push eax
lea ecx, [ebp - 0x68]
mov dword [ebp - 0x38], 0x452624
call fcn.0041bb11
push 0x4589e8
lea eax, [ebp - 0x68]
push eax
mov dword [ebp - 0x68], vtable.std::runtime_error.0
call fcn.0041de2b
cmp dword [ebp - 0x30], 4
je 0x40d068
push 0
push 0
push esi
call dword [sym.imp.ADVAPI32.dll_StartServiceW]
test eax, eax
jne 0x40cfe5
lea eax, [ebp - 0x38]
push eax
lea ecx, [ebp - 0x80]
mov dword [ebp - 0x38], str.StartService
call fcn.0041bb11
push 0x4589e8
lea eax, [ebp - 0x80]
push eax
mov dword [ebp - 0x80], vtable.std::runtime_error.0
call fcn.0041de2b
push str.CSessionMonitor::RecoverTerminalService
push str.Terminal_Service_started
push 0x462e98
call fcn.00402460
add esp, 0xc
jmp 0x40d068
lea eax, [ebp - 0x38]
push eax
lea ecx, [ebp - 0x90]
mov dword [ebp - 0x38], str.QueryServiceConfig___3
call fcn.0041bb11
push 0x4589e8
lea eax, [ebp - 0x90]
push eax
mov dword [ebp - 0x90], vtable.std::runtime_error.0
call fcn.0041de2b
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov ecx, dword [ebp - 0x84]
push eax
mov eax, dword [ecx]
call dword [eax + 4]
push eax
push str.CSessionMonitor::RecoverTerminalService
push str.Error:___s__LastError__0x_08X_
push 0x462e98
call fcn.00402460
add esp, 0x14
mov eax, 0x40d05f
ret
test ebx, ebx
je 0x40d075
push ebx
call fcn.0041cd4d
add esp, 4
test esi, esi
je 0x40d084
push esi
mov esi, dword [sym.imp.ADVAPI32.dll_CloseServiceHandle]
call esi
jmp 0x40d08a
mov esi, dword [sym.imp.ADVAPI32.dll_CloseServiceHandle]
test edi, edi
je 0x40d091
push edi
call esi
mov al, 1
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 0x14]
xor ecx, ebp
call fcn.0041b8d4
mov esp, ebp
pop ebp
ret