Function at 0x404040
Capabilities:
Accept command line arguments
Create process on windows
Query environment variable
Resume thread
Set environment variable
Terminate process

Disassembly:
sub esp, 0x5c
mov eax, dword [esp + 0x6c]
push esi
mov esi, dword [sym.imp.KERNEL32.DLL_GetEnvironmentVariableA]
push edi
push 0x32
push 0x48ce24
xor edi, edi
push eax
mov dword [esp + 0x14], edi
mov dword [esp + 0x18], edi
call esi
test eax, eax
jbe 0x404082
mov eax, dword [0x48ce58]
cmp eax, edi
je 0x404077
push eax
call dword [sym.imp.KERNEL32.DLL_CloseHandle]
pop edi
mov eax, 1
pop esi
add esp, 0x5c
ret
mov ecx, dword [esp + 0x6c]
push 0x32
push 0x48ce24
push ecx
call esi
test eax, eax
jbe 0x4040ce
mov ecx, dword [esp + 0x70]
call fcn.00403ff0
mov dword [esp + 8], eax
cmp eax, edi
jne 0x4040c7
mov edx, dword [esp + 0x68]
mov dword [edx], 0xfffffffb
mov eax, dword [0x48ce58]
cmp eax, edi
je 0x4040bf
push eax
call dword [sym.imp.KERNEL32.DLL_CloseHandle]
pop edi
xor eax, eax
pop esi
add esp, 0x5c
ret
mov eax, dword [eax + 8]
test eax, eax
jne 0x404067
push ebx
mov ebx, dword [sym.imp.KERNEL32.DLL_GetModuleFileNameA]
push ebp
mov ebp, dword [sym.imp.msvcrt.dll_malloc]
xor esi, esi
xor eax, eax
test esi, esi
jne 0x4040f1
mov esi, 0x104
push esi
call ebp
add esp, 4
jmp 0x4040ff
lea esi, [eax + eax]
push esi
push edi
call dword [sym.imp.msvcrt.dll_realloc]
add esp, 8
mov edi, eax
test edi, edi
je 0x404163
push esi
push edi
push 0
call ebx
cmp eax, esi
je 0x4040e0
call dword [sym.imp.KERNEL32.DLL_GetCommandLineA]
mov esi, dword [esp + 0x10]
mov ebp, eax
test esi, esi
jne 0x404192
mov edx, dword [esp + 0x74]
push 0x40f5b4
push edx
call dword [sym.imp.KERNEL32.DLL_SetEnvironmentVariableA]
test eax, eax
je 0x404146
mov eax, dword [esp + 0x78]
push eax
call fcn.00403f00
mov ebx, eax
add esp, 4
test ebx, ebx
jne 0x404196
mov eax, dword [0x48ce58]
test eax, eax
je 0x404156
push eax
call dword [sym.imp.KERNEL32.DLL_CloseHandle]
pop ebp
pop ebx
pop edi
mov eax, 1
pop esi
add esp, 0x5c
ret
cmp dword [esp + 0x10], 0
je 0x404146
mov ecx, dword [esp + 0x70]
mov dword [ecx], 0xfffffffa
mov eax, dword [0x48ce58]
test eax, eax
je 0x404316
push eax
call dword [sym.imp.KERNEL32.DLL_CloseHandle]
pop ebp
pop ebx
pop edi
xor eax, eax
pop esi
add esp, 0x5c
ret
mov ebx, dword [esp + 0x14]
mov edx, 0x1000200
test esi, esi
je 0x4041ad
call dword [sym.imp.KERNEL32.DLL_GetCurrentProcessId]
mov dword [esi + 8], eax
mov edx, 0x1000204
mov ecx, 0x10
lea eax, [esp + 0x18]
mov byte [eax], 0
inc eax
sub ecx, 1
jne 0x4041b6
mov ecx, 0x44
lea eax, [esp + 0x28]
mov byte [eax], 0
inc eax
sub ecx, 1
jne 0x4041c8
lea ecx, [esp + 0x18]
push ecx
lea eax, [esp + 0x2c]
push eax
push 0
push 0
push edx
push 1
push 0
push 0
push ebp
push edi
mov dword [esp + 0x50], 0x44
call dword [sym.imp.KERNEL32.DLL_CreateProcessA]
test eax, eax
jne 0x40422a
test esi, esi
je 0x404146
mov ecx, dword [esp + 0x70]
mov dword [ecx], 0xfffffff8
mov eax, dword [0x48ce58]
test eax, eax
je 0x404316
push eax
call dword [sym.imp.KERNEL32.DLL_CloseHandle]
pop ebp
pop ebx
pop edi
xor eax, eax
pop esi
add esp, 0x5c
ret
test esi, esi
je 0x4042ac
mov eax, dword [esi]
mov ecx, dword [esp + 0x18]
push 2
push 1
push 0
lea edx, [esi + 0xc]
push edx
push eax
push ecx
call dword [sym.imp.KERNEL32.DLL_GetCurrentProcess]
push eax
call dword [sym.imp.KERNEL32.DLL_DuplicateHandle]
test eax, eax
je 0x40427f
mov edx, dword [esp + 0x1c]
push edx
call dword [sym.imp.KERNEL32.DLL_ResumeThread]
mov eax, dword [esp + 0x18]
mov esi, dword [sym.imp.KERNEL32.DLL_CloseHandle]
push eax
call esi
mov ecx, dword [esp + 0x1c]
push ecx
call esi
mov edx, dword [esp + 0x70]
mov dword [edx], 0
jmp 0x40430a
mov eax, dword [esp + 0x18]
push 0xfffffffffffffff7
push eax
call dword [sym.imp.KERNEL32.DLL_TerminateProcess]
mov ecx, dword [esp + 0x18]
mov esi, dword [sym.imp.KERNEL32.DLL_CloseHandle]
push ecx
call esi
mov edx, dword [esp + 0x1c]
push edx
call esi
mov eax, dword [esp + 0x70]
mov dword [eax], 0xfffffff6
jmp 0x40430a
mov ecx, dword [esp + 0x1c]
mov esi, dword [sym.imp.KERNEL32.DLL_CloseHandle]
push ecx
call esi
mov edx, dword [esp + 0x18]
mov edi, dword [sym.imp.KERNEL32.DLL_WaitForSingleObject]
push 0xffffffffffffffff
push edx
call edi
mov eax, dword [esp + 0x18]
push eax
call esi
mov eax, dword [ebx + 0xc]
cmp eax, 0xffffffff
jne 0x4042f0
mov eax, dword [0x48ce58]
test eax, eax
je 0x4042e3
push eax
call esi
pop ebp
pop ebx
pop edi
mov eax, 1
pop esi
add esp, 0x5c
ret
push 0xffffffffffffffff
push eax
call edi
mov ecx, dword [esp + 0x70]
mov edx, dword [ebx + 0xc]
push ecx
push edx
call dword [sym.imp.KERNEL32.DLL_GetExitCodeProcess]
mov eax, dword [ebx + 0xc]
push eax
call esi
mov eax, dword [0x48ce58]
test eax, eax
je 0x404316
push eax
call esi
pop ebp
pop ebx
pop edi
xor eax, eax
pop esi
add esp, 0x5c
ret