Function at 0x401000
Capabilities:
Create process on windows
Query environment variable

Disassembly:
sub esp, 0x48c
push ebx
push ebp
push esi
push edi
mov edi, dword [esp + 0x4a0]
xor ebp, ebp
push edi
push str.argc_d_n
mov dword [esp + 0x20], ebp
call fcn.00401570
mov ebx, dword [esp + 0x4ac]
mov esi, 1
add esp, 8
cmp edi, esi
jle 0x401054
lea ebp, [ebx + 4]
mov eax, dword [ebp]
push eax
push esi
push str.argv__d__s_n
call fcn.00401570
add esp, 0xc
inc esi
add ebp, 4
cmp esi, edi
jl 0x401038
xor ebp, ebp
cmp edi, 6
jge 0x401076
mov ecx, dword [ebx]
push ecx
push str.Usage:__s__4_InheritableEventHandles___CommandLineToSpawn__n
call fcn.00401946
add esp, 8
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x48c
ret
cmp edi, 5
mov byte [esp + 0x8c], 0
jle 0x4010fa
add edi, 0xfffffffb
lea edx, [ebx + 0x14]
mov dword [esp + 0x10], edi
mov edi, dword [edx]
or ecx, 0xffffffff
xor eax, eax
lea ebp, [esp + 0x8c]
repne scasb al, byte es:[edi]
not ecx
sub edi, ecx
add edx, 4
mov esi, edi
mov edi, ebp
mov ebp, ecx
or ecx, 0xffffffff
repne scasb al, byte es:[edi]
mov ecx, ebp
dec edi
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, ebp
lea ebp, [esp + 0x8c]
and ecx, 3
rep movsb byte es:[edi], byte [esi]
mov edi, 0x408388
or ecx, 0xffffffff
repne scasb al, byte es:[edi]
not ecx
sub edi, ecx
mov esi, edi
mov edi, ebp
mov ebp, ecx
or ecx, 0xffffffff
repne scasb al, byte es:[edi]
mov ecx, ebp
dec edi
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov eax, dword [esp + 0x10]
mov ecx, ebp
and ecx, 3
dec eax
rep movsb byte es:[edi], byte [esi]
mov dword [esp + 0x10], eax
jne 0x40108d
xor ebp, ebp
lea edx, [esp + 0x8c]
push edx
push str.UnExpanded_cmdline_s_n
call fcn.00401570
add esp, 8
lea eax, [esp + 0x294]
lea ecx, [esp + 0x8c]
mov byte [esp + 0x294], 0
push 0x208
push eax
push ecx
call dword [sym.imp.KERNEL32.dll_ExpandEnvironmentStringsA]
lea edx, [esp + 0x294]
push edx
push str.Expanded_cmdline_s_n
call fcn.00401570
mov esi, dword [sym.imp.KERNEL32.dll_GetStdHandle]
mov ecx, 0x10
xor eax, eax
lea edi, [esp + 0x54]
rep stosd dword es:[edi], eax
add esp, 8
mov dword [esp + 0x20], eax
mov dword [esp + 0x24], eax
mov dword [esp + 0x1c], ebp
push 0xfffffffffffffff6
mov dword [esp + 0x2c], eax
mov dword [esp + 0x30], ebp
mov dword [esp + 0x4c], 0x44
mov dword [esp + 0x78], 0x180
call esi
push 0xfffffffffffffff5
mov dword [esp + 0x84], eax
call esi
push 0xfffffffffffffff4
mov dword [esp + 0x88], eax
call esi
mov edx, dword [esp + 0x80]
lea ecx, [esp + 0x14]
push ecx
push edx
mov dword [esp + 0x90], eax
mov dword [esp + 0x1c], ebp
call dword [sym.imp.KERNEL32.dll_GetConsoleMode]
test eax, eax
je 0x4011f7
mov esi, dword [esp + 0x14]
mov eax, dword [esp + 0x80]
and esi, 0xfffffff8
push esi
push eax
call dword [sym.imp.KERNEL32.dll_SetConsoleMode]
test eax, eax
je 0x4011e9
mov ecx, dword [esp + 0x14]
push esi
push ecx
push str.Chg_console_mode_from_x_x_to_x_x_n
call fcn.00401570
add esp, 0xc
jmp 0x40120b
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.Err__d__SetConsoleMode___n
jmp 0x401203
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.Err__d__GetConsoleMode___n
call fcn.00401570
add esp, 8
push 1
push 0x401810
call dword [sym.imp.KERNEL32.dll_SetConsoleCtrlHandler]
mov edx, dword [ebx + 4]
push edx
call fcn.0040193b
mov dword [esp + 0x3c], eax
mov eax, dword [ebx + 8]
push eax
call fcn.0040193b
mov ecx, dword [ebx + 0xc]
mov dword [esp + 0x44], eax
push ecx
call fcn.0040193b
mov edx, dword [ebx + 0x10]
mov dword [esp + 0x4c], eax
push edx
call fcn.0040193b
add esp, 0x10
mov dword [esp + 0x44], eax
push str.Kernel32.dll
call dword [sym.imp.KERNEL32.dll_LoadLibraryA]
mov ebp, eax
push str.Wow64DisableWow64FsRedirection
push ebp
call dword [sym.imp.KERNEL32.dll_GetProcAddress]
test eax, eax
je 0x401275
lea ecx, [esp + 0x30]
push ecx
call eax
jmp 0x40127d
push 0x78
call dword [sym.imp.KERNEL32.dll_SetLastError]
lea edx, [esp + 0x1c]
lea eax, [esp + 0x48]
push edx
push eax
push 0
push 0
push 0x200
push 1
push 0
lea ecx, [esp + 0x2b0]
push 0
push ecx
push 0
call dword [sym.imp.KERNEL32.dll_CreateProcessA]
mov ebx, dword [sym.imp.KERNEL32.dll_CloseHandle]
test eax, eax
je 0x4014e7
mov edx, dword [esp + 0x20]
push edx
call ebx
mov eax, dword [esp + 0x1c]
mov edi, dword [sym.imp.KERNEL32.dll_WaitForMultipleObjects]
mov esi, dword [sym.imp.KERNEL32.dll_GenerateConsoleCtrlEvent]
mov dword [esp + 0x34], eax
push 0xffffffffffffffff
lea ecx, [esp + 0x38]
push 0
push ecx
push 4
call edi
cmp eax, 4
ja case.default.0x4012e1
jmp dword [eax*4 + 0x401550]
push str.RemCmdStub:_ctrl_c_request_n
call fcn.00401570
mov edx, dword [esp + 0x2c]
push 0
push edx
call fcn.00401750
mov eax, dword [esp + 0x30]
add esp, 0xc
push eax
push 0
call esi
test eax, eax
jne case.default.0x4012e1
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.RemCmdStub:_err_Gen_ctrl_c_event__e_d_n
call fcn.00401570
add esp, 8
jmp case.default.0x4012e1
push str.RemCmdStub:_ctrl_break_request_n
call fcn.00401570
mov ecx, dword [esp + 0x28]
add esp, 4
push ecx
push 1
call esi
test eax, eax
jne case.default.0x4012e1
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.RemCmdStub:_err_Gen_ctrl_break_event__e_d_n
call fcn.00401570
add esp, 8
jmp case.default.0x4012e1
push str.RemCmdStub:_Cmd_App_Terminated_normally_n
call fcn.00401570
mov eax, dword [esp + 0x20]
add esp, 4
lea edx, [esp + 0x2c]
push edx
push eax
call dword [sym.imp.KERNEL32.dll_GetExitCodeProcess]
mov dword [esp + 0x18], 1
jmp 0x4014bf
push str.RemCmdStub:_ctrl_close_request_n
jmp 0x4014b7
push str.RemCmdStub:_exit_request_n
call fcn.00401570
mov ecx, dword [esp + 0x28]
add esp, 4
push ecx
push 1
call esi
mov esi, dword [sym.imp.KERNEL32.dll_GetLastError]
test eax, eax
jne 0x4013bb
call esi
push eax
push str.RemCmdStub:_err_Gen_ctrl_break_4_exit_event__e_d_n
call fcn.00401570
add esp, 8
push str._Writing_Exit_to_stdin_n
call fcn.00401570
mov eax, dword [esp + 0x84]
add esp, 4
lea edx, [esp + 0x10]
mov dword [esp + 0x10], 0
push 0
push edx
push 0xf
push str.Exit_nExit_nExit_n
push eax
call dword [sym.imp.KERNEL32.dll_WriteFile]
mov ecx, dword [esp + 0x10]
push ecx
push str._d_chars_written_to_stdin_n
call fcn.00401570
add esp, 8
push 0x64
call dword [sym.imp.KERNEL32.dll_Sleep]
push str.closing_stdin..._n
call fcn.00401570
mov edx, dword [esp + 0x84]
add esp, 4
push edx
call ebx
test eax, eax
jne 0x401431
call esi
push eax
push str.Err__d_closing_stdin_n
call fcn.00401570
add esp, 8
push str.closing_stdout..._n
call fcn.00401570
mov eax, dword [esp + 0x88]
add esp, 4
push eax
call ebx
test eax, eax
jne 0x40145c
call esi
push eax
push str.Err__d_closing_stdout_n
call fcn.00401570
add esp, 8
push str.closing_stderr..._n
call fcn.00401570
mov ecx, dword [esp + 0x8c]
add esp, 4
push ecx
call ebx
test eax, eax
jne 0x401487
call esi
push eax
push str.Err__d_closing_stderr_n
call fcn.00401570
add esp, 8
mov edx, dword [esp + 0x1c]
push 0x1388
push edx
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
test eax, eax
jne 0x4014b2
push str.RemCmdStub:_Cmd_App_Terminated_normally2_n
call fcn.00401570
add esp, 4
mov dword [esp + 0x18], 1
jmp 0x4014bf
push str.RemCmdStub:_timeout_after_ExitReq_n
call fcn.00401570
add esp, 4
mov eax, dword [esp + 0x1c]
push eax
call ebx
mov eax, dword [esp + 0x18]
test eax, eax
jne 0x4014e7
push str.Attempting_close_of_cmd_wnd_n
call fcn.00401570
mov ecx, dword [esp + 0x2c]
push 1
push ecx
call fcn.00401750
add esp, 0xc
mov esi, dword [esp + 0x30]
push str.Wow64RevertWow64FsRedirection
push ebp
call dword [sym.imp.KERNEL32.dll_GetProcAddress]
test eax, eax
je 0x401500
push esi
call eax
jmp 0x401508
push 0x78
call dword [sym.imp.KERNEL32.dll_SetLastError]
mov edx, dword [esp + 0x38]
push edx
call ebx
mov eax, dword [esp + 0x3c]
push eax
call ebx
mov ecx, dword [esp + 0x40]
push ecx
call ebx
mov edx, dword [esp + 0x44]
push edx
call ebx
push str.RemCmdStub:_exiting_n
call fcn.00401570
mov esi, dword [esp + 0x30]
add esp, 4
test ebp, ebp
je 0x401540
push ebp
call dword [sym.imp.KERNEL32.dll_FreeLibrary]
mov eax, esi
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x48c
ret