Function at 0x40d781
Capabilities:
Create a process with modified i/o handles and window
Create pipe
Create process on windows

Disassembly:
sub esp, 0xc0
push ebx
push ebp
push esi
push edi
push 0x20
xor eax, eax
mov dword [esp + 0x38], 0xc
pop ebp
push 0x44
pop esi
push esi
push eax
mov dword [esp + 0x18], eax
mov edi, eax
mov dword [esp + 0x28], eax
xor ebx, ebx
mov dword [esp + 0x30], eax
inc ebx
mov dword [esp + 0x1c], eax
mov dword [esp + 0x24], eax
mov dword [esp + 0x20], eax
mov dword [esp + 0x2c], eax
mov dword [esp + 0x40], eax
lea eax, [esp + 0x58]
push eax
mov dword [esp + 0x48], ebx
call sub.MSVCRT.dll_memset
mov dword [esp + 0x88], ebx
add esp, 0xc
mov ebx, dword [esp + 0xe0]
xor ecx, ecx
mov dword [esp + 0x50], esi
test bl, 2
je 0x40d7fc
xor eax, eax
inc ecx
push 0x30
mov word [esp + 0x84], ax
pop ebp
jmp 0x40d805
inc ecx
mov word [esp + 0x80], cx
mov esi, dword [sym.imp.KERNEL32.dll_CreatePipe]
test bl, 0x40
je 0x40d837
mov eax, dword [esp + 0xe4]
test eax, eax
je 0x40d837
mov eax, dword [eax + 0xc]
test eax, eax
je 0x40d837
mov dword [esp + 0x7c], 0x101
mov dword [esp + 0x88], eax
mov dword [esp + 0x24], ecx
jmp 0x40d87f
test bl, 4
je 0x40d882
test bl, 0x10
je 0x40d882
xor eax, eax
push eax
lea eax, [esp + 0x38]
push eax
lea eax, [esp + 0x28]
push eax
lea eax, [esp + 0x1c]
push eax
call esi
test eax, eax
je 0x40d882
mov eax, dword [esp + 0x10]
or dword [esp + 0x7c], 0x100
mov dword [esp + 0x88], eax
lea eax, [esp + 0x20]
push eax
call fcn.0040d711
pop ecx
mov dword [esp + 0x24], 1
and ebp, 0xffffffef
mov eax, ebx
and eax, 4
mov dword [esp + 0x30], eax
je 0x40d91d
test bl, 8
je 0x40d8d7
xor eax, eax
push eax
lea eax, [esp + 0x38]
push eax
lea eax, [esp + 0x1c]
push eax
lea eax, [esp + 0x34]
push eax
call esi
test eax, eax
je 0x40d8d7
mov eax, dword [esp + 0x14]
or dword [esp + 0x7c], 0x100
mov dword [esp + 0x8c], eax
lea eax, [esp + 0x28]
push eax
call fcn.0040d711
pop ecx
and ebp, 0xffffffef
mov dword [esp + 0x24], 1
test bl, 0x20
je 0x40d91d
xor eax, eax
push eax
lea eax, [esp + 0x38]
push eax
lea eax, [esp + 0x20]
push eax
lea eax, [esp + 0x28]
push eax
call esi
test eax, eax
je 0x40d91d
mov eax, dword [esp + 0x18]
or dword [esp + 0x7c], 0x100
mov dword [esp + 0x90], eax
lea eax, [esp + 0x1c]
push eax
call fcn.0040d711
pop ecx
and ebp, 0xffffffef
mov dword [esp + 0x24], 1
test dword [esp + 0x7c], 0x100
je 0x40d969
mov esi, dword [sym.imp.KERNEL32.dll_GetStdHandle]
cmp dword [esp + 0x88], edi
jne 0x40d941
push 0xfffffffffffffff6
call esi
mov dword [esp + 0x88], eax
cmp dword [esp + 0x8c], edi
jne 0x40d955
push 0xfffffffffffffff5
call esi
mov dword [esp + 0x8c], eax
cmp dword [esp + 0x90], edi
jne 0x40d969
push 0xfffffffffffffff4
call esi
mov dword [esp + 0x90], eax
mov ebx, dword [esp + 0xd4]
mov eax, section..rdata
test ebx, ebx
jne 0x40d97b
mov ebx, eax
cmp dword [esp + 0xd8], edi
jne 0x40d98b
mov dword [esp + 0xd8], eax
push ebx
call sub.MSVCRT.dll_wcslen
push dword [esp + 0xdc]
mov esi, eax
call sub.MSVCRT.dll_wcslen
add esi, eax
pop ecx
pop ecx
lea eax, [esi*2 + 8]
push eax
xor eax, eax
push eax
push dword [0x43c8bc]
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
cmp word [ebx], 0x22
mov esi, eax
mov dword [esp + 0x2c], esi
je 0x40d9e8
push 0x41e004
push esi
call sub.MSVCRT.dll_wcscpy
push ebx
push esi
call sub.MSVCRT.dll_wcscat
push 0x41e004
push esi
call sub.MSVCRT.dll_wcscat
add esp, 0x18
jmp 0x40d9f1
push ebx
push esi
call sub.MSVCRT.dll_wcscpy
pop ecx
pop ecx
mov eax, dword [esp + 0xd8]
xor edx, edx
cmp word [eax], dx
je 0x40da1c
push 0x41e008
push esi
call sub.MSVCRT.dll_wcscat
push dword [esp + 0xe0]
push esi
call sub.MSVCRT.dll_wcscat
add esp, 0x10
xor edx, edx
mov ecx, dword [esp + 0xdc]
test ecx, ecx
je 0x40da37
movzx eax, word [ecx]
neg eax
sbb eax, eax
and ecx, eax
mov dword [esp + 0xdc], ecx
lea eax, [esp + 0x40]
push eax
lea eax, [esp + 0x54]
push eax
push ecx
push edx
push ebp
push dword [esp + 0x38]
push edx
push edx
push esi
push edx
call dword [sym.imp.KERNEL32.dll_CreateProcessW]
test eax, eax
je 0x40db00
mov esi, dword [sym.imp.KERNEL32.dll_CloseHandle]
cmp dword [esp + 0x14], edi
je 0x40da6c
push dword [esp + 0x14]
call esi
cmp dword [esp + 0x10], edi
je 0x40da78
push dword [esp + 0x10]
call esi
cmp dword [esp + 0x18], edi
je 0x40da84
push dword [esp + 0x18]
call esi
push dword [esp + 0x44]
call esi
mov ebx, dword [esp + 0xe0]
test bl, 1
je 0x40daa2
push 0xffffffffffffffff
push dword [esp + 0x44]
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
cmp dword [esp + 0x30], edi
je 0x40daf5
mov esi, 0x43cf74
push esi
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
push 0x20
push 0x43c930
call fcn.0041ca82
pop ecx
pop ecx
push esi
mov edi, eax
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov eax, dword [esp + 0x40]
mov dword [edi], eax
mov eax, dword [esp + 0x48]
mov dword [edi + 4], eax
mov eax, dword [esp + 0x28]
mov dword [edi + 0xc], eax
mov eax, dword [esp + 0x20]
mov dword [edi + 8], eax
mov eax, dword [esp + 0x1c]
mov dword [edi + 0x10], eax
mov dword [edi + 0x14], ebx
jmp 0x40dc8c
push dword [esp + 0x40]
call esi
jmp 0x40dc89
mov ebp, dword [sym.imp.KERNEL32.dll_CloseHandle]
cmp dword [esp + 0x14], edi
je 0x40db12
push dword [esp + 0x14]
call ebp
cmp dword [esp + 0x28], edi
je 0x40db1e
push dword [esp + 0x28]
call ebp
cmp dword [esp + 0x20], edi
je 0x40db2a
push dword [esp + 0x20]
call ebp
cmp dword [esp + 0x10], edi
je 0x40db36
push dword [esp + 0x10]
call ebp
cmp dword [esp + 0x18], edi
je 0x40db42
push dword [esp + 0x18]
call ebp
cmp dword [esp + 0x1c], edi
je 0x40db4e
push dword [esp + 0x1c]
call ebp
test byte [esp + 0xe0], 0x78
jne 0x40dc8c
cmp dword [esp + 0xdc], edi
jne 0x40dba9
push ebx
call sub.MSVCRT.dll_wcslen
pop ecx
lea esi, [eax - 1]
lea esi, [ebx + esi*2]
cmp esi, ebx
jbe 0x40dba9
cmp word [esi], 0x5c
je 0x40db83
sub esi, 2
cmp esi, ebx
ja 0x40db76
cmp esi, ebx
jbe 0x40dba9
push ebx
push dword [esp + 0x30]
call sub.MSVCRT.dll_wcscpy
mov eax, dword [esp + 0x34]
sub esi, ebx
pop ecx
sar esi, 1
pop ecx
xor ecx, ecx
mov dword [esp + 0xdc], eax
mov word [eax + esi*2 + 2], cx
push 0x3c
pop esi
xor eax, eax
push esi
push eax
lea eax, [esp + 0x9c]
push eax
call sub.MSVCRT.dll_memset
movzx eax, word [esp + 0x8c]
add esp, 0xc
mov dword [esp + 0xb0], eax
xor eax, eax
mov dword [esp + 0xa0], eax
mov eax, dword [esp + 0xdc]
mov dword [esp + 0xac], eax
mov eax, dword [esp + 0xd8]
mov dword [esp + 0xa8], eax
lea eax, [esp + 0x94]
push eax
mov dword [esp + 0x98], esi
mov dword [esp + 0x9c], 0x540
mov dword [esp + 0xa8], ebx
call dword [sym.imp.SHELL32.DLL_ShellExecuteExW]
test eax, eax
je 0x40dc8c
mov ebx, dword [esp + 0xe0]
test bl, 1
je 0x40dc3a
push 0xffffffffffffffff
push dword [esp + 0xd0]
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
cmp dword [esp + 0x30], edi
je 0x40dc80
mov esi, 0x43cf74
push esi
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
push 0x20
push 0x43c930
call fcn.0041ca82
pop ecx
pop ecx
push esi
mov edi, eax
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov eax, dword [esp + 0xcc]
or dword [edi + 4], 0xffffffff
mov dword [edi], eax
xor eax, eax
mov dword [edi + 0xc], eax
mov dword [edi + 8], eax
mov dword [edi + 0x10], eax
mov dword [edi + 0x14], ebx
jmp 0x40dc8e
push dword [esp + 0xcc]
call ebp
xor edi, edi
inc edi
xor eax, eax
push dword [esp + 0x2c]
push eax
push dword [0x43c8bc]
call dword [sym.imp.KERNEL32.dll_HeapFree]
mov eax, edi
pop edi
pop esi
pop ebp
pop ebx
add esp, 0xc0
ret 0x14