Function at 0x406990
Capabilities:
Create process on windows

Disassembly:
sub esp, 0x68
push ebp
push esi
push edi
mov esi, ecx
push str.RunProcessAsSvc
push 0x40
mov dword [esp + 0x24], esi
call fcn.004062b0
xor eax, eax
mov ecx, 0x10
lea edi, [esp + 0x3c]
mov dword [esp + 0x38], 0x44
rep stosd dword es:[edi], eax
mov eax, dword [esi + 4]
xor ebp, ebp
add esp, 8
cmp eax, ebp
mov dword [esp + 0x14], ebp
jne 0x406a37
mov edi, dword [esp + 0x7c]
lea eax, [esp + 0x20]
push eax
lea ecx, [esp + 0x34]
push ecx
add esi, 0x22c
push esi
push ebp
push ebp
push 1
push ebp
push ebp
push edi
push ebp
call dword [sym.imp.KERNEL32.dll_CreateProcessA]
mov esi, eax
cmp esi, ebp
je 0x406a15
mov edx, dword [esp + 0x24]
mov edi, dword [sym.imp.KERNEL32.dll_CloseHandle]
push edx
call edi
mov eax, dword [esp + 0x20]
push eax
call edi
pop edi
mov eax, esi
pop esi
pop ebp
add esp, 0x68
ret 0xc
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push edi
push str.Failed_to_CreateProcess:_s_err0x_x
push 4
call fcn.004062b0
add esp, 0x10
pop edi
mov eax, esi
pop esi
pop ebp
add esp, 0x68
ret 0xc
cmp dword [esp + 0x80], 0xffffffff
push ebx
mov ebx, dword [sym.imp.KERNEL32.dll_GetProcAddress]
jne 0x406b67
push str.Wtsapi32.dll
call dword [sym.imp.KERNEL32.dll_LoadLibraryA]
mov ebp, eax
xor esi, esi
cmp ebp, esi
je 0x406b4f
push str.WTSEnumerateSessionsA
push ebp
call ebx
cmp eax, esi
je 0x406b46
lea ecx, [esp + 0x1c]
push ecx
lea edx, [esp + 0x14]
push edx
push 1
push esi
push esi
mov dword [esp + 0x24], esi
mov dword [esp + 0x30], esi
call eax
test eax, eax
je 0x406b11
mov eax, dword [esp + 0x1c]
xor edi, edi
cmp eax, esi
jbe 0x406af5
mov eax, dword [esp + 0x10]
mov ecx, dword [esi + eax + 8]
mov edx, dword [esi + eax + 4]
mov eax, dword [esi + eax]
push ecx
push edx
push eax
push edi
push str.SessionInfo__d_:_SessionId_d__WinStationName_s__State_d.
push 0x40
call fcn.004062b0
mov eax, dword [esp + 0x28]
mov ecx, dword [esi + eax + 8]
add esp, 0x18
test ecx, ecx
je 0x406ae8
cmp ecx, 1
jne 0x406ada
mov ecx, dword [esi + eax]
mov dword [esp + 0x84], ecx
mov ecx, dword [esp + 0x1c]
inc edi
add esi, 0xc
cmp edi, ecx
jb 0x406aa1
jmp 0x406af5
lea edx, [edi + edi*2]
mov eax, dword [eax + edx*4]
mov dword [esp + 0x84], eax
push str.WTSFreeMemory
push ebp
call ebx
test eax, eax
je 0x406b46
mov ecx, dword [esp + 0x10]
push ecx
call eax
push ebp
call dword [sym.imp.KERNEL32.dll_FreeLibrary]
jmp 0x406b65
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 0x6a6
jne 0x406b36
push str.The_Terminate_Service_not_running.
push 0x40
call fcn.004062b0
add esp, 8
push ebp
call dword [sym.imp.KERNEL32.dll_FreeLibrary]
jmp 0x406b65
push eax
push str.Failed_to_call_WTSEnumerateSessions:err0x_x
push 4
call fcn.004062b0
add esp, 0xc
push ebp
call dword [sym.imp.KERNEL32.dll_FreeLibrary]
jmp 0x406b65
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.Failed_to_LoadLibrary__Wtsapi32.dll__:err0x
push 4
call fcn.004062b0
add esp, 0xc
xor ebp, ebp
mov eax, 1
push str.DuplicateTokenEx
push str.Advapi32.dll
mov dword [esp + 0x44], str.WinSta0Default
mov word [esp + 0x6c], ax
mov dword [esp + 0x68], eax
call dword [sym.imp.KERNEL32.dll_GetModuleHandleA]
push eax
call ebx
mov edx, dword [esp + 0x84]
push edx
push str.SessionId___d
push 0x40
mov esi, eax
call fcn.004062b0
mov eax, dword [esp + 0x90]
add esp, 0xc
xor ecx, ecx
cmp eax, 0xffffffff
sete cl
lea edx, [esp + 0x14]
push edx
push 0xf00ff
mov dword [esp + 0x1c], ebp
dec ecx
and ecx, eax
mov dword [esp + 0x8c], ecx
call dword [sym.imp.KERNEL32.dll_GetCurrentProcess]
push eax
call dword [sym.imp.ADVAPI32.dll_OpenProcessToken]
test eax, eax
je 0x406ea1
mov ecx, dword [esp + 0x14]
lea eax, [esp + 0x10]
push eax
push 1
push 1
push ebp
push 0x2000000
push ecx
mov dword [esp + 0x28], ebp
call esi
test eax, eax
je 0x406c2c
mov eax, dword [esp + 0x10]
push 4
lea edx, [esp + 0x88]
push edx
push 0xc
push eax
call dword [sym.imp.ADVAPI32.dll_SetTokenInformation]
test eax, eax
jne 0x406c42
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.Failed_to_SetTokenInformation:err0x_x
jmp 0x406c38
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.Failed_to_DuplicateTokenEx:err0x_x
push 4
call fcn.004062b0
add esp, 0xc
mov ebx, dword [esp + 0x20]
mov edi, dword [esp + 0x80]
mov eax, dword [esp + 0x10]
lea ecx, [esp + 0x24]
push ecx
lea edx, [esp + 0x38]
push edx
add ebx, 0x22c
push ebx
push 0
push 0xc30
push 0
push 0
push 0
push edi
push 0
mov dword [esp + 0x44], ebp
push eax
mov ebp, 1
call dword [sym.imp.ADVAPI32.dll_CreateProcessAsUserA]
test eax, eax
jne 0x406e38
lea ebx, [ebx]
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov esi, eax
push esi
push edi
push str.Failed_to_call_CreateProcessAsUser:cmd_s_err0x_x.
push 4
call fcn.004062b0
add esp, 0x10
cmp esi, 0xe9
jne 0x406d73
mov eax, dword [esp + 0x1c]
inc eax
cmp eax, 0x1e
mov dword [esp + 0x1c], eax
jle 0x406d32
mov eax, dword [esp + 0x84]
test eax, eax
je 0x406d73
mov edx, dword [esp + 0x10]
push 4
lea ecx, [esp + 0x88]
push ecx
push 0xc
push edx
mov dword [esp + 0x94], 0
call dword [sym.imp.ADVAPI32.dll_SetTokenInformation]
test eax, eax
jne 0x406dfb
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.Failed_to_SetTokenInformation_0_:err0x_x
push 4
call fcn.004062b0
mov ecx, dword [esp + 0x1c]
mov esi, dword [sym.imp.KERNEL32.dll_CloseHandle]
add esp, 0xc
push ecx
call esi
mov edx, dword [esp + 0x14]
push edx
call esi
pop ebx
pop edi
pop esi
xor eax, eax
pop ebp
add esp, 0x68
ret 0xc
mov eax, dword [esp + 0x20]
mov ecx, dword [eax + 0x224]
push 0x3e8
push ecx
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
cmp eax, 0x102
je 0x406e0a
mov eax, dword [esp + 0x10]
mov esi, dword [sym.imp.KERNEL32.dll_CloseHandle]
push eax
call esi
mov ecx, dword [esp + 0x14]
push ecx
call esi
pop ebx
pop edi
pop esi
xor eax, eax
pop ebp
add esp, 0x68
ret 0xc
mov esi, dword [esp + 0x7c]
mov ecx, dword [esp + 0x10]
lea edx, [esp + 0x24]
push edx
lea eax, [esp + 0x38]
push eax
push ebx
push 0
push 0xc30
push 0
push 0
push 0
push edi
push esi
push ecx
call dword [sym.imp.ADVAPI32.dll_CreateProcessAsUserA]
test eax, eax
mov dword [esp + 0x18], eax
jne 0x406e38
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push edi
push esi
push str.Failed_to_call_CreateProcessAsUser_again:_appname___s_cmd_s_err0x_x.
push 4
call fcn.004062b0
add esp, 0x14
test ebp, ebp
je 0x406e7b
mov eax, dword [esp + 0x84]
test eax, eax
je 0x406e7b
mov eax, dword [esp + 0x10]
push 4
lea edx, [esp + 0x88]
push edx
push 0xc
xor ebp, ebp
push eax
mov dword [esp + 0x94], ebp
call dword [sym.imp.ADVAPI32.dll_SetTokenInformation]
test eax, eax
je 0x406e65
push str.CreateProcessAsUser_to_change_session_0.
push 4
call fcn.004062b0
add esp, 8
mov eax, dword [esp + 0x10]
lea ecx, [esp + 0x24]
push ecx
lea edx, [esp + 0x38]
push edx
push ebx
push 0
push 0xc30
push 0
push 0
push 0
push edi
push 0
push eax
call dword [sym.imp.ADVAPI32.dll_CreateProcessAsUserA]
test eax, eax
je 0x406c90
push str.Successed_to_CreateProcessAsUser.
push 0x40
mov dword [esp + 0x20], 1
call fcn.004062b0
mov edx, dword [esp + 0x30]
mov esi, dword [sym.imp.KERNEL32.dll_CloseHandle]
add esp, 8
push edx
call esi
mov eax, dword [esp + 0x24]
push eax
call esi
jmp 0x406e81
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.Failed_to_SetTokenInformation_0_:err0x_x
push 4
call fcn.004062b0
add esp, 0xc
mov esi, dword [sym.imp.KERNEL32.dll_CloseHandle]
mov eax, dword [esp + 0x10]
test eax, eax
je 0x406e8c
push eax
call esi
mov ecx, dword [esp + 0x14]
push ecx
call esi
mov eax, dword [esp + 0x18]
pop ebx
pop edi
pop esi
pop ebp
add esp, 0x68
ret 0xc
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.Fail_to_OpenProcessToken__0x_x
push 4
call fcn.004062b0
mov eax, dword [esp + 0x24]
add esp, 0xc
pop ebx
pop edi
pop esi
pop ebp
add esp, 0x68
ret 0xc