Function at 0x40e8f0
Capabilities:
Create service
Get common file path
Modify service
Persist via windows service
Query service status
Start service

Disassembly:
push 0xffffffffffffffff
push 0x41dd9b
mov eax, dword fs:[0]
push eax
mov dword fs:[0], esp
sub esp, 0x408
push ebx
push ebp
push esi
push edi
call fcn.0040e3d0
mov ebp, eax
mov ax, word [0x401068]
mov word [esp + 0x50], ax
mov ecx, 0x3f
xor eax, eax
lea edi, [esp + 0x52]
rep stosd dword es:[edi], eax
lea ecx, [esp + 0x14]
push ecx
stosb byte es:[edi], al
call fcn.004084f0
add esp, 4
mov edx, eax
mov edi, 0x4033cc
or ecx, 0xffffffff
xor eax, eax
repne scasb al, byte es:[edi]
mov eax, dword [edx + 8]
not ecx
dec ecx
mov ebx, ecx
mov ecx, eax
cmp eax, ebx
jb 0x40e95a
mov ecx, ebx
mov edx, dword [edx + 4]
mov edi, 0x4033cc
mov esi, edx
xor edx, edx
repe cmpsb byte [esi], byte es:[edi]
je 0x40e96f
sbb edx, edx
sbb edx, 0xffffffff
test edx, edx
jne 0x40e985
cmp eax, ebx
jae 0x40e97c
or edx, 0xffffffff
jmp 0x40e983
xor edx, edx
cmp eax, ebx
setne dl
test edx, edx
mov eax, dword [esp + 0x18]
mov dword [esp + 0x420], 0xffffffff
sete bl
test eax, eax
je 0x40e9b8
lea ecx, [eax - 1]
mov al, byte [eax - 1]
test al, al
je 0x40e9af
cmp al, 0xff
je 0x40e9af
dec al
mov byte [ecx], al
jmp 0x40e9b8
push ecx
call fcn.00412d82
add esp, 4
test bl, bl
je 0x40e9ec
mov edi, 0x40419c
or ecx, 0xffffffff
xor eax, eax
lea edx, [esp + 0x50]
repne scasb al, byte es:[edi]
not ecx
sub edi, ecx
mov esi, edi
mov ebx, ecx
mov edi, edx
or ecx, 0xffffffff
repne scasb al, byte es:[edi]
mov ecx, ebx
dec edi
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, ebx
and ecx, 3
rep movsb byte es:[edi], byte [esi]
jmp 0x40e9fc
lea eax, [esp + 0x50]
push 0xff
push eax
call dword [sym.imp.KERNEL32.dll_GetSystemDirectoryA]
mov edi, 0x404190
or ecx, 0xffffffff
xor eax, eax
lea edx, [esp + 0x50]
repne scasb al, byte es:[edi]
not ecx
sub edi, ecx
push 0xf003f
mov esi, edi
mov ebx, ecx
mov edi, edx
or ecx, 0xffffffff
repne scasb al, byte es:[edi]
mov ecx, ebx
dec edi
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, ebx
lea edx, [esp + 0x54]
and ecx, 3
push eax
rep movsb byte es:[edi], byte [esi]
mov edi, 0x4038cc
or ecx, 0xffffffff
repne scasb al, byte es:[edi]
not ecx
sub edi, ecx
push eax
mov esi, edi
mov ebx, ecx
mov edi, edx
or ecx, 0xffffffff
repne scasb al, byte es:[edi]
mov ecx, ebx
dec edi
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, ebx
and ecx, 3
rep movsb byte es:[edi], byte [esi]
call dword [sym.imp.ADVAPI32.dll_OpenSCManagerA]
mov edi, eax
test edi, edi
jne 0x40ea71
or eax, 0xffffffff
jmp 0x40ed1e
push 0
push 0
push 0
push 0
lea eax, [esp + 0x60]
push 0
push eax
push 0
push 2
push 0x10
push 0xf01ff
push 0x4035a8
push 0x4035a8
push edi
call dword [sym.imp.ADVAPI32.dll_CreateServiceA]
mov ebx, dword [sym.imp.KERNEL32.dll_GetLastError]
test eax, eax
mov dword [esp + 0x10], eax
jne 0x40ebcd
call ebx
cmp eax, 0x431
jne 0x40eb75
push 0xf01ff
push 0x4035a8
push edi
call dword [sym.imp.ADVAPI32.dll_OpenServiceA]
test eax, eax
mov dword [esp + 0x10], eax
jne 0x40eae3
push eax
call dword [sym.imp.ADVAPI32.dll_CloseServiceHandle]
or eax, 0xffffffff
jmp 0x40ed1e
test ebp, ebp
je 0x40ebda
push 0x4035a8
push 0
push 0
push 0
push 0
lea ecx, [esp + 0x64]
push 0
push ecx
push 0
push 2
push 0x10
push edi
call dword [sym.imp.ADVAPI32.dll_ChangeServiceConfigA]
test eax, eax
jne 0x40eb6e
lea edx, [esp + 0x50]
push 0x4035a8
push edx
push 0x4035a8
lea eax, [esp + 0x224]
push 0x404724
push eax
call fcn.0041531f
lea ecx, [esp + 0x22c]
lea edx, [esp + 0x28]
push ecx
push edx
call fcn.0040efd0
mov ecx, dword [esp + 0x34]
add esp, 0x1c
test ecx, ecx
je 0x40eb6e
mov al, byte [ecx - 1]
dec ecx
test al, al
je 0x40eb65
cmp al, 0xff
je 0x40eb65
dec al
mov byte [ecx], al
lea eax, [esp + 0x10]
push eax
jmp 0x40ebd2
push ecx
call fcn.00412d82
add esp, 4
lea eax, [esp + 0x10]
push eax
jmp 0x40ebd2
lea ecx, [esp + 0x50]
push 0x4035a8
push ecx
push 0x4035a8
lea edx, [esp + 0x224]
push 0x4046e4
push edx
call fcn.0041531f
lea eax, [esp + 0x22c]
lea ecx, [esp + 0x28]
push eax
push ecx
call fcn.0040efd0
mov ecx, dword [esp + 0x34]
add esp, 0x1c
test ecx, ecx
je 0x40ebda
mov al, byte [ecx - 1]
dec ecx
test al, al
je 0x40ebc5
cmp al, 0xff
je 0x40ebc5
dec al
mov byte [ecx], al
jmp 0x40ebda
push ecx
call fcn.00412d82
jmp 0x40ebd7
lea edx, [esp + 0x10]
push edx
call fcn.00408fc0
add esp, 4
push 0x4035a8
lea eax, [esp + 0x1b8]
push 0x4046d4
push eax
call fcn.0041531f
lea ecx, [esp + 0x1c0]
lea edx, [esp + 0x20]
push ecx
push edx
call fcn.0040efd0
mov ecx, dword [esp + 0x2c]
add esp, 0x14
test ecx, ecx
je 0x40ec29
mov al, byte [ecx - 1]
dec ecx
test al, al
je 0x40ec20
cmp al, 0xff
je 0x40ec20
dec al
mov byte [ecx], al
jmp 0x40ec29
push ecx
call fcn.00412d82
add esp, 4
mov esi, dword [sym.imp.KERNEL32.dll_Sleep]
push 0x1f4
call esi
push 0
push 0
mov eax, dword [esp + 0x18]
push eax
call dword [sym.imp.ADVAPI32.dll_StartServiceA]
test eax, eax
jne 0x40ecd9
call ebx
cmp eax, 0x420
jne 0x40ec70
mov ecx, dword [esp + 0x10]
mov esi, dword [sym.imp.ADVAPI32.dll_CloseServiceHandle]
push ecx
call esi
push edi
call esi
mov eax, 0xfffffffe
jmp 0x40ed1e
mov edx, dword [esp + 0x10]
mov esi, dword [sym.imp.ADVAPI32.dll_CloseServiceHandle]
push edx
call esi
push edi
call esi
push 0x4035a8
lea eax, [esp + 0x154]
push 0x4046d4
push eax
call fcn.0041531f
lea ecx, [esp + 0x15c]
lea edx, [esp + 0x30]
push ecx
push edx
call fcn.0040efd0
mov eax, dword [esp + 0x3c]
add esp, 0x14
test eax, eax
je 0x40ecd4
lea ecx, [eax - 1]
mov al, byte [eax - 1]
test al, al
je 0x40eccb
cmp al, 0xff
je 0x40eccb
dec al
mov byte [ecx], al
or eax, 0xffffffff
jmp 0x40ed1e
push ecx
call fcn.00412d82
add esp, 4
or eax, 0xffffffff
jmp 0x40ed1e
mov ecx, dword [esp + 0x10]
mov ebx, dword [sym.imp.ADVAPI32.dll_QueryServiceStatus]
lea eax, [esp + 0x34]
push eax
push ecx
call ebx
test eax, eax
je 0x40ed0c
mov eax, dword [esp + 0x38]
cmp eax, 2
jne 0x40ed37
push 0x64
call esi
lea edx, [esp + 0x34]
mov eax, dword [esp + 0x10]
push edx
push eax
call ebx
test eax, eax
jne 0x40ecef
mov edx, dword [esp + 0x10]
mov esi, dword [sym.imp.ADVAPI32.dll_CloseServiceHandle]
push edx
call esi
push edi
call esi
xor eax, eax
mov ecx, dword [esp + 0x418]
pop edi
pop esi
pop ebp
pop ebx
mov dword fs:[0], ecx
add esp, 0x414
ret
cmp eax, 4
je 0x40ed0c
mov ecx, dword [esp + 0x10]
mov esi, dword [sym.imp.ADVAPI32.dll_CloseServiceHandle]
push ecx
call esi
push edi
call esi
or eax, 0xffffffff
jmp 0x40ed1e