Function at 0x413f40
Capabilities:
Create service
Get common file path
Modify service
Persist via windows service
Set registry value
Start service

Disassembly:
push ebp
mov ebp, esp
push 0xffffffffffffffff
push 0x5cbd2c
mov eax, dword fs:[0]
push eax
sub esp, 0x294
mov eax, dword [0x667ce0]
xor eax, ebp
mov dword [ebp - 0x10], eax
push ebx
push esi
push edi
push eax
lea eax, [ebp - 0xc]
mov dword fs:[0], eax
mov eax, dword [ebp + 0x14]
mov edx, dword [ebp + 0xc]
mov ecx, edx
mov edi, dword [ebp + 0x10]
mov esi, dword [ebp + 8]
mov dword [ebp - 0x274], eax
mov eax, dword [ebp + 0x18]
lea ebx, [ecx + 2]
mov dword [ebp - 0x278], eax
xor eax, eax
mov dword [ebp - 0x26c], edi
mov dword [ebp - 0x220], 0
mov dword [ebp - 0x21c], 7
mov word [ebp - 0x230], ax
mov ax, word [ecx]
add ecx, 2
test ax, ax
jne 0x413fb1
sub ecx, ebx
sar ecx, 1
push ecx
push edx
lea ecx, [ebp - 0x230]
call fcn.00403240
lea eax, [ebp - 0x264]
mov dword [ebp - 4], 0
push eax
push 3
push 0
push str.SOFTWAREMicrosoftWindows_NTCurrentVersionSvchost
push reloc.WS2_32.dll_bind
mov dword [ebp - 0x264], 0
call dword [sym.imp.ADVAPI32.dll_RegOpenKeyExW]
test eax, eax
jne 0x414074
mov edx, edi
lea ecx, [edx + 2]
mov ax, word [edx]
add edx, 2
test ax, ax
jne 0x414002
sub edx, ecx
lea ecx, [ebp - 0x230]
sar edx, 1
cmp dword [ebp - 0x21c], 8
cmovae ecx, dword [ebp - 0x230]
lea eax, [edx*2 + 2]
push eax
push edi
push 7
push 0
push ecx
push dword [ebp - 0x264]
call dword [sym.imp.ADVAPI32.dll_RegSetValueExW]
test eax, eax
jne 0x414074
push dword [ebp - 0x264]
mov ebx, dword [sym.imp.KERNEL32.dll_CloseHandle]
call ebx
push 0xf003f
push 0
push 0
call dword [sym.imp.ADVAPI32.dll_OpenSCManagerW]
mov dword [ebp - 0x270], eax
test eax, eax
jne 0x4140b9
push 0x7a
call fcn.0043f1dd
add esp, 4
xor esi, esi
mov edx, dword [ebp - 0x21c]
cmp edx, 8
jb 0x414329
mov ecx, dword [ebp - 0x230]
lea edx, [edx*2 + 2]
mov eax, ecx
cmp edx, 0x1000
jb 0x41431f
mov ecx, dword [ecx - 4]
add edx, 0x23
sub eax, ecx
add eax, 0xfffffffc
cmp eax, 0x1f
ja 0x414349
jmp 0x41431f
push 0x208
lea eax, [ebp - 0x218]
push 0
push eax
call fcn.005a2240
add esp, 0xc
lea ecx, [ebp - 0x248]
push 0x656858
call fcn.00403040
lea ecx, [ebp - 0x2a0]
mov byte [ebp - 4], 1
call fcn.004535d9
lea ecx, [ebp - 0x2a0]
mov byte [ebp - 4], 2
call fcn.0045360d
test eax, eax
lea eax, [ebp - 0x218]
push 0x104
push eax
je 0x414115
call dword [sym.imp.KERNEL32.dll_GetSystemWow64DirectoryW]
jmp 0x41411b
call dword [sym.imp.KERNEL32.dll_GetSystemDirectoryW]
lea ecx, [ebp - 0x218]
lea edx, [ecx + 2]
mov ax, word [ecx]
add ecx, 2
test ax, ax
jne 0x414124
sub ecx, edx
lea eax, [ebp - 0x218]
sar ecx, 1
push ecx
push eax
lea ecx, [ebp - 0x248]
call fcn.00403240
push 0x10
push str._svchost.exe__k
lea ecx, [ebp - 0x248]
call fcn.00405a30
cmp dword [ebp - 0x21c], 8
lea eax, [ebp - 0x230]
push dword [ebp - 0x220]
cmovae eax, dword [ebp - 0x230]
lea ecx, [ebp - 0x248]
push eax
call fcn.00405a30
cmp dword [ebp - 0x234], 8
lea eax, [ebp - 0x248]
push 0
cmovae eax, dword [ebp - 0x248]
push 0
push 0
push 0
push 0
push eax
push 1
push 2
push 0x20
push 0xf01ff
push dword [ebp - 0x274]
push edi
push dword [ebp - 0x270]
call dword [sym.imp.ADVAPI32.dll_CreateServiceW]
mov edi, eax
test edi, edi
jne 0x4141d2
push 0x7b
call fcn.0043f1dd
add esp, 4
xor esi, esi
jmp 0x414304
mov eax, dword [ebp - 0x278]
mov dword [ebp - 0x27c], eax
lea eax, [ebp - 0x27c]
push eax
push 1
push edi
call dword [sym.imp.ADVAPI32.dll_ChangeServiceConfig2W]
push str.SYSTEMCurrentControlSetServices_
lea ecx, [ebp - 0x260]
call fcn.00403040
mov edx, dword [ebp - 0x26c]
mov ecx, edx
mov byte [ebp - 4], 3
lea eax, [ecx + 2]
mov dword [ebp - 0x26c], eax
mov ax, word [ecx]
add ecx, 2
test ax, ax
jne 0x414213
sub ecx, dword [ebp - 0x26c]
sar ecx, 1
push ecx
push edx
lea ecx, [ebp - 0x260]
call fcn.00405a30
cmp dword [ebp - 0x24c], 8
lea ecx, [ebp - 0x264]
push ecx
push 0xf003f
lea eax, [ebp - 0x260]
cmovae eax, dword [ebp - 0x260]
push 0
push eax
push reloc.WS2_32.dll_bind
call dword [sym.imp.ADVAPI32.dll_RegOpenKeyExW]
test eax, eax
jne 0x4142f7
mov dword [ebp - 0x268], eax
lea eax, [ebp - 0x268]
push eax
push str.Parameters
push dword [ebp - 0x264]
call dword [sym.imp.ADVAPI32.dll_RegCreateKeyW]
test eax, eax
jne 0x4142f7
cmp dword [esi + 0x14], 8
mov eax, dword [esi + 0x10]
jb 0x414296
mov esi, dword [esi]
lea eax, [eax*2 + 2]
push eax
push esi
push 2
push 0
push str.ServiceDll
push dword [ebp - 0x268]
call dword [sym.imp.ADVAPI32.dll_RegSetValueExW]
test eax, eax
jne 0x4142f7
push eax
push eax
push edi
call dword [sym.imp.ADVAPI32.dll_StartServiceW]
test eax, eax
jne 0x4142cf
push 0x7c
call fcn.0043f1dd
add esp, 4
push dword [ebp - 0x264]
call ebx
push dword [ebp - 0x268]
call ebx
mov esi, dword [sym.imp.ADVAPI32.dll_CloseServiceHandle]
push edi
call esi
push dword [ebp - 0x270]
call esi
mov esi, 1
jmp 0x4142f9
xor esi, esi
lea ecx, [ebp - 0x260]
call fcn.00402fe0
lea ecx, [ebp - 0x2a0]
call fcn.004535ec
lea ecx, [ebp - 0x248]
call fcn.00402fe0
jmp 0x414076
push edx
push ecx
call fcn.0059c9cd
add esp, 8
mov eax, esi
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 0x10]
xor ecx, ebp
call fcn.0059cf09
mov esp, ebp
pop ebp
ret 0x14
call fcn.005a57f9
int3