Function at 0x401340
Capabilities:
Enumerate services
Query environment variable
Query service configuration

Disassembly:
sub esp, 0x34c
mov eax, dword [0x42506c]
xor eax, esp
mov dword [esp + 0x348], eax
push ebx
push ebp
push esi
push edi
push 4
push 0
push 0
mov ebx, ecx
call dword [sym.imp.ADVAPI32.dll_OpenSCManagerA]
test eax, eax
mov dword [esp + 0x10], eax
je 0x40179c
mov ebp, dword [sym.imp.ADVAPI32.dll_EnumServicesStatusA]
lea ecx, [esp + 0x20]
push ecx
lea edx, [esp + 0x18]
push edx
lea ecx, [esp + 0x30]
push ecx
push 0x24
lea edx, [esp + 0x44]
push edx
push 3
push 0xb
push eax
mov dword [esp + 0x40], 0
call ebp
mov esi, eax
call dword [sym.imp.KERNEL32.dll_GetLastError]
test esi, esi
je 0x4013b0
cmp eax, 0xea
jne 0x4013f2
mov esi, dword [esp + 0x28]
add esi, 0x24
xor ecx, ecx
mov eax, esi
mov edx, 0x24
mul edx
seto cl
neg ecx
or ecx, eax
push ecx
call fcn.00403b21
add esp, 4
mov edi, eax
lea eax, [esp + 0x20]
push eax
mov eax, dword [esp + 0x14]
lea ecx, [esp + 0x18]
push ecx
lea edx, [esp + 0x30]
push edx
push esi
push edi
push 3
push 0xb
push eax
call ebp
jmp 0x4013f6
mov edi, dword [esp + 0x24]
mov eax, dword [esp + 0x14]
test eax, eax
mov dword [ebx], eax
mov dword [esp + 0x2c], 0
jbe 0x401798
add edi, 0xc
mov dword [esp + 0x1c], edi
lea ebp, [ebx + 0x608]
lea esp, [esp]
mov ecx, dword [edi - 0xc]
mov edx, dword [esp + 0x10]
push 0xf01ff
push ecx
push edx
call dword [sym.imp.ADVAPI32.dll_OpenServiceA]
mov esi, eax
test esi, esi
mov dword [esp + 0x24], esi
je 0x4016a7
push 0x1000
push 0x40
call dword [sym.imp.KERNEL32.dll_LocalAlloc]
mov ebx, eax
test ebx, ebx
je 0x4017be
lea eax, [esp + 0x30]
push eax
push 0x1000
push ebx
push esi
call dword [sym.imp.ADVAPI32.dll_QueryServiceConfigA]
mov eax, dword [ebx + 4]
test al, 2
je 0x401479
push str.Auto_Start
jmp 0x401498
test al, 3
je 0x401484
push str.Demand_Start
jmp 0x401498
test al, 4
je 0x40148f
push str.Disabled
jmp 0x401498
test al, 1
je 0x4014a1
push str.System_Start
push ebp
call fcn.0040392f
add esp, 8
push 0x40
call fcn.0040386c
add esp, 4
push 0x40
mov edi, eax
push edi
push str.SYSTEMROOT
call dword [sym.imp.KERNEL32.dll_GetEnvironmentVariableA]
mov eax, edi
lea ecx, [ecx]
mov cl, byte [eax]
mov byte [eax], cl
add eax, 1
test cl, cl
jne 0x4014c0
push 0x17f
mov byte [esp + 0x5c], cl
lea ecx, [esp + 0x5d]
push 0
push ecx
call fcn.004036a0
mov edx, dword [ebx + 0xc]
push edx
lea eax, [esp + 0x68]
push eax
call fcn.0040392f
lea ecx, [esp + 0x6c]
push str.SystemRoot
push ecx
call fcn.00403610
lea ecx, [esp + 0x74]
add esp, 0x1c
lea esi, [ecx + 1]
mov dl, byte [ecx]
add ecx, 1
test dl, dl
jne 0x401507
sub ecx, esi
je 0x401534
test eax, eax
je 0x401534
add eax, 0xb
push eax
push edi
lea edx, [esp + 0x60]
push str._s_s
push edx
call fcn.0040392f
add esp, 0x10
jmp 0x401677
lea eax, [esp + 0x58]
push 0x420334
push eax
call fcn.00403610
lea ecx, [esp + 0x60]
add esp, 8
lea esi, [ecx + 1]
lea ecx, [ecx]
mov dl, byte [ecx]
add ecx, 1
test dl, dl
jne 0x401550
sub ecx, esi
je 0x40157c
test eax, eax
je 0x40157c
add eax, 4
push eax
lea ecx, [esp + 0x5c]
push 0x420330
push ecx
call fcn.0040392f
add esp, 0xc
jmp 0x401677
lea edx, [esp + 0x58]
push str.system32
push edx
call fcn.00403610
lea ecx, [esp + 0x60]
add esp, 8
lea esi, [ecx + 1]
mov dl, byte [ecx]
add ecx, 1
test dl, dl
jne 0x401595
sub ecx, esi
je 0x4015f5
test eax, eax
je 0x4015f5
lea ecx, [esp + 0x58]
cmp ecx, eax
jne 0x4015f5
push 0x17f
mov byte [esp + 0x1dc], dl
lea edx, [esp + 0x1dd]
push 0
push edx
call fcn.004036a0
lea eax, [esp + 0x64]
push eax
push edi
lea ecx, [esp + 0x1ec]
push 0x42031c
push ecx
call fcn.0040392f
lea edx, [esp + 0x1f4]
push edx
push 0x420330
lea eax, [esp + 0x7c]
push eax
jmp 0x40166f
lea ecx, [esp + 0x58]
push str.System32
push ecx
call fcn.00403610
lea ecx, [esp + 0x60]
add esp, 8
lea esi, [ecx + 1]
mov edi, edi
mov dl, byte [ecx]
add ecx, 1
test dl, dl
jne 0x401610
sub ecx, esi
je 0x401677
test eax, eax
je 0x401677
lea edx, [esp + 0x58]
cmp edx, eax
jne 0x401677
push 0x17f
lea eax, [esp + 0x1dd]
push 0
push eax
mov byte [esp + 0x1e4], 0
call fcn.004036a0
lea ecx, [esp + 0x64]
push ecx
push edi
lea edx, [esp + 0x1ec]
push 0x42031c
push edx
call fcn.0040392f
lea eax, [esp + 0x1f4]
push eax
push 0x420330
lea ecx, [esp + 0x7c]
push ecx
call fcn.0040392f
add esp, 0x28
lea edx, [esp + 0x58]
push edx
lea eax, [ebp + 0x300]
push eax
call fcn.0040392f
push edi
call fcn.0040371a
add esp, 0xc
push ebx
call dword [sym.imp.KERNEL32.dll_LocalFree]
mov ecx, dword [esp + 0x24]
push ecx
call dword [sym.imp.ADVAPI32.dll_CloseServiceHandle]
mov edi, dword [esp + 0x1c]
mov edx, dword [edi - 0xc]
push edx
lea eax, [ebp - 0x480]
push eax
call fcn.0040392f
mov ecx, dword [edi - 8]
push ecx
lea edx, [ebp - 0x300]
push edx
call fcn.0040392f
mov eax, dword [edi - 4]
add esp, 0x10
test al, 2
je 0x4016df
push str.File_System_Driver
lea eax, [ebp - 0x180]
push eax
jmp 0x4016ef
test al, 1
je 0x4016f7
push str.Kernel_Driver
lea ecx, [ebp - 0x180]
push ecx
call fcn.0040392f
add esp, 8
mov eax, dword [edi]
cmp eax, 5
jne 0x401705
push str.Continue_pending
jmp 0x401767
cmp eax, 6
jne 0x401718
push str.Pause_pending
lea eax, [ebp + 0x180]
push eax
jmp 0x40176e
cmp eax, 7
jne 0x40172b
push str.Paused
lea ecx, [ebp + 0x180]
push ecx
jmp 0x40176e
cmp eax, 4
jne 0x401737
push str.Running
jmp 0x401767
cmp eax, 2
jne 0x40174a
push str.Start_pending
lea eax, [ebp + 0x180]
push eax
jmp 0x40176e
cmp eax, 3
jne 0x40175d
push str.Stop_pending
lea ecx, [ebp + 0x180]
push ecx
jmp 0x40176e
cmp eax, 1
jne 0x401776
push str.Stopped
lea edx, [ebp + 0x180]
push edx
call fcn.0040392f
add esp, 8
mov eax, dword [esp + 0x2c]
add eax, 1
add edi, 0x24
add ebp, 0x900
cmp eax, dword [esp + 0x14]
mov dword [esp + 0x2c], eax
mov dword [esp + 0x1c], edi
jb 0x401420
mov eax, dword [esp + 0x10]
push eax
call dword [sym.imp.ADVAPI32.dll_CloseServiceHandle]
mov al, 1
mov ecx, dword [esp + 0x358]
pop edi
pop esi
pop ebp
pop ebx
xor ecx, esp
call fcn.00403b8b
add esp, 0x34c
ret
xor al, al
jmp 0x4017a5