Function at 0x427970
Capabilities:
Check os version
Create service
Delete registry key
Delete service
Modify service
Persist via windows service
Set registry value

Disassembly:
push r15
push r14
push r13
push r12
push rbp
push rdi
push rsi
push rbx
sub rsp, 0x338
cmp r8d, 1
jle 0x42800c
mov rax, qword [r9 + 8]
lea rdi, str.install
mov r12, rcx
mov ecx, 8
mov r13, rdx
mov r15, r9
mov ebx, r8d
mov rsi, rax
repe cmpsb byte [rsi], byte [rdi]
seta bpl
setb dl
sub ebp, edx
movsx ebp, bpl
test ebp, ebp
je 0x427ae0
lea rdi, str.remove
mov rsi, rax
mov ecx, 7
repe cmpsb byte [rsi], byte [rdi]
seta bpl
setb al
sub ebp, eax
movsx ebp, bpl
test ebp, ebp
jne 0x42800c
cmp r8d, 2
jne 0x427ecc
lea rdx, str.Removing
lea rcx, str._s_service__s:
mov r8, r12
call fcn.0045e790
mov rdi, qword [sym.imp.msvcrt.dll___iob_func]
call rdi
lea rcx, [rax + 0x30]
call sub.msvcrt.dll_fflush
xor edx, edx
xor ecx, ecx
mov r8d, 0xf003f
call qword [sym.imp.ADVAPI32.dll_OpenSCManagerA]
test rax, rax
mov rsi, rax
je 0x427fb9
mov rdx, qword [r13 + 8]
mov r8d, 0xf01ff
mov rcx, rsi
call qword [sym.imp.ADVAPI32.dll_OpenServiceA]
test rax, rax
mov rbx, rax
je 0x427ff2
mov rcx, rax
call qword [sym.imp.ADVAPI32.dll_DeleteService]
test eax, eax
je 0x427f0c
lea rcx, str._done
call sub.msvcrt.dll_puts
mov rcx, rbx
mov rbx, qword [sym.imp.ADVAPI32.dll_CloseServiceHandle]
call rbx
mov rcx, rsi
call rbx
lea rcx, str.Removing_event_message_file_for__s:
mov rdx, r12
lea rbx, [rsp + 0x1c0]
call fcn.0045e790
call rdi
lea rcx, [rax + 0x30]
call sub.msvcrt.dll_fflush
mov rdx, r12
mov rcx, rbx
call fcn.004278a0
test al, al
jne 0x427d5d
nop dword [rax]
mov eax, ebp
add rsp, 0x338
pop rbx
pop rsi
pop rdi
pop rbp
pop r12
pop r13
pop r14
pop r15
ret
lea rdx, str.Installing
lea rcx, str._s_service__s:
mov r8, r12
call fcn.0045e790
mov rax, qword [sym.imp.msvcrt.dll___iob_func]
mov qword [rsp + 0x80], rax
call rax
lea rcx, [rax + 0x30]
call sub.msvcrt.dll_fflush
xor edx, edx
xor ecx, ecx
mov r8d, 0xf003f
call qword [sym.imp.ADVAPI32.dll_OpenSCManagerA]
test rax, rax
mov qword [rsp + 0x78], rax
je 0x427fb9
mov rax, qword [sym.imp.KERNEL32.dll_GetModuleFileNameA]
lea rsi, [rsp + 0x1c0]
xor ecx, ecx
mov r8d, 0x104
mov rdx, rsi
mov qword [rsp + 0x88], rax
call rax
test eax, eax
je 0x427ee3
mov edx, 0x20
mov rcx, rsi
call sub.msvcrt.dll_strchr
test rax, rax
je 0x427bf8
mov rax, rsi
mov ecx, dword [rax]
add rax, 4
lea edx, [rcx - 0x1010101]
not ecx
and edx, ecx
and edx, 0x80808080
je 0x427b73
mov ecx, edx
shr ecx, 0x10
test edx, 0x8080
cmove edx, ecx
lea rcx, [rax + 2]
cmove rax, rcx
add dl, dl
sbb rax, 3
sub rax, rsi
lea edx, [rax + 1]
movsxd rdx, edx
mov byte [rsp + rdx + 0x1c0], 0x22
lea edx, [rax + 2]
sub eax, 1
movsxd rdx, edx
mov byte [rsp + rdx + 0x1c0], 0
js 0x427bf0
nop dword [rax + rax]
movsxd rdx, eax
movzx ecx, byte [rsp + rdx + 0x1c0]
lea edx, [rax + 1]
sub eax, 1
cmp eax, 0xffffffff
movsxd rdx, edx
mov byte [rsp + rdx + 0x1c0], cl
jne 0x427bd0
mov byte [rsp + 0x1c0], 0x22
mov rdx, rsi
mov ecx, dword [rdx]
add rdx, 4
lea eax, [rcx - 0x1010101]
not ecx
and eax, ecx
and eax, 0x80808080
je 0x427bfb
mov ecx, eax
shr ecx, 0x10
test eax, 0x8080
cmove eax, ecx
lea rcx, [rdx + 2]
cmove rdx, rcx
add al, al
mov ecx, 0x20
sbb rdx, 3
sub rdx, rsi
mov word [rsi + rdx], cx
lea rcx, [rsi + rdx + 1]
mov rdx, qword [r13]
call sub.msvcrt.dll_strcpy
cmp ebx, 2
je 0x427d8b
sub ebx, 3
lea rdi, [r15 + 0x10]
lea rax, [rbx*8 + 0x18]
add r15, rax
jmp 0x427c83
lea rcx, [rsi + r14 + 1]
mov byte [rsi + r14], 0x20
mov rdx, rbx
call sub.msvcrt.dll_strcpy
add rdi, 8
cmp rdi, r15
je 0x427d8b
mov rbx, qword [rdi]
mov r14, rsi
mov edx, dword [r14]
add r14, 4
lea eax, [rdx - 0x1010101]
not edx
and eax, edx
and eax, 0x80808080
je 0x427c89
mov edx, eax
mov rcx, rbx
shr edx, 0x10
test eax, 0x8080
cmove eax, edx
lea rdx, [r14 + 2]
cmove r14, rdx
add al, al
sbb r14, 3
sub r14, rsi
call sub.msvcrt.dll_strlen
lea rax, [r14 + rax + 3]
cmp rax, 0x168
jae 0x427d8b
mov edx, 0x20
mov rcx, rbx
call sub.msvcrt.dll_strchr
test rax, rax
je 0x427c64
mov edx, 0x22
mov rcx, rbx
call sub.msvcrt.dll_strchr
test rax, rax
jne 0x427c64
mov edx, 0x2220
lea rcx, [rsi + r14 + 2]
mov word [rsi + r14], dx
mov rdx, rbx
call sub.msvcrt.dll_strcpy
mov rdx, rsi
mov ecx, dword [rdx]
add rdx, 4
lea eax, [rcx - 0x1010101]
not ecx
and eax, ecx
and eax, 0x80808080
je 0x427d1e
mov ecx, eax
shr ecx, 0x10
test eax, 0x8080
cmove eax, ecx
lea rcx, [rdx + 2]
cmove rdx, rcx
add al, al
mov eax, 0x22
sbb rdx, 3
mov word [rdx], ax
jmp 0x427c76
mov rdx, rbx
mov rcx, 0xffffffff80000002
call qword [sym.imp.ADVAPI32.dll_RegDeleteKeyA]
test eax, 0xfffffffd
je 0x42804a
lea rcx, str._RegDeleteKey_failed__error_ld_n
mov edx, eax
call fcn.0045e790
jmp 0x427ac0
lea rax, [0x004d9caa]
mov rdx, qword [r13 + 8]
mov r9d, 0xf01ff
mov qword [rsp + 0x60], 0
mov qword [rsp + 0x58], 0
mov qword [rsp + 0x50], rax
mov qword [rsp + 0x48], 0
mov qword [rsp + 0x40], 0
mov qword [rsp + 0x38], rsi
mov dword [rsp + 0x30], 1
mov dword [rsp + 0x28], 2
mov dword [rsp + 0x20], 0x10
mov rcx, qword [rsp + 0x78]
mov r8, qword [r13 + 0x10]
call qword [sym.imp.ADVAPI32.dll_CreateServiceA]
test rax, rax
mov rbx, rax
je 0x42806c
mov rax, qword [r13 + 0x18]
lea rdi, [rsp + 0xb0]
test rax, rax
je 0x427e2f
lea rdi, [rsp + 0xb0]
mov qword [rsp + 0xb0], rax
mov edx, 1
mov rcx, rbx
mov r8, rdi
call qword [sym.imp.ADVAPI32.dll_ChangeServiceConfig2A]
mov dword [rsp + 0xb0], 0x94
mov rcx, rdi
call qword [sym.imp.KERNEL32.dll_GetVersionExA]
test eax, eax
je 0x427e55
cmp dword [rsp + 0xc0], 2
je 0x428016
lea rcx, str._done
call sub.msvcrt.dll_puts
mov rcx, rbx
mov rbx, qword [sym.imp.ADVAPI32.dll_CloseServiceHandle]
call rbx
mov rcx, qword [rsp + 0x78]
call rbx
lea rcx, str.Installing_event_message_file_for__s:
mov rdx, r12
call fcn.0045e790
mov rax, qword [rsp + 0x80]
call rax
lea rcx, [rax + 0x30]
call sub.msvcrt.dll_fflush
xor ecx, ecx
mov r8d, 0x104
mov rdx, rdi
mov rax, qword [rsp + 0x88]
call rax
test eax, eax
jne 0x427f46
call qword [sym.imp.KERNEL32.dll_GetLastError]
lea rcx, str._unknown_program_path__Error_ld_n
mov edx, eax
call fcn.0045e790
jmp 0x427ac0
lea rcx, str._s:_no_arguments_allowed_for_command_remove_n
mov rdx, r12
mov bpl, 1
call fcn.0045e790
jmp 0x427ac0
call qword [sym.imp.KERNEL32.dll_GetLastError]
lea rcx, str._unknown_program_path__Error_ld_n
mov edx, eax
call fcn.0045e790
mov rcx, qword [rsp + 0x78]
call qword [sym.imp.ADVAPI32.dll_CloseServiceHandle]
mov ebp, 1
jmp 0x427ac0
call qword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 0x430
je 0x42805b
lea rcx, str._failed__Error_ld_n
mov edx, eax
call fcn.0045e790
mov rcx, rbx
mov ebp, 1
mov rbx, qword [sym.imp.ADVAPI32.dll_CloseServiceHandle]
call rbx
mov rcx, rsi
call rbx
jmp 0x427ac0
mov rdx, r12
mov rcx, rsi
call fcn.004278a0
test al, al
je 0x427ac0
lea rax, [rsp + 0xa0]
xor r9d, r9d
xor r8d, r8d
mov qword [rsp + 0x40], 0
mov qword [rsp + 0x30], 0
mov rdx, rsi
mov qword [rsp + 0x38], rax
mov dword [rsp + 0x28], 0xf003f
mov rcx, 0xffffffff80000002
mov dword [rsp + 0x20], 0
call qword [sym.imp.ADVAPI32.dll_RegCreateKeyExA]
test eax, eax
je 0x4280a6
lea rcx, str._RegCreateKeyEx_failed__error_ld_n
mov edx, eax
call fcn.0045e790
jmp 0x427ac0
call qword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 5
je 0x427fdc
lea rcx, str._cannot_open_SCManager__Error_ld_n
mov edx, eax
mov ebp, 1
call fcn.0045e790
jmp 0x427ac0
lea rcx, str._access_to_SCManager_denied
mov ebp, 1
call sub.msvcrt.dll_puts
jmp 0x427ac0
lea rcx, str._not_found
call sub.msvcrt.dll_puts
mov rcx, rsi
call qword [sym.imp.ADVAPI32.dll_CloseServiceHandle]
jmp 0x427f02
mov ebp, 0xffffffff
jmp 0x427ac0
cmp dword [rsp + 0xb4], 5
jbe 0x427e55
mov dword [rsp + 0xa0], 1
lea r8, [rsp + 0xa0]
mov edx, 3
mov rcx, rbx
call qword [sym.imp.ADVAPI32.dll_ChangeServiceConfig2A]
jmp 0x427e55
lea rcx, str._done
call sub.msvcrt.dll_puts
jmp 0x427ac0
lea rcx, str._service_is_still_running_and_marked_for_deletion_nStop_the_service_to_remove_it
call sub.msvcrt.dll_puts
jmp 0x427f2b
call qword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 0x431
je 0x428190
cmp eax, 0x430
je 0x42813c
lea rcx, str._failed__Error_ld_n
mov edx, eax
call fcn.0045e790
mov rcx, qword [rsp + 0x78]
call qword [sym.imp.ADVAPI32.dll_CloseServiceHandle]
jmp 0x427f02
mov rdx, rdi
mov ecx, dword [rdx]
add rdx, 4
lea eax, [rcx - 0x1010101]
not ecx
and eax, ecx
and eax, 0x80808080
je 0x4280a9
mov ecx, eax
mov qword [rsp + 0x20], rdi
mov r9d, 1
shr ecx, 0x10
test eax, 0x8080
mov rbx, qword [sym.imp.ADVAPI32.dll_RegSetValueExA]
cmove eax, ecx
lea rcx, [rdx + 2]
cmove rdx, rcx
add al, al
mov rcx, qword [rsp + 0xa0]
sbb rdx, 3
xor r8d, r8d
sub rdx, rdi
add edx, 1
mov dword [rsp + 0x28], edx
lea rdx, str.EventMessageFile
call rbx
test eax, eax
je 0x42814d
lea rcx, str._RegSetValueEx_failed__error_ld_n
mov edx, eax
call fcn.0045e790
mov rcx, qword [rsp + 0xa0]
call qword [sym.imp.ADVAPI32.dll_RegCloseKey]
lea rcx, str._done
call sub.msvcrt.dll_puts
jmp 0x427ac0
lea rcx, str._service_is_still_running_and_marked_for_deletion_nStop_the_service_and_retry_install
call sub.msvcrt.dll_puts
jmp 0x428096
lea rax, [rsp + 0x9c]
xor r8d, r8d
mov dword [rsp + 0x9c], 7
mov dword [rsp + 0x28], 4
mov r9d, 4
lea rdx, str.TypesSupported
mov qword [rsp + 0x20], rax
mov rcx, qword [rsp + 0xa0]
call rbx
test eax, eax
je 0x42811d
jmp 0x42810f
lea rcx, str._the_service_is_already_installed
call sub.msvcrt.dll_puts
jmp 0x428096