Function at 0x401682
Capabilities:
Create process on windows
Resume thread
Spoof parent pid

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
sub esp, 0x64
push ebx
push esi
push edi
mov ebx, ecx
xor edi, edi
lea ecx, [esp + 0x10]
mov dword [esp + 0x10], edi
mov dword [esp + 0xc], edi
call fcn.00401f1a
test eax, eax
jne 0x401915
test byte [0x405370], 2
je 0x401711
mov ecx, dword [esp + 0x10]
lea edx, [esp + 0xc]
call fcn.00402027
mov esi, eax
test esi, esi
je 0x4016d8
push dword [esp + 0x10]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov eax, esi
jmp 0x401915
call dword [sym.imp.KERNEL32.dll_WTSGetActiveConsoleSessionId]
mov dword [esp + 0x14], eax
cmp eax, 0xffffffff
je 0x4016fa
push 4
lea eax, [esp + 0x18]
push eax
push 0xc
push dword [esp + 0x18]
call dword [sym.imp.ADVAPI32.dll_SetTokenInformation]
mov edx, dword [0x405370]
xor ecx, ecx
inc ecx
shr edx, 2
and edx, ecx
mov ecx, dword [esp + 0xc]
call fcn.00401cce
push 0x48
pop esi
push esi
lea eax, [esp + 0x2c]
push edi
push eax
call sub.msvcrt.dll_memset
xor ecx, ecx
mov dword [esp + 0x34], esi
inc ecx
add esp, 0xc
test byte [0x405370], 2
mov dword [esp + 0x54], ecx
mov word [esp + 0x58], cx
jne 0x401790
mov esi, dword [sym.imp.KERNEL32.dll_InitializeProcThreadAttributeList]
lea eax, [esp + 0x14]
push eax
push edi
push ecx
push edi
mov dword [esp + 0x24], edi
call esi
push dword [esp + 0x14]
push 8
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
lea ecx, [esp + 0x14]
mov dword [esp + 0x6c], eax
push ecx
xor ecx, ecx
push edi
inc ecx
push ecx
push eax
call esi
push edi
push edi
push 4
lea eax, [esp + 0x1c]
push eax
push 0x20000
push edi
push dword [esp + 0x84]
call dword [sym.imp.KERNEL32.dll_UpdateProcThreadAttribute]
xor eax, eax
lea edi, [esp + 0x18]
stosd dword es:[edi], eax
mov esi, 0x80014
push 0
pop ecx
stosd dword es:[edi], eax
stosd dword es:[edi], eax
stosd dword es:[edi], eax
mov eax, dword [0x405370]
test al, 2
mov edi, dword [sym.imp.msvcrt.dll_wprintf]
cmovne esi, ecx
test al, 4
je 0x4017be
push 0x403148
call edi
pop ecx
lea eax, [esp + 0x18]
push eax
lea eax, [esp + 0x2c]
push eax
xor eax, eax
push eax
push eax
push esi
push eax
push eax
push eax
push ebx
push eax
push dword [esp + 0x34]
call dword [sym.imp.ADVAPI32.dll_CreateProcessAsUserW]
mov dword [esp + 0x14], eax
test eax, eax
je 0x4017e8
xor ebx, ebx
jmp 0x4017f0
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov ebx, eax
test byte [0x405370], 2
mov esi, dword [sym.imp.KERNEL32.dll_CloseHandle]
je 0x401807
push dword [esp + 0xc]
call esi
jmp 0x401824
push dword [esp + 0x6c]
call dword [sym.imp.KERNEL32.dll_DeleteProcThreadAttributeList]
push dword [esp + 0x6c]
push 0
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call dword [sym.imp.KERNEL32.dll_HeapFree]
push dword [esp + 0x10]
call esi
cmp dword [esp + 0x14], 0
je 0x401903
mov eax, dword [0x405370]
test al, 2
jne 0x401880
and dword [esp + 0x14], 0
lea eax, [esp + 0x14]
push eax
push 0x28
push dword [esp + 0x20]
call dword [sym.imp.ADVAPI32.dll_OpenProcessToken]
mov edx, dword [0x405370]
xor eax, eax
mov ecx, dword [esp + 0x14]
inc eax
shr edx, 2
and edx, eax
call fcn.00401cce
push dword [esp + 0x14]
call esi
push dword [esp + 0x1c]
call dword [sym.imp.KERNEL32.dll_ResumeThread]
mov eax, dword [0x405370]
push 4
pop ebx
test bl, al
je 0x401899
push dword [esp + 0x20]
push str._D__Created_process_ID:__lu_n
call edi
mov eax, dword [0x405370]
pop ecx
pop ecx
test al, 8
je 0x4018f3
test bl, al
je 0x4018a9
push str._D__Waiting_for_process_to_exit_n
call edi
pop ecx
push 0xffffffffffffffff
push dword [esp + 0x1c]
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
test byte [0x405370], bl
je 0x4018c5
push str._D__Process_exited_n
call edi
pop ecx
lea eax, [esp + 0x14]
push eax
push dword [esp + 0x1c]
call dword [sym.imp.KERNEL32.dll_GetExitCodeProcess]
test eax, eax
je 0x4018f3
mov eax, dword [esp + 0x14]
mov dword [0x405368], eax
test byte [0x405370], bl
je 0x4018f3
push eax
push str._D__Process_exit_code:__ld_n
call edi
pop ecx
pop ecx
push dword [esp + 0x18]
call esi
push dword [esp + 0x1c]
call esi
xor eax, eax
jmp 0x401915
push 0
mov edx, ebx
mov ecx, str.Process_creation_failed
call fcn.00401c1c
pop ecx
push 4
pop eax
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret