Function at 0x10012f6
Capabilities:
Check if file exists
Create process on windows
Get common file path
Get file attributes
Query environment variable
Set current directory
Terminate process
Write and execute a file
Write file on windows

Disassembly:
mov edi, edi
push ebp
mov ebp, esp
sub esp, 0x88
push ebx
push esi
push edi
call dword [sym.imp.KERNEL32.dll_GetConsoleOutputCP]
cmp eax, 0x3a4
mov dword [0x10028a0], 0x100200c
mov dword [0x10028a4], 0x1002000
mov dword [0x10028a8], 0x1002018
je 0x100134b
cmp eax, 0x3a8
je 0x100134b
cmp eax, 0x3b4
jbe 0x1001344
cmp eax, 0x3b6
jbe 0x100134b
push 0x409
jmp 0x100135c
call dword [sym.imp.KERNEL32.dll_GetSystemDefaultLangID]
and eax, 0x3ff
or eax, 0x400
push eax
call dword [sym.imp.KERNEL32.dll_SetThreadLocale]
xor ebx, ebx
mov dword [ebp - 0x1c], ebx
mov dword [ebp - 0x20], ebx
mov dword [ebp - 0xc], ebx
mov eax, dword fs:[0x18]
add eax, 0xbf8
cmp dword [ebp + 8], 1
mov dword [ebp - 0x24], eax
jle 0x100145c
dec dword [ebp + 8]
je 0x100145c
mov esi, dword [ebp + 0xc]
add esi, 4
cmp dword [ebp - 0x1c], ebx
mov edi, dword [esi]
jne 0x1001404
mov al, byte [edi]
cmp al, 0x2f
je 0x10013d7
cmp al, 0x2d
je 0x10013d7
mov eax, edi
mov dword [ebp - 0x1c], edi
lea edx, [eax + 1]
mov cl, byte [eax]
inc eax
test cl, cl
jne 0x10013ad
sub eax, edx
mov ebx, eax
cmp ebx, 0x7fffffff
ja 0x10013d1
push ebx
push edi
push 0x105
push 0x10028c0
call fcn.010011bb
inc ebx
mov dword [ebp - 0xc], ebx
jmp 0x1001448
inc edi
mov al, byte [edi]
cmp al, 0x3f
je 0x100145c
cmp al, 0x44
je 0x10013e6
cmp al, 0x64
jne 0x100145c
inc edi
cmp byte [edi], 0
je 0x10013f1
mov dword [ebp - 0x20], edi
jmp 0x100144a
dec dword [ebp + 8]
cmp dword [ebp + 8], 1
jle 0x100145c
add esi, 4
mov eax, dword [esi]
mov dword [ebp - 0x20], eax
jmp 0x100144a
mov eax, edi
lea edx, [eax + 1]
mov cl, byte [eax]
inc eax
test cl, cl
jne 0x1001409
sub eax, edx
cmp dword [ebp - 0xc], 0
mov ebx, eax
je 0x100142e
push 0x10010e8
push 0x105
push 0x10028c0
call fcn.010012be
push edi
push 0x105
push 0x10028c0
call fcn.010012be
mov eax, dword [ebp - 0xc]
lea eax, [eax + ebx + 1]
mov dword [ebp - 0xc], eax
xor ebx, ebx
dec dword [ebp + 8]
jne 0x1001391
cmp dword [ebp - 0x1c], ebx
jne 0x10014e3
push 0x14
mov word [ebp - 8], bx
mov word [ebp - 6], 0x200
mov dword [ebp - 4], 0x10024a0
mov word [ebp - 0x14], bx
mov dword [ebp - 0x10], 0x10026a0
mov word [ebp - 0x12], 0x200
pop edi
push 0x100
push dword [ebp - 0x10]
push edi
push ebx
call dword [sym.imp.USER32.dll_LoadStringW]
shl eax, 1
mov word [ebp - 0x14], ax
push ebx
lea eax, [ebp - 0x14]
push eax
lea eax, [ebp - 8]
push eax
call dword [sym.imp.ntdll.dll_RtlUnicodeStringToOemString]
test eax, eax
jl 0x10014d9
push ebx
lea eax, [ebp - 0x18]
push eax
movzx eax, word [ebp - 8]
push eax
push dword [ebp - 4]
push 0xfffffffffffffff5
call dword [sym.imp.KERNEL32.dll_GetStdHandle]
push eax
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x10014d9
movzx eax, word [ebp - 8]
cmp dword [ebp - 0x18], eax
jne 0x10014d9
inc edi
cmp edi, 0x18
jbe 0x1001481
push 0xff
jmp 0x10016c7
cmp dword [ebp - 0x20], ebx
mov edi, dword [sym.imp.ntdll.dll_RtlInitString]
mov ebx, dword [sym.imp.ntdll.dll_RtlOemStringToUnicodeString]
je 0x1001545
push dword [ebp - 0x20]
lea eax, [ebp - 8]
push eax
call edi
and word [ebp - 0x14], 0
push 0
lea eax, [ebp - 8]
push eax
lea eax, [ebp - 0x14]
mov esi, 0x1002060
push eax
mov word [ebp - 0x12], 0x20a
mov dword [ebp - 0x10], esi
call ebx
test eax, eax
jge 0x100152c
push 0xff
push 3
jmp 0x100160f
push esi
call dword [sym.imp.KERNEL32.dll_GetFileAttributesW]
cmp eax, 0xffffffff
je 0x1001520
test al, 0x10
je 0x1001520
push esi
call dword [sym.imp.KERNEL32.dll_SetCurrentDirectoryW]
jmp 0x1001555
push 0x1002060
push 0x105
call dword [sym.imp.KERNEL32.dll_GetCurrentDirectoryW]
push dword [ebp - 0x1c]
mov esi, 0x10029e0
push 0x105
push esi
call fcn.01001179
push 0x103
push 0x1002284
push 0x10010dc
mov word [0x1002280], 0x2e
mov word [0x1002282], 0x3b
call dword [sym.imp.KERNEL32.dll_GetEnvironmentVariableW]
push esi
lea eax, [ebp - 8]
push eax
call edi
mov esi, dword [ebp - 0x24]
push 0
lea eax, [ebp - 8]
push eax
push esi
call ebx
test eax, eax
jge 0x10015af
push 0xff
push 1
jmp 0x100160f
and dword [ebp + 8], 0
push 0x2e
push dword [esi + 4]
call dword [sym.imp.ntdll.dll_wcschr]
neg eax
sbb eax, eax
and eax, 0xfffffffe
pop ecx
add eax, 3
pop ecx
mov dword [ebp - 0x18], eax
je 0x1001608
mov esi, 0x1002b00
lea eax, [ebp - 0x2c]
push eax
mov eax, dword [ebp + 8]
push esi
push 0x105
push dword [eax*4 + 0x10028a0]
mov eax, dword [ebp - 0x24]
push dword [eax + 4]
push 0x1002280
call dword [sym.imp.KERNEL32.dll_SearchPathW]
test eax, eax
jne 0x1001614
inc dword [ebp + 8]
mov eax, dword [ebp + 8]
cmp eax, dword [ebp - 0x18]
jb 0x10015d4
push 0xff
push 0
call fcn.01001244
push esi
call dword [sym.imp.KERNEL32.dll_GetFileAttributesW]
cmp eax, 0xffffffff
je 0x1001608
test al, 0x10
jne 0x1001608
movzx eax, word [ebp - 8]
add eax, dword [ebp - 0xc]
cmp eax, 0x7d
jbe 0x1001639
push 0xff
push 2
jmp 0x100160f
push 0x10028c0
lea eax, [ebp - 0x34]
push eax
call edi
push 0
lea eax, [ebp - 0x34]
push eax
push dword [ebp - 0x24]
call ebx
test eax, eax
jl 0x1001630
push 0x11
pop ecx
xor eax, eax
lea edi, [ebp - 0x88]
rep stosd dword es:[edi], eax
lea eax, [ebp - 0x44]
push eax
lea eax, [ebp - 0x88]
push eax
push 0x1002060
xor eax, eax
push eax
push 0x2000
push 1
push eax
push eax
mov eax, dword [ebp - 0x24]
mov dword [ebp - 0x88], 0x44
push dword [eax + 4]
push esi
call dword [sym.imp.KERNEL32.dll_CreateProcessW]
test eax, eax
jne 0x10016a3
push 0xff
push 8
jmp 0x100160f
push 0xffffffffffffffff
push dword [ebp - 0x44]
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
lea eax, [ebp - 0x28]
push eax
push dword [ebp - 0x44]
call dword [sym.imp.KERNEL32.dll_GetExitCodeProcess]
push dword [ebp - 0x44]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
push dword [ebp - 0x28]
call dword [sym.imp.KERNEL32.dll_ExitProcess]