Function at 0x140005900
Capabilities:
Create service
Persist via windows service
Start service

Disassembly:
push rbp
push rbx
push rsi
push rdi
push r15
lea rbp, [rsp - 0x200]
sub rsp, 0x300
mov rax, qword [0x140036008]
xor rax, rsp
mov qword [rbp + 0x1f0], rax
mov rdi, r8
mov r15, rdx
mov rsi, rcx
xor edx, edx
mov r8d, 0x208
lea rcx, [rbp - 0x20]
call fcn.1400075a0
xor r9d, r9d
lea r8, [rbp - 0x20]
mov edx, 0x104
mov rcx, rdi
call qword [sym.imp.KERNEL32.dll_GetFullPathNameW]
test eax, eax
jne 0x14000597a
call qword [sym.imp.KERNEL32.dll_GetLastError]
mov r8, rdi
lea rcx, str.___Error_0x_lx_converting__s_path_to_absolute_..._n
mov edx, eax
mov ebx, eax
call fcn.140001010
mov eax, ebx
jmp 0x140005c6a
mov r8d, 3
mov qword [rsp + 0x348], r14
lea rdx, str.ServicesActive
xor ecx, ecx
call qword [sym.imp.ADVAPI32.dll_OpenSCManagerW]
mov r14, rax
test rax, rax
je 0x140005c48
mov r8d, 0x10
mov rdx, rsi
mov rcx, rax
call qword [sym.imp.ADVAPI32.dll_OpenServiceW]
mov rdi, rax
test rax, rax
je 0x1400059d1
mov rdx, rsi
lea rcx, str.____s_service_already_registered_n
call fcn.140001010
jmp 0x140005bbc
call qword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 0x424
jne 0x140005c27
mov rdx, rsi
lea rcx, str.____s_service_was_not_present_n
call fcn.140001010
xor ebx, ebx
lea rax, [rbp - 0x20]
mov qword [rsp + 0x60], rbx
mov r9d, 0x60010
mov qword [rsp + 0x58], rbx
mov r8, r15
mov qword [rsp + 0x50], rbx
mov rdx, rsi
mov qword [rsp + 0x48], rbx
mov rcx, r14
mov qword [rsp + 0x40], rbx
mov qword [rsp + 0x38], rax
mov dword [rsp + 0x30], 1
mov dword [rsp + 0x28], 2
mov dword [rsp + 0x20], 1
call qword [sym.imp.ADVAPI32.dll_CreateServiceW]
mov rdi, rax
test rax, rax
je 0x140005c18
mov rdx, rsi
lea rcx, str.____s_service_is_successfully_registered_n
call fcn.140001010
lea rax, [rsp + 0x70]
mov dword [rbp - 0x50], ebx
xor r9d, r9d
mov qword [rsp + 0x20], rax
lea r8, [rbp - 0x48]
mov word [rbp - 0x4c], 0x100
lea edx, [rbx + 4]
mov dword [rbp - 0x80], 0x201fd
mov rcx, rdi
mov qword [rbp - 0x7c], 2
mov qword [rbp - 0x70], rbx
mov qword [rbp - 0x68], rbx
mov dword [rbp - 0x60], 5
mov qword [rbp - 0x58], rbx
call qword [sym.imp.ADVAPI32.dll_QueryServiceObjectSecurity]
test eax, eax
jne 0x140005bb0
call qword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 0x7a
jne 0x140005bb0
mov edx, dword [rsp + 0x70]
lea ecx, [rbx + 0x40]
call qword [sym.imp.KERNEL32.dll_LocalAlloc]
mov r15, rax
test rax, rax
je 0x140005bb0
mov r9d, dword [rsp + 0x70]
lea rax, [rsp + 0x70]
mov r8, r15
mov qword [rsp + 0x20], rax
lea edx, [rbx + 4]
mov rcx, rdi
call qword [sym.imp.ADVAPI32.dll_QueryServiceObjectSecurity]
test eax, eax
je 0x140005b92
lea rax, [rbp - 0x58]
xor r9d, r9d
mov qword [rsp + 0x50], rax
lea rcx, [rbp - 0x50]
mov dword [rsp + 0x48], ebx
xor r8d, r8d
mov dword [rsp + 0x40], ebx
mov dl, 1
mov dword [rsp + 0x38], ebx
mov dword [rsp + 0x30], ebx
mov dword [rsp + 0x28], ebx
mov dword [rsp + 0x20], ebx
call qword [sym.imp.ADVAPI32.dll_AllocateAndInitializeSid]
test eax, eax
je 0x140005b92
lea rax, [rsp + 0x78]
xor edx, edx
mov qword [rsp + 0x40], rax
lea r9, [rbp - 0x80]
lea rax, [rsp + 0x70]
xor ecx, ecx
mov qword [rsp + 0x38], rax
lea r8d, [rbx + 1]
mov qword [rsp + 0x30], r15
mov qword [rsp + 0x28], rbx
mov dword [rsp + 0x20], ebx
call qword [sym.imp.ADVAPI32.dll_BuildSecurityDescriptorW]
test eax, eax
jne 0x140005b88
mov r8, qword [rsp + 0x78]
lea edx, [rbx + 4]
mov rcx, rdi
call qword [sym.imp.ADVAPI32.dll_SetServiceObjectSecurity]
mov rcx, qword [rsp + 0x78]
mov ebx, eax
call qword [sym.imp.KERNEL32.dll_LocalFree]
mov rcx, qword [rbp - 0x58]
call qword [sym.imp.ADVAPI32.dll_FreeSid]
mov rcx, r15
call qword [sym.imp.KERNEL32.dll_LocalFree]
test ebx, ebx
je 0x140005bb0
mov rdx, rsi
lea rcx, str.____s_service_ACL_configured_to_for_Everyone_n
call fcn.140001010
jmp 0x140005bbc
lea rcx, str.____ServiceAddEveryoneAccess
call fcn.14000bd98
xor r8d, r8d
xor edx, edx
mov rcx, rdi
call qword [sym.imp.ADVAPI32.dll_StartServiceW]
test eax, eax
je 0x140005bd7
lea rcx, str.____s_service_started_n
jmp 0x140005beb
call qword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 0x420
jne 0x140005c09
lea rcx, str.____s_service_already_started_n
mov rdx, rsi
call fcn.140001010
mov rcx, rdi
call qword [sym.imp.ADVAPI32.dll_CloseServiceHandle]
mov rcx, r14
call qword [sym.imp.ADVAPI32.dll_CloseServiceHandle]
xor eax, eax
jmp 0x140005c62
call qword [sym.imp.KERNEL32.dll_GetLastError]
lea rcx, str.____ERROR_ServiceInstall___StartService__0x_08x__n
jmp 0x140005c55
call qword [sym.imp.KERNEL32.dll_GetLastError]
lea rcx, str.____ERROR_ServiceInstall___CreateService__0x_08x__n
jmp 0x140005c34
call qword [sym.imp.KERNEL32.dll_GetLastError]
lea rcx, str.____ERROR_ServiceInstall___OpenService__0x_08x__n
mov edx, eax
call fcn.140001010
mov rcx, r14
call qword [sym.imp.ADVAPI32.dll_CloseServiceHandle]
xor eax, eax
jmp 0x140005c62
call qword [sym.imp.KERNEL32.dll_GetLastError]
lea rcx, str.____ERROR_ServiceInstall___OpenSCManager_create___0x_08x__n
mov edx, eax
call fcn.140001010
call qword [sym.imp.KERNEL32.dll_GetLastError]
mov r14, qword [rsp + 0x348]
mov rcx, qword [rbp + 0x1f0]
xor rcx, rsp
call fcn.140006640
add rsp, 0x300
pop r15
pop rdi
pop rsi
pop rbx
pop rbp
ret