Function at 0x406780
Capabilities:
Enumerate services
Query service status
Stop service

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
sub esp, 0x264
mov eax, dword [0x429004]
xor eax, esp
mov dword [esp + 0x260], eax
push ebx
push esi
mov ebx, ecx
mov dword [esp + 0x14], 0
push edi
mov dword [esp + 0x10], ebx
mov dword [esp + 0x1c], 0
call dword [sym.imp.KERNEL32.dll_GetTickCount64]
push 0xf003f
push 0
push 0
mov dword [esp + 0x20], eax
call dword [sym.imp.ADVAPI32.dll_OpenSCManagerW]
test eax, eax
jne 0x40682b
cmp byte [0x42a33c], al
je 0x406879
call dword [sym.imp.KERNEL32.dll_GetLastError]
push 0
push pe_nt_image_headers32
lea ecx, [esp + 0x70]
push ecx
push 0x409
push eax
push 0
push 0x1200
call dword [sym.imp.KERNEL32.dll_FormatMessageW]
lea eax, [esp + 0x68]
push eax
push ebx
push str.____Failed_to_open_service_manager_for__s:__s
call fcn.004012f0
add esp, 0xc
xor eax, eax
pop edi
pop esi
pop ebx
mov ecx, dword [esp + 0x260]
xor ecx, esp
call fcn.00409fba
mov esp, ebp
pop ebp
ret
push 0x2c
push ebx
push eax
call dword [sym.imp.ADVAPI32.dll_OpenServiceW]
mov esi, eax
test esi, esi
jne 0x406890
cmp byte [0x42a33c], al
je 0x406879
call dword [sym.imp.KERNEL32.dll_GetLastError]
push esi
push pe_nt_image_headers32
lea ecx, [esp + 0x70]
push ecx
push 0x409
push eax
push esi
push 0x1200
call dword [sym.imp.KERNEL32.dll_FormatMessageW]
lea eax, [esp + 0x68]
push eax
push ebx
push str.____Failed_to_open_service_handle_for__s:__s
call fcn.004012f0
add esp, 0xc
xor eax, eax
pop edi
pop esi
pop ebx
mov ecx, dword [esp + 0x260]
xor ecx, esp
call fcn.00409fba
mov esp, ebp
pop ebp
ret
lea eax, [esp + 0x18]
push eax
push 0x24
lea eax, [esp + 0x4c]
push eax
push 0
push esi
call dword [sym.imp.ADVAPI32.dll_QueryServiceStatusEx]
test eax, eax
jne 0x4068e7
cmp byte [0x42a33c], al
je 0x406964
call dword [sym.imp.KERNEL32.dll_GetLastError]
push 0
push pe_nt_image_headers32
lea ecx, [esp + 0x70]
push ecx
push 0x409
push eax
push 0
push 0x1200
call dword [sym.imp.KERNEL32.dll_FormatMessageW]
lea eax, [esp + 0x68]
push eax
push ebx
push str.____Failed_to_get_service_information_for__s:__s
jmp 0x40695c
mov eax, dword [esp + 0x48]
cmp eax, 1
je 0x406adc
cmp eax, 3
je 0x406adc
lea eax, [esp + 0x1c]
push eax
lea eax, [esp + 0x1c]
push eax
push 0
push 0
push 1
push esi
call dword [sym.imp.ADVAPI32.dll_EnumDependentServicesW]
mov edi, dword [sym.imp.KERNEL32.dll_GetLastError]
test eax, eax
jne 0x406982
call edi
cmp eax, 0xea
je 0x406982
cmp byte [0x42a33c], 0
je 0x406964
call edi
push 0
push pe_nt_image_headers32
lea ecx, [esp + 0x70]
push ecx
push 0x409
push eax
push 0
push 0x1200
call dword [sym.imp.KERNEL32.dll_FormatMessageW]
lea eax, [esp + 0x68]
push eax
push ebx
push str.____Failed_to_enum_dependent_services_for__s:__s
call fcn.004012f0
add esp, 0xc
push esi
call dword [sym.imp.ADVAPI32.dll_CloseServiceHandle]
xor eax, eax
pop edi
pop esi
pop ebx
mov ecx, dword [esp + 0x260]
xor ecx, esp
call fcn.00409fba
mov esp, ebp
pop ebp
ret
mov eax, dword [esp + 0x18]
lea eax, [eax + eax*8]
shl eax, 2
push eax
push 0
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
mov edi, eax
lea eax, [esp + 0x1c]
push eax
lea eax, [esp + 0x1c]
mov dword [esp + 0x10], edi
push eax
push dword [esp + 0x20]
push edi
push 1
push esi
call dword [sym.imp.ADVAPI32.dll_EnumDependentServicesW]
test eax, eax
jne 0x406a2e
cmp byte [0x42a33c], al
je 0x4069ff
mov eax, dword [sym.imp.KERNEL32.dll_GetLastError]
call eax
push 0
push pe_nt_image_headers32
lea ecx, [esp + 0x70]
push ecx
push 0x409
push eax
push 0
push 0x1200
call dword [sym.imp.KERNEL32.dll_FormatMessageW]
lea eax, [esp + 0x68]
push eax
push ebx
push str.____Failed_to_enum_dependent_services_for__s:__s
call fcn.004012f0
add esp, 0xc
push esi
call dword [sym.imp.ADVAPI32.dll_CloseServiceHandle]
push edi
mov eax, dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push 0
call eax
push eax
call dword [sym.imp.KERNEL32.dll_HeapFree]
xor eax, eax
pop edi
pop esi
pop ebx
mov ecx, dword [esp + 0x260]
xor ecx, esp
call fcn.00409fba
mov esp, ebp
pop ebp
ret
mov eax, dword [esp + 0x1c]
test eax, eax
je 0x406a5d
xor edi, edi
test eax, eax
je 0x406a59
mov ebx, dword [esp + 0xc]
mov ecx, dword [ebx]
call fcn.00406780
test eax, eax
jne 0x406afd
inc edi
add ebx, 0x24
cmp edi, dword [esp + 0x1c]
jb 0x406a40
mov edi, dword [esp + 0xc]
lea eax, [esp + 0x20]
push eax
push 1
push esi
call dword [sym.imp.ADVAPI32.dll_ControlService]
test eax, eax
je 0x4069ff
cmp dword [esp + 0x24], 1
je 0x406acb
mov ebx, dword [sym.imp.KERNEL32.dll_Sleep]
nop dword [eax]
push dword [esp + 0x38]
call ebx
lea eax, [esp + 0x18]
push eax
push 0x24
lea eax, [esp + 0x28]
push eax
push 0
push esi
call dword [sym.imp.ADVAPI32.dll_QueryServiceStatusEx]
test eax, eax
je 0x4069ff
cmp dword [esp + 0x24], 1
je 0x406acb
call dword [sym.imp.KERNEL32.dll_GetTickCount64]
sub eax, dword [esp + 0x14]
sbb edx, 0
test edx, edx
ja 0x406acb
jb 0x406ac4
cmp eax, 0x7530
ja 0x406acb
cmp dword [esp + 0x24], 1
jne 0x406a80
mov eax, dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push edi
push 0
call eax
push eax
call dword [sym.imp.KERNEL32.dll_HeapFree]
push esi
call dword [sym.imp.ADVAPI32.dll_CloseServiceHandle]
mov ecx, dword [esp + 0x26c]
mov eax, 1
pop edi
pop esi
pop ebx
xor ecx, esp
call fcn.00409fba
mov esp, ebp
pop ebp
ret
cmp byte [0x42a33c], 0
je 0x406b42
mov eax, dword [sym.imp.KERNEL32.dll_GetLastError]
call eax
push 0
push pe_nt_image_headers32
lea ecx, [esp + 0x70]
push ecx
push 0x409
push eax
push 0
push 0x1200
call dword [sym.imp.KERNEL32.dll_FormatMessageW]
lea eax, [esp + 0x68]
push eax
push dword [esp + 0x14]
push str.____Failed_to_kill_dependent_services_for__s:__s
call fcn.004012f0
add esp, 0xc
push esi
call dword [sym.imp.ADVAPI32.dll_CloseServiceHandle]
push dword [esp + 0xc]
jmp 0x406a07