Function at 0x401220
Capabilities:
Check for time delay via gettickcount
Create service
Get common file path
Query service status
Start service

Disassembly:
sub esp, 0x120
push ebp
push edi
push 0x104
lea eax, [esp + 0x2c]
push eax
call dword [sym.imp.KERNEL32.dll_GetSystemDirectoryA]
lea edi, [esp + 0x28]
dec edi
lea ecx, [ecx]
mov al, byte [edi + 1]
inc edi
test al, al
jne 0x401240
mov ecx, dword [str.Mxgp.log]
mov edx, dword [0x4154d8]
mov ax, word [0x4154dc]
push 0xf003f
mov dword [edi], ecx
push 0
mov dword [edi + 4], edx
push 0
mov word [edi + 8], ax
call dword [sym.imp.ADVAPI32.dll_OpenSCManagerA]
mov ebp, eax
test ebp, ebp
mov dword [esp + 8], ebp
je 0x40142d
xor ecx, ecx
mov dword [esp + 0x10], ecx
push ebx
mov dword [esp + 0x18], ecx
push esi
mov dword [esp + 0x20], ecx
push 0xf01ff
mov dword [esp + 0x28], ecx
push str.protectorservice
mov dword [esp + 0x30], ecx
push ebp
mov dword [esp + 0x20], 0
mov dword [esp + 0x38], ecx
call dword [sym.imp.ADVAPI32.dll_OpenServiceA]
mov esi, eax
test esi, esi
jne 0x401362
mov edi, dword [sym.imp.KERNEL32.dll_SetLastError]
push eax
call edi
push esi
push esi
push esi
push esi
push esi
lea edx, [esp + 0x44]
push edx
push 1
push 3
push 1
push 0xa0000134
push str.protectorservice
push str.protectorservice
push ebp
call dword [sym.imp.ADVAPI32.dll_CreateServiceA]
mov ebx, dword [sym.imp.KERNEL32.dll_GetLastError]
mov esi, eax
call ebx
mov ecx, dword [0x41c954]
test ecx, ecx
je 0x401319
mov edx, dword [ecx]
push eax
push str.CreateService__error_code_:__d
push 3
push ecx
call dword [edx + 0xc]
mov ecx, dword [0x41c954]
add esp, 0x10
test esi, esi
jne 0x40133f
test ecx, ecx
je 0x40132d
mov eax, dword [ecx]
push 3
push str.CreateService_failed.
call dword [eax + 4]
push ebp
call dword [sym.imp.ADVAPI32.dll_CloseServiceHandle]
pop esi
pop ebx
pop edi
pop ebp
add esp, 0x120
ret
test ecx, ecx
je 0x40134f
mov edx, dword [ecx]
push 3
push str.CreateService_OK.
call dword [edx + 4]
push 0
call edi
push 0
push 0
push esi
call dword [sym.imp.ADVAPI32.dll_StartServiceA]
call ebx
jmp 0x4013a4
mov ecx, dword [0x41c954]
test ecx, ecx
je 0x401378
mov eax, dword [ecx]
push 3
push str.OpenService_OK.
call dword [eax + 4]
lea ecx, [esp + 0x14]
push ecx
push esi
call dword [sym.imp.ADVAPI32.dll_QueryServiceStatus]
cmp dword [esp + 0x18], 4
je 0x4013bf
push 0
call dword [sym.imp.KERNEL32.dll_SetLastError]
push 0
push 0
push esi
call dword [sym.imp.ADVAPI32.dll_StartServiceA]
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov ecx, dword [0x41c954]
test ecx, ecx
je 0x4013bf
mov edx, dword [ecx]
push eax
push str.StartService__error_code_:__d
push 3
push ecx
call dword [edx + 0xc]
add esp, 0x10
mov edi, dword [sym.imp.KERNEL32.dll_GetTickCount]
call edi
mov ebx, eax
cmp dword [esp + 0x18], 4
je 0x401403
mov ebp, dword [sym.imp.KERNEL32.dll_Sleep]
mov eax, dword [esp + 0x2c]
push eax
call ebp
lea ecx, [esp + 0x14]
push ecx
push esi
call dword [sym.imp.ADVAPI32.dll_QueryServiceStatus]
test eax, eax
je 0x40141b
call edi
sub eax, ebx
cmp eax, 0x1388
ja 0x40141b
cmp dword [esp + 0x18], 4
jne 0x4013d6
mov ebp, dword [esp + 0x10]
mov ecx, dword [0x41c954]
test ecx, ecx
je 0x40141f
mov edx, dword [ecx]
push 3
push 0x415430
call dword [edx + 4]
jmp 0x40141f
mov ebp, dword [esp + 0x10]
push esi
mov esi, dword [sym.imp.ADVAPI32.dll_CloseServiceHandle]
call esi
push ebp
call esi
pop esi
pop ebx
pop edi
pop ebp
add esp, 0x120
ret