Function at 0x401240
Capabilities:
Create a process with modified i/o handles and window
Create process on windows
Get file size
Write and execute a file
Write file on windows

Disassembly:
mov edi, edi
push ebp
mov ebp, esp
and esp, 0xfffffff8
sub esp, 0x264
mov eax, dword [0x40d040]
mov edx, dword [ebp + 0x10]
mov dword [esp + 0x260], eax
mov eax, dword [ebp + 0x14]
push ebx
mov dword [esp + 0x14], eax
mov eax, dword [ebp + 8]
test eax, eax
push esi
push edi
mov esi, ecx
je 0x40127f
lea edi, [esi + 0x10]
sub edi, eax
mov cl, byte [eax]
mov byte [edi + eax], cl
inc eax
test cl, cl
jne 0x401275
xor eax, eax
test edx, edx
mov ebx, 1
mov ecx, 0x11
lea edi, [esp + 0x20]
rep stosd dword es:[edi], eax
mov cx, word [ebp + 0xc]
mov dword [esp + 0x14], ebx
mov dword [esp + 0x4c], ebx
mov ebx, dword [sym.imp.KERNEL32.dll_CreateFileA]
mov dword [esp + 0xc], 0xc
mov dword [esp + 0x10], 0
mov dword [esp + 0x20], 0x44
mov word [esp + 0x50], cx
je 0x40139d
push eax
push 0x80
push 2
lea eax, [esp + 0x18]
push eax
push 3
push 0xc0000000
push edx
mov dword [esp + 0x68], 0x101
call ebx
cmp eax, 0xffffffff
mov dword [esi + 8], eax
jne 0x401306
xor eax, eax
mov ecx, dword [esp + 0x26c]
call fcn.0040297e
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 0x10
push 0
push eax
mov dword [esp + 0x64], eax
call dword [sym.imp.KERNEL32.dll_GetFileSize]
test eax, eax
je 0x40139d
mov ecx, dword [esi + 8]
push 2
push 0
push 0
push ecx
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
lea edx, [esp + 0xe8]
xor eax, eax
mov ecx, 0x40
lea edi, [esp + 0x168]
push edx
rep stosd dword es:[edi], eax
call fcn.004028dc
lea eax, [esp + 0x6c]
push eax
call fcn.00402867
lea ecx, [esp + 0xf0]
push ecx
lea edx, [esp + 0x74]
push edx
lea eax, [esp + 0x178]
push str.__s__s__r_n
push eax
call dword [sym.imp.USER32.dll_wsprintfA]
add esp, 0x18
push 0
lea ecx, [esp + 0x1c]
push ecx
lea edx, [esp + 0x170]
push edx
call dword [sym.imp.KERNEL32.dll_lstrlenA]
mov ecx, dword [esi + 8]
push eax
lea eax, [esp + 0x174]
push eax
push ecx
call dword [sym.imp.KERNEL32.dll_WriteFile]
mov eax, dword [esp + 0x1c]
test eax, eax
je 0x401477
mov edx, dword [esp + 0x4c]
mov ecx, 0x100
test ecx, edx
jne 0x4013bc
or edx, ecx
mov dword [esp + 0x4c], edx
push 0
push 0x80
push 4
lea edx, [esp + 0x18]
push edx
push 3
push 0xc0000000
push eax
call ebx
cmp eax, 0xffffffff
mov dword [esi + 4], eax
je 0x4012ef
push 0
push eax
mov dword [esp + 0x68], eax
call dword [sym.imp.KERNEL32.dll_GetFileSize]
test eax, eax
je 0x401477
mov eax, dword [esi + 4]
push 2
push 0
push 0
push eax
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
xor eax, eax
mov ecx, 0x40
lea edi, [esp + 0x168]
rep stosd dword es:[edi], eax
lea ecx, [esp + 0x68]
push ecx
call fcn.004028dc
lea edx, [esp + 0xec]
push edx
call fcn.00402867
lea eax, [esp + 0x70]
push eax
lea ecx, [esp + 0xf4]
push ecx
lea edx, [esp + 0x178]
push str.__s__s__r_n
push edx
call dword [sym.imp.USER32.dll_wsprintfA]
add esp, 0x18
push 0
lea eax, [esp + 0x1c]
push eax
lea ecx, [esp + 0x170]
push ecx
call dword [sym.imp.KERNEL32.dll_lstrlenA]
push eax
mov eax, dword [esi + 4]
lea edx, [esp + 0x174]
push edx
push eax
call dword [sym.imp.KERNEL32.dll_WriteFile]
mov ecx, dword [esi + 0x114]
test ecx, ecx
mov eax, 0x20
je 0x40148b
mov eax, 0x30
lea ecx, [esi + 0x118]
push ecx
lea edx, [esp + 0x24]
push edx
push 0
push 0
push eax
push 1
lea eax, [esp + 0x24]
push eax
mov ecx, eax
push ecx
add esi, 0x10
push esi
push 0
call dword [sym.imp.KERNEL32.dll_CreateProcessA]
mov ecx, dword [esp + 0x26c]
neg eax
sbb eax, eax
neg eax
call fcn.0040297e
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 0x10