Function at 0x401791
Capabilities:
Check if file exists
Get file attributes
Query environment variable
Set environment variable

Disassembly:
push ebp
mov ebp, esp
push ebx
sub esp, 0xb4
mov dword [ebp - 0x10], 0
mov dword [esp + 0xc], 0x20
mov dword [esp + 8], str.MINGW_d
mov dword [esp + 4], pe_nt_image_headers32
lea eax, [ebp - 0x9c]
mov dword [esp], eax
call fcn.00401682
lea eax, [ebp - 0x9c]
mov dword [esp + 4], eax
mov dword [esp], str.MSYSTEM
mov eax, dword [sym.imp.KERNEL32.dll_SetEnvironmentVariableW]
call eax
sub esp, 8
mov dword [esp + 8], 0
mov dword [esp + 4], 0
mov dword [esp], str.PLINK_PROTOCOL
mov eax, dword [sym.imp.KERNEL32.dll_GetEnvironmentVariableW]
call eax
sub esp, 0xc
test eax, eax
jne 0x401821
mov dword [esp + 4], 0x4060ce
mov dword [esp], str.PLINK_PROTOCOL
mov eax, dword [sym.imp.KERNEL32.dll_SetEnvironmentVariableW]
call eax
sub esp, 8
mov dword [esp + 8], 0
mov dword [esp + 4], 0
mov dword [esp], str.HOME
mov eax, dword [sym.imp.KERNEL32.dll_GetEnvironmentVariableW]
call eax
sub esp, 0xc
test eax, eax
jne 0x4019d2
mov dword [ebp - 0x14], 0
mov dword [esp + 8], 0
mov dword [esp + 4], 0
mov dword [esp], str.HOMEPATH
mov eax, dword [sym.imp.KERNEL32.dll_GetEnvironmentVariableW]
call eax
sub esp, 0xc
mov dword [ebp - 0xc], eax
cmp dword [ebp - 0xc], 0
je 0x401950
mov dword [esp + 8], 0
mov dword [esp + 4], 0
mov dword [esp], str.HOMEDRIVE
mov eax, dword [sym.imp.KERNEL32.dll_GetEnvironmentVariableW]
call eax
sub esp, 0xc
mov dword [ebp - 0x18], eax
mov edx, dword [ebp - 0xc]
mov eax, dword [ebp - 0x18]
add eax, edx
add eax, eax
mov dword [esp], eax
call sub.msvcrt.dll_malloc
mov dword [ebp - 0x14], eax
mov eax, dword [ebp - 0x18]
mov dword [esp + 8], eax
mov eax, dword [ebp - 0x14]
mov dword [esp + 4], eax
mov dword [esp], str.HOMEDRIVE
mov eax, dword [sym.imp.KERNEL32.dll_GetEnvironmentVariableW]
call eax
sub esp, 0xc
mov dword [ebp - 0x18], eax
mov eax, dword [ebp - 0xc]
mov edx, dword [ebp - 0x18]
lea ecx, [edx + edx]
mov edx, dword [ebp - 0x14]
add edx, ecx
mov dword [esp + 8], eax
mov dword [esp + 4], edx
mov dword [esp], str.HOMEPATH
mov eax, dword [sym.imp.KERNEL32.dll_GetEnvironmentVariableW]
call eax
sub esp, 0xc
mov eax, dword [ebp - 0x14]
mov dword [esp], eax
mov eax, dword [sym.imp.KERNEL32.dll_GetFileAttributesW]
call eax
sub esp, 4
mov dword [ebp - 0x1c], eax
cmp dword [ebp - 0x1c], 0xffffffff
je 0x40193e
mov eax, dword [ebp - 0x1c]
and eax, 0x10
test eax, eax
je 0x40193e
mov eax, dword [ebp - 0x14]
mov dword [esp + 4], eax
mov dword [esp], str.HOME
mov eax, dword [sym.imp.KERNEL32.dll_SetEnvironmentVariableW]
call eax
sub esp, 8
jmp 0x401945
mov dword [ebp - 0xc], 0
mov eax, dword [ebp - 0x14]
mov dword [esp], eax
call sub.msvcrt.dll_free
cmp dword [ebp - 0xc], 0
jne 0x4019d2
mov dword [esp + 8], 0
mov dword [esp + 4], 0
mov dword [esp], str.USERPROFILE
mov eax, dword [sym.imp.KERNEL32.dll_GetEnvironmentVariableW]
call eax
sub esp, 0xc
mov dword [ebp - 0xc], eax
cmp dword [ebp - 0xc], 0
je 0x4019d2
mov eax, dword [ebp - 0xc]
add eax, eax
mov dword [esp], eax
call sub.msvcrt.dll_malloc
mov dword [ebp - 0x14], eax
mov eax, dword [ebp - 0xc]
mov dword [esp + 8], eax
mov eax, dword [ebp - 0x14]
mov dword [esp + 4], eax
mov dword [esp], str.USERPROFILE
mov eax, dword [sym.imp.KERNEL32.dll_GetEnvironmentVariableW]
call eax
sub esp, 0xc
mov eax, dword [ebp - 0x14]
mov dword [esp + 4], eax
mov dword [esp], str.HOME
mov eax, dword [sym.imp.KERNEL32.dll_SetEnvironmentVariableW]
call eax
sub esp, 8
mov eax, dword [ebp - 0x14]
mov dword [esp], eax
call sub.msvcrt.dll_free
mov dword [esp + 8], 0
mov dword [esp + 4], 0
mov dword [esp], str.PATH
mov eax, dword [sym.imp.KERNEL32.dll_GetEnvironmentVariableW]
call eax
sub esp, 0xc
mov dword [ebp - 0xc], eax
mov eax, dword [ebp - 0xc]
add eax, 0x208
add eax, eax
mov dword [ebp - 0xc], eax
mov eax, dword [ebp - 0xc]
mov dword [esp], eax
call sub.msvcrt.dll_malloc
mov dword [ebp - 0x10], eax
mov eax, dword [ebp + 8]
mov dword [esp + 4], eax
mov eax, dword [ebp - 0x10]
mov dword [esp], eax
call sub.msvcrt.dll_wcscpy
cmp dword [ebp + 0xc], 0
jne 0x401a46
mov dword [esp + 4], str.cmd_
mov eax, dword [ebp - 0x10]
mov dword [esp], eax
mov eax, dword [sym.imp.SHLWAPI.dll_PathAppendW]
call eax
sub esp, 8
jmp 0x401b0b
mov dword [esp + 4], 0x408040
mov eax, dword [ebp - 0x10]
mov dword [esp], eax
mov eax, dword [sym.imp.SHLWAPI.dll_PathAppendW]
call eax
sub esp, 8
mov dword [esp + 4], 0
mov eax, dword [ebp - 0x10]
mov dword [esp], eax
mov eax, dword [sym.imp.msvcrt.dll__waccess]
call eax
cmp eax, 0xffffffff
je 0x401ab7
mov dword [esp + 4], 0x406132
mov eax, dword [ebp - 0x10]
mov dword [esp], eax
call sub.msvcrt.dll_wcscat
mov eax, dword [ebp + 8]
mov dword [esp + 4], eax
mov eax, dword [ebp - 0x10]
mov dword [esp], eax
call sub.msvcrt.dll_wcscat
mov dword [esp + 4], str.usr_bin_
mov eax, dword [ebp - 0x10]
mov dword [esp], eax
mov eax, dword [sym.imp.SHLWAPI.dll_PathAppendW]
call eax
sub esp, 8
jmp 0x401b0b
mov eax, dword [ebp + 8]
mov dword [esp + 4], eax
mov eax, dword [ebp - 0x10]
mov dword [esp], eax
call sub.msvcrt.dll_wcscpy
mov dword [esp + 4], str.bin_
mov eax, dword [ebp - 0x10]
mov dword [esp], eax
mov eax, dword [sym.imp.SHLWAPI.dll_PathAppendW]
call eax
sub esp, 8
mov eax, dword [ebp + 8]
mov dword [esp + 4], eax
mov eax, dword [ebp - 0x10]
mov dword [esp], eax
call sub.msvcrt.dll_wcscat
mov dword [esp + 4], str.mingw_bin_
mov eax, dword [ebp - 0x10]
mov dword [esp], eax
mov eax, dword [sym.imp.SHLWAPI.dll_PathAppendW]
call eax
sub esp, 8
mov eax, dword [ebp - 0xc]
shr eax, 1
mov ebx, eax
mov eax, dword [ebp - 0x10]
mov dword [esp], eax
call sub.msvcrt.dll_wcslen
sub ebx, eax
mov eax, dword [ebp - 0x10]
mov dword [esp], eax
call sub.msvcrt.dll_wcslen
lea edx, [eax + eax]
mov eax, dword [ebp - 0x10]
add eax, edx
mov dword [esp + 8], ebx
mov dword [esp + 4], eax
mov dword [esp], str.PATH
mov eax, dword [sym.imp.KERNEL32.dll_GetEnvironmentVariableW]
call eax
sub esp, 0xc
mov eax, dword [ebp - 0x10]
mov dword [esp + 4], eax
mov dword [esp], str.PATH
mov eax, dword [sym.imp.KERNEL32.dll_SetEnvironmentVariableW]
call eax
sub esp, 8
mov eax, dword [ebp - 0x10]
mov dword [esp], eax
call sub.msvcrt.dll_free
nop
mov ebx, dword [ebp - 4]
leave
ret