Function at 0x405240
Capabilities:
Delete service
Modify service
Query service status
Stop service

Disassembly:
push ebp
mov ebp, esp
push 0xffffffffffffffff
push 0x56de78
mov eax, dword fs:[0]
push eax
sub esp, 0x38
mov eax, dword [0x5d2fec]
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 dword [ebp - 0x44], ecx
mov dword [ebp - 4], 0
or ebx, 0xffffffff
cmp dword [0x5dd5d0], 0
mov esi, 1
jne 0x40528d
xor esi, esi
jmp 0x405649
call fcn.00417ce3
mov ecx, eax
test ecx, ecx
jne 0x4052a2
push 0x80004005
call fcn.00407010
mov eax, dword [ecx]
call dword [eax + 0xc]
add eax, 0x10
mov dword [ebp - 0x14], eax
mov byte [ebp - 4], 1
mov ecx, 0x10026
cmp dword [0x5dd5d4], 0
mov eax, 0x26
cmovne eax, ecx
push eax
push dword [ebp + 8]
push dword [0x5dd5d0]
call dword [sym.imp.ADVAPI32.dll_OpenServiceW]
mov edi, eax
test edi, edi
jne 0x405394
call dword [sym.imp.KERNEL32.dll_GetLastError]
push edi
push edi
mov esi, eax
lea eax, [ebp - 0x34]
push eax
push 0x400
push esi
push edi
push 0x1300
call dword [sym.imp.KERNEL32.dll_FormatMessageW]
push dword [ebp - 0x34]
lea eax, [ebp - 0x14]
push esi
push 0x5af80c
push eax
call fcn.00406ff0
add esp, 0x10
push dword [ebp - 0x34]
call dword [sym.imp.KERNEL32.dll_LocalFree]
push 0x5af818
lea eax, [ebp + 8]
push eax
lea eax, [ebp - 0x38]
push eax
call fcn.00406a20
lea ecx, [ebp - 0x14]
mov byte [ebp - 4], 2
push ecx
push eax
lea eax, [ebp - 0x3c]
push eax
call fcn.00405ab0
add esp, 0x18
push edi
push edi
mov byte [ebp - 4], 3
push dword [eax]
call fcn.00419519
mov byte [ebp - 4], 2
mov eax, ebx
mov edx, dword [ebp - 0x3c]
add edx, 0xfffffff0
lock xadd dword [edx + 0xc], eax
dec eax
test eax, eax
jg 0x40536f
mov ecx, dword [edx]
push edx
mov eax, dword [ecx]
call dword [eax + 4]
mov byte [ebp - 4], 1
mov eax, ebx
mov edx, dword [ebp - 0x38]
add edx, 0xfffffff0
lock xadd dword [edx + 0xc], eax
dec eax
test eax, eax
jg 0x4053aa
mov ecx, dword [edx]
push edx
mov eax, dword [ecx]
call dword [eax + 4]
xor esi, esi
jmp 0x40562b
lea eax, [ebp - 0x30]
push eax
push edi
call dword [sym.imp.ADVAPI32.dll_QueryServiceStatus]
test eax, eax
jne 0x4053b1
push edi
call dword [sym.imp.ADVAPI32.dll_CloseServiceHandle]
xor esi, esi
jmp 0x40562b
cmp dword [ebp - 0x2c], 4
jne 0x405478
lea eax, [ebp - 0x30]
push eax
push 1
push edi
call dword [sym.imp.ADVAPI32.dll_ControlService]
test eax, eax
jne 0x405478
call dword [sym.imp.KERNEL32.dll_GetLastError]
push 0
push 0
mov esi, eax
lea eax, [ebp - 0x34]
push eax
push 0x400
push esi
push 0
push 0x1300
call dword [sym.imp.KERNEL32.dll_FormatMessageW]
push dword [ebp - 0x34]
lea eax, [ebp - 0x14]
push esi
push 0x5af80c
push eax
call fcn.00406ff0
add esp, 0x10
push dword [ebp - 0x34]
call dword [sym.imp.KERNEL32.dll_LocalFree]
lea eax, [ebp + 8]
push eax
lea eax, [ebp - 0x40]
push 0x5af840
push eax
call fcn.00406490
push 0x5af830
push eax
lea eax, [ebp - 0x3c]
mov byte [ebp - 4], 4
push eax
call fcn.00406a20
lea ecx, [ebp - 0x14]
mov byte [ebp - 4], 5
push ecx
push eax
lea eax, [ebp - 0x38]
push eax
call fcn.00405ab0
add esp, 0x24
push 0
push 0
mov byte [ebp - 4], 6
push dword [eax]
call fcn.00419519
lea ecx, [ebp - 0x38]
call fcn.004070b0
lea ecx, [ebp - 0x3c]
call fcn.004070b0
lea ecx, [ebp - 0x40]
mov byte [ebp - 4], 1
call fcn.004070b0
xor esi, esi
push dword [0x5dd5d0]
call dword [sym.imp.ADVAPI32.dll_LockServiceDatabase]
mov dword [ebp - 0x3c], eax
test eax, eax
je 0x405564
push 0
push 0
push 0
push 0
push 0
push 0
push 0
push 0xffffffffffffffff
push dword [ebp - 0x44]
push 0xffffffffffffffff
push edi
call dword [sym.imp.ADVAPI32.dll_ChangeServiceConfigW]
test eax, eax
jne 0x40555b
call dword [sym.imp.KERNEL32.dll_GetLastError]
push 0
push 0
mov esi, eax
lea eax, [ebp - 0x34]
push eax
push 0x400
push esi
push 0
push 0x1300
call dword [sym.imp.KERNEL32.dll_FormatMessageW]
push dword [ebp - 0x34]
lea eax, [ebp - 0x14]
push esi
push 0x5af80c
push eax
call fcn.00406ff0
add esp, 0x10
push dword [ebp - 0x34]
call dword [sym.imp.KERNEL32.dll_LocalFree]
lea eax, [ebp + 8]
push eax
lea eax, [ebp - 0x38]
push 0x5af864
push eax
call fcn.00406490
push 0x5af850
push eax
lea eax, [ebp - 0x40]
mov byte [ebp - 4], 7
push eax
call fcn.00406a20
lea ecx, [ebp - 0x14]
mov byte [ebp - 4], 8
push ecx
push eax
lea eax, [ebp - 0x44]
push eax
call fcn.00405ab0
add esp, 0x24
push 0
push 0
mov byte [ebp - 4], 9
push dword [eax]
call fcn.00419519
lea ecx, [ebp - 0x44]
call fcn.004070b0
lea ecx, [ebp - 0x40]
call fcn.004070b0
lea ecx, [ebp - 0x38]
mov byte [ebp - 4], 1
call fcn.004070b0
xor esi, esi
push dword [ebp - 0x3c]
call dword [sym.imp.ADVAPI32.dll_UnlockServiceDatabase]
cmp dword [0x5dd5d4], 0
je 0x405624
push edi
call dword [sym.imp.ADVAPI32.dll_DeleteService]
test eax, eax
jne 0x405624
call dword [sym.imp.KERNEL32.dll_GetLastError]
push 0
push 0
mov esi, eax
lea eax, [ebp - 0x34]
push eax
push 0x400
push esi
push 0
push 0x1300
call dword [sym.imp.KERNEL32.dll_FormatMessageW]
push dword [ebp - 0x34]
lea eax, [ebp - 0x14]
push esi
push 0x5af80c
push eax
call fcn.00406ff0
add esp, 0x10
push dword [ebp - 0x34]
call dword [sym.imp.KERNEL32.dll_LocalFree]
lea eax, [ebp + 8]
push eax
lea eax, [ebp - 0x38]
push 0x5af870
push eax
call fcn.00406490
push 0x5af850
push eax
lea eax, [ebp - 0x40]
mov byte [ebp - 4], 0xa
push eax
call fcn.00406a20
lea ecx, [ebp - 0x14]
mov byte [ebp - 4], 0xb
push ecx
push eax
lea eax, [ebp - 0x44]
push eax
call fcn.00405ab0
add esp, 0x24
push 0
push 0
mov byte [ebp - 4], 0xc
push dword [eax]
call fcn.00419519
lea ecx, [ebp - 0x44]
call fcn.004070b0
lea ecx, [ebp - 0x40]
call fcn.004070b0
lea ecx, [ebp - 0x38]
call fcn.004070b0
xor esi, esi
push edi
call dword [sym.imp.ADVAPI32.dll_CloseServiceHandle]
mov byte [ebp - 4], 0
mov eax, ebx
mov edx, dword [ebp - 0x14]
add edx, 0xfffffff0
lock xadd dword [edx + 0xc], eax
dec eax
test eax, eax
jg 0x405649
mov ecx, dword [edx]
push edx
mov eax, dword [ecx]
call dword [eax + 4]
mov dword [ebp - 4], 0xffffffff
mov eax, dword [ebp + 8]
add eax, 0xfffffff0
lock xadd dword [eax + 0xc], ebx
dec ebx
test ebx, ebx
jg 0x405668
mov ecx, dword [eax]
push eax
mov edx, dword [ecx]
call dword [edx + 4]
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.0054e73a
mov esp, ebp
pop ebp
ret