Function at 0x459210
Capabilities:
Check for time delay via gettickcount
Link many functions at runtime

Disassembly:
sub esp, 0x234
push ebx
push ebp
push esi
push edi
call fcn.0044bde0
test eax, eax
je 0x4592b4
push 0
lea eax, [esp + 0x48]
push str.CService_::_StopAService_n
push eax
call fcn.00471c30
mov edi, str.ENTRY:
or ecx, 0xffffffff
xor eax, eax
add esp, 0xc
repne scasb al, byte es:[edi]
not ecx
sub edi, ecx
lea edx, [esp + 0x144]
mov eax, ecx
mov esi, edi
mov edi, edx
lea edx, [esp + 0x144]
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, eax
xor eax, eax
and ecx, 3
rep movsb byte es:[edi], byte [esi]
lea edi, [esp + 0x44]
or ecx, 0xffffffff
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]
call fcn.0044bd70
mov ecx, eax
call fcn.0044be10
lea eax, [esp + 0x144]
push eax
call fcn.0044bd70
mov ecx, eax
call fcn.0044c180
call fcn.0044bde0
test eax, eax
je 0x4592f0
mov ecx, dword [esp + 0x24c]
mov edx, dword [esp + 0x248]
push ecx
push edx
lea eax, [esp + 0x4c]
push str.lpszServiceName___s__bDoDeleteService___d_n
push eax
call fcn.00471c30
add esp, 0x10
lea ecx, [esp + 0x44]
push ecx
call fcn.0044bd70
mov ecx, eax
call fcn.0044c180
xor ebx, ebx
push str.Advapi32.dll
mov dword [esp + 0x18], ebx
call dword [sym.imp.KERNEL32.dll_LoadLibraryA]
mov edi, eax
test edi, edi
je 0x459468
mov esi, dword [sym.imp.KERNEL32.dll_GetProcAddress]
push str.OpenSCManagerA
push edi
call esi
test eax, eax
mov dword [esp + 0x10], eax
je 0x45942c
push str.OpenServiceA
push edi
call esi
mov ebx, eax
test ebx, ebx
je 0x459409
push str.QueryServiceStatus
push edi
call esi
test eax, eax
mov dword [esp + 0x18], eax
je 0x4593e6
push str.ControlService
push edi
call esi
mov ebp, eax
test ebp, ebp
je 0x4593c3
push str.DeleteService
push edi
call esi
test eax, eax
mov dword [esp + 0x20], eax
je 0x4593a0
push str.CloseServiceHandle
push edi
call esi
test eax, eax
mov dword [esp + 0x1c], eax
jne 0x45948b
call fcn.0044bde0
test eax, eax
je 0x4595fd
push str.Failed_to_load_export_CloseServiceHandle_n
call fcn.0044bd70
mov ecx, eax
call fcn.0044c180
jmp 0x4595fd
call fcn.0044bde0
test eax, eax
je 0x4595fd
push str.Failed_to_load_export_DeleteService_n
call fcn.0044bd70
mov ecx, eax
call fcn.0044c180
jmp 0x4595fd
call fcn.0044bde0
test eax, eax
je 0x4595fd
push str.Failed_to_load_export_ControlService_n
call fcn.0044bd70
mov ecx, eax
call fcn.0044c180
jmp 0x4595fd
call fcn.0044bde0
test eax, eax
je 0x4595fd
push str.Failed_to_load_export_QueryServiceStatus_n
call fcn.0044bd70
mov ecx, eax
call fcn.0044c180
jmp 0x4595fd
call fcn.0044bde0
test eax, eax
je 0x4595fd
push str.Failed_to_load_export_OpenServiceA_n
call fcn.0044bd70
mov ecx, eax
call fcn.0044c180
jmp 0x4595fd
call fcn.0044bde0
test eax, eax
je 0x4595fd
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
lea edx, [esp + 0x48]
push str.Failed_to_load_export_OpenSCManagerA_:_GetLastError_____d_n
push edx
call fcn.00471c30
add esp, 0xc
lea eax, [esp + 0x44]
push eax
call fcn.0044bd70
mov ecx, eax
call fcn.0044c180
jmp 0x4595fd
call fcn.0044bde0
test eax, eax
je 0x459608
push str.Failed_to_load_Advapi32.dll_file_n
call fcn.0044bd70
mov ecx, eax
call fcn.0044c180
jmp 0x459608
push 0xf003f
push str.ServicesActive
push 0
call dword [esp + 0x1c]
test eax, eax
mov dword [esp + 0x24], eax
je 0x4595fd
mov ecx, dword [esp + 0x248]
push 0xf01ff
push ecx
push eax
call ebx
mov esi, eax
test esi, esi
je 0x4595f4
lea edx, [esp + 0x28]
push edx
push esi
call dword [esp + 0x20]
test eax, eax
je 0x4595ef
cmp dword [esp + 0x2c], 4
jne 0x4595d5
lea eax, [esp + 0x28]
push eax
push 1
push esi
call ebp
test eax, eax
je 0x4595c5
mov ebp, dword [sym.imp.KERNEL32.dll_GetTickCount]
call ebp
mov dword [esp + 0x10], eax
mov eax, dword [esp + 0x2c]
cmp eax, 1
je 0x45953b
mov ebx, dword [sym.imp.KERNEL32.dll_Sleep]
push 0x3e8
call ebx
lea ecx, [esp + 0x28]
push ecx
push esi
call dword [esp + 0x20]
test eax, eax
je 0x45955c
cmp dword [esp + 0x2c], 1
je 0x45953b
call ebp
sub eax, dword [esp + 0x10]
cmp eax, 0x1388
ja 0x45959f
cmp dword [esp + 0x2c], 1
jne 0x45950b
mov eax, dword [esp + 0x24c]
test eax, eax
je 0x45954f
push esi
call dword [esp + 0x24]
test eax, eax
je 0x4595c5
mov dword [esp + 0x14], 1
jmp 0x4595ef
call fcn.0044bde0
test eax, eax
je 0x45958f
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
lea edx, [esp + 0x48]
push str.ERROR:_QueryServiceStatus_:_GetLastError_____d_n
push edx
call fcn.00471c30
add esp, 0xc
lea eax, [esp + 0x44]
push eax
call fcn.0044bd70
mov ecx, eax
call fcn.0044c180
call fcn.0044bde0
test eax, eax
je 0x4595ef
push str.ERROR:_Failed_to_completely_stop_service_n
jmp 0x4595e3
call fcn.0044bde0
test eax, eax
je 0x45958f
mov ecx, dword [esp + 0x2c]
lea edx, [esp + 0x44]
push ecx
push str.ERROR:_TimeOut_:_dwCurrentState_d_n
push edx
call fcn.00471c30
add esp, 0xc
lea eax, [esp + 0x44]
jmp 0x459582
call fcn.0044bde0
test eax, eax
je 0x4595ef
push str.FAILED_to_stop_service____Setting_for_Reboot_n
jmp 0x4595e3
call fcn.0044bde0
test eax, eax
je 0x4595ef
push str.FAILED_ControlService_:_Service_Not_Running_n
call fcn.0044bd70
mov ecx, eax
call fcn.0044c180
push esi
call dword [esp + 0x20]
mov ecx, dword [esp + 0x24]
push ecx
call dword [esp + 0x20]
push edi
call dword [sym.imp.KERNEL32.dll_FreeLibrary]
mov ebx, dword [esp + 0x14]
call fcn.0044bde0
test eax, eax
je 0x4596a1
push ebx
lea edx, [esp + 0x48]
push str.CService_::_StopAService_:_bRetVal___d_n
push edx
call fcn.00471c30
mov edi, str.EXIT:
or ecx, 0xffffffff
xor eax, eax
add esp, 0xc
repne scasb al, byte es:[edi]
not ecx
sub edi, ecx
lea edx, [esp + 0x144]
mov eax, ecx
mov esi, edi
mov edi, edx
lea edx, [esp + 0x144]
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, eax
xor eax, eax
and ecx, 3
rep movsb byte es:[edi], byte [esi]
lea edi, [esp + 0x44]
or ecx, 0xffffffff
repne scasb al, byte es:[edi]
not ecx
sub edi, ecx
mov esi, edi
mov ebp, ecx
mov edi, edx
or ecx, 0xffffffff
repne scasb al, byte es:[edi]
mov ecx, ebp
dec edi
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, ebp
lea eax, [esp + 0x144]
and ecx, 3
push eax
rep movsb byte es:[edi], byte [esi]
call fcn.0044bd70
mov ecx, eax
call fcn.0044c180
call fcn.0044bd70
mov ecx, eax
call fcn.0044be20
pop edi
pop esi
mov eax, ebx
pop ebp
pop ebx
add esp, 0x234
ret 8