Function at 0x408390
Capabilities:
Get common file path
Query environment variable
Set environment variable

Disassembly:
push ebp
mov eax, 0x402c
push edi
push esi
push ebx
call fcn.0040f3c0
sub esp, eax
mov ecx, dword [esp + 0x4044]
test ecx, ecx
je 0x4085b0
mov dword [esp], 0x41c2de
call fcn.00408220
mov dword [esp + 8], 0
mov dword [esp + 0x18], eax
mov eax, dword [esp + 0x4044]
mov dword [esp], 0
mov dword [esp + 4], eax
call fcn.004097b0
mov ebx, eax
test eax, eax
je 0x4086a0
lea ebp, [esp + 0x20]
mov dword [esp + 8], 0x1000
mov dword [esp + 4], ebp
mov dword [esp], eax
call dword [sym.imp.KERNEL32.dll_ExpandEnvironmentStringsW]
sub esp, 0xc
mov esi, eax
mov dword [esp], ebx
call sub.msvcrt.dll_free
test esi, esi
je 0x408670
mov dword [esp], ebp
call fcn.00409b70
test eax, eax
jne 0x4085a0
mov dword [esp + 8], 0x1000
mov dword [esp + 4], ebp
mov dword [esp], 0
call dword [sym.imp.msvcrt.dll__wfullpath]
mov esi, eax
test esi, esi
je 0x4086b1
lea ebx, [esp + 0x2020]
xor eax, eax
mov ecx, 0x800
mov edi, ebx
rep stosd dword es:[edi], eax
mov dword [esp + 4], 0x5c
mov dword [esp], esi
call sub.msvcrt.dll_wcschr
mov edx, dword [sym.imp.KERNEL32.dll_CreateDirectoryW]
mov edi, eax
test eax, eax
je 0x4084ca
mov dword [esp + 0x1c], ebp
mov ebp, esi
mov esi, edx
nop
mov eax, edi
mov dword [esp + 4], ebp
add edi, 2
sub eax, ebp
mov dword [esp], ebx
sar eax, 1
add eax, 1
mov dword [esp + 8], eax
call sub.msvcrt.dll_wcsncpy
mov dword [esp + 4], 0
mov dword [esp], ebx
call esi
sub esp, 8
mov dword [esp], edi
mov dword [esp + 4], 0x5c
call sub.msvcrt.dll_wcschr
mov edi, eax
test eax, eax
jne 0x408480
mov edx, esi
mov esi, ebp
mov ebp, dword [esp + 0x1c]
mov dword [esp + 4], 0
mov dword [esp], esi
call edx
sub esp, 8
mov dword [esp + 4], esi
mov dword [esp], 0x41c3ac
call dword [sym.imp.msvcrt.dll__wputenv_s]
mov dword [esp], esi
mov edi, eax
call sub.msvcrt.dll_free
test edi, edi
jne 0x408688
mov dword [esp + 4], ebx
mov esi, 5
mov dword [esp], 0x1000
call dword [sym.imp.KERNEL32.dll_GetTempPathW]
sub esp, 8
call sub.msvcrt.dll__getpid
mov dword [esp + 8], str._MEI_d
mov dword [esp + 0xc], eax
mov dword [esp + 4], 0x10
mov dword [esp], ebp
call fcn.004080e0
mov dword [esp + 4], ebp
mov dword [esp], ebx
call dword [sym.imp.msvcrt.dll__wtempnam]
mov dword [esp], eax
mov edi, eax
call fcn.00409a90
test eax, eax
je 0x4085d0
mov dword [esp], edi
call sub.msvcrt.dll_free
sub esi, 1
jne 0x408537
mov eax, dword [esp + 0x4044]
test eax, eax
je 0x40858e
mov esi, dword [esp + 0x18]
test esi, esi
je 0x408630
mov dword [esp + 4], esi
mov dword [esp], 0x41c2de
call fcn.004082d0
mov dword [esp], esi
call sub.msvcrt.dll_free
xor eax, eax
add esp, 0x402c
pop ebx
pop esi
pop edi
pop ebp
ret
mov dword [esp], ebp
call dword [sym.imp.msvcrt.dll__wcsdup]
mov esi, eax
jmp 0x408441
mov dword [esp + 0x18], 0
lea ebp, [esp + 0x20]
lea ebx, [esp + 0x2020]
jmp 0x4084fd
mov eax, dword [esp + 0x4040]
mov dword [esp + 8], 0x1000
mov dword [esp + 4], edi
mov dword [esp], eax
call fcn.004095d0
mov dword [esp], edi
call sub.msvcrt.dll_free
mov edx, dword [esp + 0x4044]
test edx, edx
je 0x408622
mov esi, dword [esp + 0x18]
test esi, esi
je 0x4086c2
mov dword [esp + 4], esi
mov dword [esp], 0x41c2de
call fcn.004082d0
mov dword [esp], esi
call sub.msvcrt.dll_free
mov eax, 1
jmp 0x408590
mov dword [esp + 8], 0
mov dword [esp + 4], 0x41c2de
mov dword [esp], 0
call fcn.004097b0
mov dword [esp + 4], 0
mov ebx, eax
mov dword [esp], eax
call dword [sym.imp.KERNEL32.dll_SetEnvironmentVariableW]
sub esp, 8
mov dword [esp], ebx
call sub.msvcrt.dll_free
jmp 0x40858e
mov dword [esp], str.LOADER:_Failed_to_expand_environment_variables_in_the_runtime_tmpdir._n
call fcn.00402fa0
jmp 0x40858e
mov dword [esp], str.LOADER:_Failed_to_set_the_TMP_environment_variable._n
call fcn.00402fa0
jmp 0x40858e
mov dword [esp], str.LOADER:_Failed_to_convert_runtime_tmpdir_to_a_wide_string._n
call fcn.00402fa0
jmp 0x40858e
mov dword [esp], str.LOADER:_Failed_to_obtain_the_absolute_path_of_the_runtime_tmpdir._n
call fcn.00402fa0
jmp 0x40858e
mov dword [esp + 8], 0
mov dword [esp + 4], 0x41c2de
mov dword [esp], 0
call fcn.004097b0
mov dword [esp + 4], 0
mov ebx, eax
mov dword [esp], eax
call dword [sym.imp.KERNEL32.dll_SetEnvironmentVariableW]
sub esp, 8
mov dword [esp], ebx
call sub.msvcrt.dll_free
jmp 0x408622