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

Disassembly:
sub esp, 0x10
push esi
push edi
mov esi, 0x1770
push esi
call fcn.00412d69
mov dword [0x4474d8], eax
mov byte [eax], 0
mov dword [esp], 0x2ee0
call fcn.00412d69
xor ecx, ecx
mov dword [0x4474dc], eax
mov word [eax], cx
mov dword [esp], 0x2719
call fcn.004038cb
pop ecx
push dword [0x4474d8]
test eax, eax
push esi
setne byte [esp + 0x14]
call dword [sym.imp.KERNEL32.dll_GetTempPathA]
test eax, eax
jbe 0x4050d0
push dword [esp + 0xc]
xor edi, edi
inc edi
push edi
push edi
push dword [0x4474d8]
call fcn.00404dd6
add esp, 0x10
test al, al
je 0x4050d0
push dword [0x4474dc]
push esi
call dword [sym.imp.KERNEL32.dll_GetTempPathW]
test eax, eax
jbe 0x4050d0
push edi
push edi
push dword [0x4474dc]
call fcn.00404eb1
add esp, 0xc
test al, al
jne 0x4057e9
push ebx
push ebp
push esi
push dword [0x4474d8]
push str.USERPROFILE
call dword [sym.imp.KERNEL32.dll_GetEnvironmentVariableA]
mov ebx, dword [sym.imp.KERNEL32.dll_GetLongPathNameA]
test eax, eax
jbe 0x4051fe
push str.AppDataLocalTemp
push dword [0x4474d8]
call fcn.00413b90
pop ecx
pop ecx
test eax, eax
je 0x4051fe
mov eax, dword [0x4474d8]
push eax
mov dword [esp + 0x1c], eax
call fcn.00413700
pop ecx
test eax, eax
jbe 0x4051b2
push 0
push 0
push dword [esp + 0x20]
call ebx
mov dword [esp + 0x1c], eax
test eax, eax
jle 0x4051a6
lea edi, [eax + 0xa]
push edi
call fcn.00412d69
pop ecx
push edi
mov edi, dword [esp + 0x1c]
mov ebp, eax
push ebp
push edi
mov byte [esp + 0x1f], 1
call ebx
test eax, eax
jbe 0x405198
push 0x3f
push ebp
call fcn.00413640
pop ecx
pop ecx
test eax, eax
je 0x405169
mov byte [esp + 0x13], 0
jmp 0x405198
cmp byte [esp + 0x14], 0
je 0x405198
cmp dword [esp + 0x1c], esi
jge 0x405198
push ebp
push edi
call fcn.004150b0
pop ecx
pop ecx
test eax, eax
je 0x405198
push ebp
push str.using_long_path__S
call fcn.0040ea46
push ebp
push edi
call fcn.00413b80
add esp, 0x10
push ebp
call fcn.00413a45
cmp byte [esp + 0x17], 0
pop ecx
je 0x4051fe
push dword [esp + 0x18]
call fcn.00404c72
pop ecx
jmp 0x4051b4
xor al, al
test al, al
je 0x4051fe
push esi
push dword [0x4474dc]
push 0x431448
call dword [sym.imp.KERNEL32.dll_GetEnvironmentVariableW]
test eax, eax
jbe 0x4051fe
push 0x431420
push dword [0x4474dc]
call fcn.0041446c
pop ecx
pop ecx
test eax, eax
je 0x4051fe
push 1
push 0
push dword [0x4474dc]
call fcn.00404eb1
add esp, 0xc
test al, al
jne 0x4057e7
mov edi, dword [sym.imp.KERNEL32.dll_GetEnvironmentVariableA]
push esi
push dword [0x4474d8]
push str.HOMEDRIVE
call edi
test eax, eax
jbe 0x40535d
push dword [0x4474d8]
call fcn.00413700
pop ecx
mov ecx, esi
sub ecx, eax
push ecx
push dword [0x4474d8]
call fcn.00413700
add eax, dword [0x4474d8]
pop ecx
push eax
push str.HOMEPATH
call edi
test eax, eax
jbe 0x40535d
mov eax, dword [0x4474d8]
push eax
mov dword [esp + 0x1c], eax
call fcn.00413700
pop ecx
test eax, eax
jbe 0x4052f3
push 0
push 0
push dword [esp + 0x20]
call ebx
mov dword [esp + 0x1c], eax
test eax, eax
jle 0x4052e7
lea edi, [eax + 0xa]
push edi
call fcn.00412d69
pop ecx
push edi
mov edi, dword [esp + 0x1c]
mov ebp, eax
push ebp
push edi
mov byte [esp + 0x1f], 1
call ebx
test eax, eax
jbe 0x4052d9
push 0x3f
push ebp
call fcn.00413640
pop ecx
pop ecx
test eax, eax
je 0x4052aa
mov byte [esp + 0x13], 0
jmp 0x4052d9
cmp byte [esp + 0x14], 0
je 0x4052d9
cmp dword [esp + 0x1c], esi
jge 0x4052d9
push ebp
push edi
call fcn.004150b0
pop ecx
pop ecx
test eax, eax
je 0x4052d9
push ebp
push str.using_long_path__S
call fcn.0040ea46
push ebp
push edi
call fcn.00413b80
add esp, 0x10
push ebp
call fcn.00413a45
cmp byte [esp + 0x17], 0
pop ecx
je 0x40535d
push dword [esp + 0x18]
call fcn.00404c72
pop ecx
jmp 0x4052f5
xor al, al
test al, al
je 0x40535d
mov edi, dword [sym.imp.KERNEL32.dll_GetEnvironmentVariableW]
push esi
push dword [0x4474dc]
push 0x4313f4
call edi
test eax, eax
jbe 0x40535d
push dword [0x4474dc]
call fcn.00413f2b
pop ecx
mov ecx, esi
sub ecx, eax
push ecx
push dword [0x4474dc]
call fcn.00413f2b
pop ecx
mov ecx, dword [0x4474dc]
lea eax, [ecx + eax*2]
push eax
push 0x4313e0
call edi
test eax, eax
jbe 0x40535d
push 1
push 0
push dword [0x4474dc]
call fcn.00404eb1
add esp, 0xc
test al, al
jne 0x4057e7
call fcn.00404957
mov eax, dword [0x43ff98]
xor ebx, ebx
mov edi, 0x4313d8
mov ebp, 0x4313cc
cmp eax, ebx
je 0x405455
push dword [0x4474d8]
push ebx
push ebx
push 0x23
push ebx
call eax
test eax, eax
jne 0x405455
push dword [0x4474d8]
call fcn.00413700
pop ecx
test eax, eax
jbe 0x405455
mov eax, dword [0x43ff9c]
cmp eax, ebx
je 0x405455
push dword [0x4474dc]
push ebx
push ebx
push 0x23
push ebx
call eax
test eax, eax
jne 0x405455
push dword [0x4474dc]
call fcn.00413f2b
pop ecx
test eax, eax
jbe 0x405455
push 0x4313c0
push dword [0x4474d8]
call fcn.00413b90
push dword [0x4474d8]
call fcn.0041552a
push edi
push dword [0x4474d8]
call fcn.00413b90
push 0x4313a8
push dword [0x4474dc]
call fcn.0041446c
push dword [0x4474dc]
call fcn.004155c0
push ebp
push dword [0x4474dc]
call fcn.0041446c
push dword [esp + 0x3c]
inc ebx
push ebx
push ebx
push dword [0x4474d8]
call fcn.00404dd6
add esp, 0x38
test al, al
je 0x405455
push ebx
push ebx
push dword [0x4474dc]
call fcn.00404eb1
add esp, 0xc
test al, al
jne 0x4057e7
mov ebx, dword [sym.imp.KERNEL32.dll_GetWindowsDirectoryA]
push esi
push dword [0x4474d8]
call ebx
test eax, eax
jbe 0x4054ce
push edi
push dword [0x4474d8]
call fcn.00413b90
pop ecx
pop ecx
test eax, eax
je 0x4054ce
xor edi, edi
push edi
push edi
push edi
push dword [0x4474d8]
call fcn.00404dd6
add esp, 0x10
test al, al
je 0x4054d0
push esi
push dword [0x4474dc]
call dword [sym.imp.KERNEL32.dll_GetWindowsDirectoryW]
test eax, eax
jbe 0x4054d0
push ebp
push dword [0x4474dc]
call fcn.0041446c
pop ecx
pop ecx
test eax, eax
je 0x4054d0
push edi
push edi
push dword [0x4474dc]
call fcn.00404eb1
add esp, 0xc
test al, al
jne 0x4057e7
jmp 0x4054d0
xor edi, edi
push str.c:_temp
push dword [0x4474d8]
call fcn.00413b80
pop ecx
pop ecx
test eax, eax
je 0x405529
push edi
push edi
push edi
push dword [0x4474d8]
call fcn.00404dd6
add esp, 0x10
test al, al
je 0x405529
push 0x431390
push dword [0x4474dc]
call fcn.0041449a
pop ecx
pop ecx
test eax, eax
je 0x405529
push edi
push edi
push dword [0x4474dc]
call fcn.00404eb1
add esp, 0xc
test al, al
jne 0x4057e7
mov ebp, str.c:_tmp
push ebp
push dword [0x4474d8]
call fcn.00413b80
pop ecx
pop ecx
test eax, eax
je 0x405583
push edi
push edi
push edi
push dword [0x4474d8]
call fcn.00404dd6
add esp, 0x10
test al, al
je 0x405583
push 0x431378
push dword [0x4474dc]
call fcn.0041449a
pop ecx
pop ecx
test eax, eax
je 0x405583
push edi
push edi
push dword [0x4474dc]
call fcn.00404eb1
add esp, 0xc
test al, al
jne 0x4057e7
push esi
push dword [0x4474d8]
call ebx
test eax, eax
jbe 0x4055ce
push edi
push edi
push edi
push dword [0x4474d8]
call fcn.00404dd6
add esp, 0x10
test al, al
je 0x4055ce
push esi
push dword [0x4474dc]
call dword [sym.imp.KERNEL32.dll_GetWindowsDirectoryW]
test eax, eax
jbe 0x4055ce
push edi
push edi
push dword [0x4474dc]
call fcn.00404eb1
add esp, 0xc
test al, al
jne 0x4057e7
push ebp
push dword [0x4474d8]
call fcn.00413b80
pop ecx
pop ecx
test eax, eax
je 0x405625
push edi
push edi
push 1
push dword [0x4474d8]
call fcn.00404dd6
add esp, 0x10
test al, al
je 0x405625
push 0x431378
push dword [0x4474dc]
call fcn.0041449a
pop ecx
pop ecx
test eax, eax
je 0x405625
push edi
push 1
push dword [0x4474dc]
call fcn.00404eb1
add esp, 0xc
test al, al
jne 0x4057e7
push dword [0x4474d8]
mov byte [0x4474d2], 1
push esi
call dword [sym.imp.KERNEL32.dll_GetTempPathA]
test eax, eax
jbe 0x405680
push dword [esp + 0x14]
push edi
push 1
push dword [0x4474d8]
call fcn.00404dd6
add esp, 0x10
test al, al
je 0x405680
push dword [0x4474dc]
push esi
call dword [sym.imp.KERNEL32.dll_GetTempPathW]
test eax, eax
jbe 0x405680
push edi
push 1
push dword [0x4474dc]
call fcn.00404eb1
add esp, 0xc
test al, al
jne 0x4057e7
mov ebx, dword [sym.imp.KERNEL32.dll_GetEnvironmentVariableA]
push esi
push dword [0x4474d8]
push str.USERPROFILE
call ebx
test eax, eax
jbe 0x40570a
push str.AppDataLocalTemp
push dword [0x4474d8]
call fcn.00413b90
pop ecx
pop ecx
test eax, eax
je 0x40570a
push dword [esp + 0x14]
push edi
push edi
push dword [0x4474d8]
call fcn.00404dd6
add esp, 0x10
test al, al
je 0x40570a
push esi
push dword [0x4474dc]
push 0x431448
call dword [sym.imp.KERNEL32.dll_GetEnvironmentVariableW]
test eax, eax
jbe 0x40570a
push 0x431420
push dword [0x4474dc]
call fcn.0041446c
pop ecx
pop ecx
test eax, eax
je 0x40570a
push edi
push edi
push dword [0x4474dc]
call fcn.00404eb1
add esp, 0xc
test al, al
jne 0x4057e7
push esi
push dword [0x4474d8]
push str.HOMEDRIVE
call ebx
test eax, eax
jbe 0x4057c3
push dword [0x4474d8]
call fcn.00413700
pop ecx
mov ecx, esi
sub ecx, eax
push ecx
push dword [0x4474d8]
call fcn.00413700
add eax, dword [0x4474d8]
pop ecx
push eax
push str.HOMEPATH
call ebx
test eax, eax
jbe 0x4057c3
push dword [esp + 0x14]
push edi
push edi
push dword [0x4474d8]
call fcn.00404dd6
add esp, 0x10
test al, al
je 0x4057c3
mov ebx, dword [sym.imp.KERNEL32.dll_GetEnvironmentVariableW]
push esi
push dword [0x4474dc]
push 0x4313f4
call ebx
test eax, eax
jbe 0x4057c3
push dword [0x4474dc]
call fcn.00413f2b
pop ecx
sub esi, eax
push esi
push dword [0x4474dc]
call fcn.00413f2b
pop ecx
mov ecx, dword [0x4474dc]
lea eax, [ecx + eax*2]
push eax
push 0x4313e0
call ebx
test eax, eax
jbe 0x4057c3
push edi
push edi
push dword [0x4474dc]
call fcn.00404eb1
add esp, 0xc
test al, al
jne 0x4057e7
push dword [0x4474d8]
call fcn.00415622
push dword [0x4474dc]
mov dword [0x4474d8], edi
call fcn.00415622
pop ecx
pop ecx
mov dword [0x4474dc], edi
pop ebp
pop ebx
pop edi
pop esi
add esp, 0x10
ret