Function at 0x401040
Capabilities:
Check if file exists
Get comspec environment variable
Query environment variable

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x424
mov eax, dword [0x41c004]
xor eax, ebp
mov dword [ebp - 4], eax
mov eax, dword [ebp + 8]
push ebx
push esi
push edi
mov edi, edx
mov dword [ebp - 0x420], eax
push str.kernel32
mov dword [ebp - 0x424], edi
mov ebx, ecx
mov dword [ebp - 0x418], 0
call dword [sym.imp.KERNEL32.dll_GetModuleHandleW]
test eax, eax
jne 0x401086
xor esi, esi
jmp 0x4010bd
push str.IsWow64Process
push eax
call dword [sym.imp.KERNEL32.dll_GetProcAddress]
mov dword [0x41d450], eax
test eax, eax
je 0x4010b7
lea eax, [ebp - 0x418]
push eax
call dword [sym.imp.KERNEL32.dll_GetCurrentProcess]
push eax
call dword [0x41d450]
test eax, eax
jne 0x4010b7
xor esi, esi
jmp 0x4010bd
mov esi, dword [ebp - 0x418]
neg esi
lea eax, [ebp - 0x20c]
sbb esi, esi
and esi, 4
push dword [esi + 0x419ee4]
push ebx
push eax
call dword [sym.imp.SHLWAPI.dll_PathCombineW]
lea eax, [ebp - 0x20c]
push eax
call dword [sym.imp.SHLWAPI.dll_PathFileExistsW]
test eax, eax
je 0x40128e
xor ecx, ecx
lea eax, [edi + 3]
mov edx, 4
mul edx
seto cl
neg ecx
or ecx, eax
push ecx
call fcn.004014b8
add esp, 4
mov ebx, eax
lea eax, [ebp - 0x414]
mov dword [ebp - 0x418], ebx
push 0x104
push eax
push str._COMSPEC_
call dword [sym.imp.KERNEL32.dll_ExpandEnvironmentStringsW]
lea eax, [ebp - 0x414]
push eax
call fcn.00403cc1
push 0x208
mov dword [ebx], eax
call fcn.004014b8
push 0x419e30
mov esi, eax
push 0x104
push esi
call fcn.004051c0
add esp, 0x14
test eax, eax
jne 0x4013b3
mov ecx, esi
lea edx, [ecx + 2]
mov ax, word [ecx]
add ecx, 2
test ax, ax
jne 0x401162
sub ecx, edx
sar ecx, 1
cmp ecx, 0x102
ja 0x4013b3
mov ebx, dword [sym.imp.SHLWAPI.dll_PathQuoteSpacesW]
push esi
call ebx
mov eax, dword [ebp - 0x418]
push 0x208
mov dword [eax + 4], esi
call fcn.004014b8
mov esi, eax
lea eax, [ebp - 0x20c]
push eax
push 0x104
push esi
call fcn.004051c0
add esp, 0x10
test eax, eax
jne 0x4013b3
mov ecx, esi
lea edx, [ecx + 2]
nop dword [eax]
mov ax, word [ecx]
add ecx, 2
test ax, ax
jne 0x4011c0
sub ecx, edx
sar ecx, 1
cmp ecx, 0x102
ja 0x4013b3
push esi
call ebx
mov eax, dword [ebp - 0x418]
mov ebx, 1
mov dword [eax + 8], esi
cmp edi, ebx
jle 0x401275
add eax, 0xc
mov dword [ebp - 0x41c], eax
nop dword [eax]
mov eax, dword [ebp - 0x420]
push 0x208
mov esi, dword [eax + ebx*4]
call fcn.004014b8
push esi
mov edi, eax
push 0x104
push edi
call fcn.004051c0
add esp, 0x10
test eax, eax
jne 0x4013b3
mov ecx, edi
lea edx, [ecx + 2]
mov ax, word [ecx]
add ecx, 2
test ax, ax
jne 0x401231
sub ecx, edx
sar ecx, 1
cmp ecx, 0x102
ja 0x4013b3
push edi
call dword [sym.imp.SHLWAPI.dll_PathQuoteSpacesW]
mov eax, dword [ebp - 0x41c]
inc ebx
mov dword [eax], edi
add eax, 4
mov edi, dword [ebp - 0x424]
mov dword [ebp - 0x41c], eax
cmp ebx, edi
jl 0x401200
mov eax, dword [ebp - 0x418]
mov dword [eax + edi*4 + 8], 0
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.004014a7
mov esp, ebp
pop ebp
ret
push dword [esi + 0x419edc]
lea eax, [ebp - 0x20c]
push ebx
push eax
call dword [sym.imp.SHLWAPI.dll_PathCombineW]
lea eax, [ebp - 0x20c]
push eax
call dword [sym.imp.SHLWAPI.dll_PathFileExistsW]
test eax, eax
je 0x4013a0
xor ecx, ecx
lea eax, [edi + 1]
mov edx, 4
mul edx
seto cl
neg ecx
or ecx, eax
push ecx
call fcn.004014b8
mov esi, eax
lea eax, [ebp - 0x20c]
push eax
mov dword [ebp - 0x418], esi
call fcn.00403cc1
add esp, 8
mov dword [esi], eax
mov dword [ebp - 0x41c], 1
cmp edi, 1
jle 0x401386
mov ecx, dword [ebp - 0x420]
lea ebx, [esi + 4]
sub ecx, esi
mov dword [ebp - 0x420], ecx
nop dword [eax]
mov esi, dword [ecx + ebx]
push 0x208
call fcn.004014b8
push esi
mov edi, eax
push 0x104
push edi
call fcn.004051c0
add esp, 0x10
test eax, eax
jne 0x4013b3
mov ecx, edi
lea edx, [ecx + 2]
nop dword [eax + eax]
mov ax, word [ecx]
add ecx, 2
test ax, ax
jne 0x401340
sub ecx, edx
sar ecx, 1
cmp ecx, 0x102
ja 0x4013b3
push edi
call dword [sym.imp.SHLWAPI.dll_PathQuoteSpacesW]
mov eax, dword [ebp - 0x41c]
mov ecx, dword [ebp - 0x420]
inc eax
mov dword [ebx], edi
add ebx, 4
mov edi, dword [ebp - 0x424]
mov dword [ebp - 0x41c], eax
cmp eax, edi
jl 0x401310
mov esi, dword [ebp - 0x418]
mov dword [esi + edi*4], 0
mov eax, esi
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.004014a7
mov esp, ebp
pop ebp
ret
mov ecx, dword [ebp - 4]
xor eax, eax
pop edi
pop esi
xor ecx, ebp
pop ebx
call fcn.004014a7
mov esp, ebp
pop ebp
ret
push str.Argument_is_too_long
push 2
call fcn.00403c3d
add esp, 4
push eax
call fcn.00401010
add esp, 8
push 1
call fcn.00403b5f
int3