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

Disassembly:
push ebp
sub esp, 0x224
lea ebp, [esp - 4]
mov eax, dword [0x50e7dc]
xor eax, ebp
mov dword [ebp + 0x224], eax
push 0x48
mov eax, 0x4bff3d
call fcn.0049f542
mov ebx, ecx
mov esi, edx
push str.CSystemCommands::GetSafeEnv____bool____start
lea ecx, [ebp - 0x38]
mov dword [ebp - 0x1c], ebx
mov dword [ebp - 0x18], esi
call fcn.00404bd0
and dword [ebp - 4], 0
lea eax, [ebp - 0x38]
push eax
call fcn.004017f5
or dword [ebp - 4], 0xffffffff
pop ecx
xor edi, edi
push 0
inc edi
push edi
lea ecx, [ebp - 0x38]
call fcn.004058b3
push 0x4d51f0
mov ecx, esi
call fcn.00405394
test ebx, ebx
je 0x404750
mov eax, ebx
lea edx, [eax + 1]
mov cl, byte [eax]
inc eax
test cl, cl
jne 0x40450c
sub eax, edx
je 0x404750
push ebx
call dword [sym.imp.KERNEL32.dll_lstrlenA]
mov edi, eax
inc edi
cmp edi, 0x3fffffff
jle 0x404531
xor eax, eax
jmp 0x404544
lea eax, [edi + edi]
call fcn.004a0cd0
mov esi, esp
push 3
push edi
push ebx
call fcn.0040123d
push eax
lea ecx, [ebp]
call fcn.00404bd0
push str.CSystemCommands::GetSafeEnv__varName
lea ecx, [ebp - 0x38]
mov dword [ebp - 4], 2
call fcn.00404bd0
lea eax, [ebp]
push eax
lea eax, [ebp - 0x38]
push eax
mov byte [ebp - 4], 3
call fcn.00401985
pop ecx
pop ecx
push 0
push 1
lea ecx, [ebp - 0x38]
mov byte [ebp - 4], 2
call fcn.004058b3
mov esi, 0x104
push esi
call fcn.0049e091
mov edi, eax
pop ecx
test edi, edi
jne 0x4045a1
push eax
push 1
lea ecx, [ebp]
jmp 0x404770
push esi
push edi
push ebx
mov ebx, dword [sym.imp.KERNEL32.dll_GetEnvironmentVariableA]
call ebx
mov dword [ebp - 0x10], eax
cmp eax, esi
jbe 0x40461b
push str.CSystemCommands::GetSafeEnv__need_to_re_allocate_string_to
lea ecx, [ebp - 0x38]
call fcn.00404bd0
push dword [ebp - 0x10]
lea eax, [ebp - 0x38]
push eax
mov byte [ebp - 4], 4
call fcn.004018c5
pop ecx
pop ecx
xor esi, esi
push esi
push 1
lea ecx, [ebp - 0x38]
mov byte [ebp - 4], 2
call fcn.004058b3
push edi
call fcn.0049eec0
push dword [ebp - 0x10]
call fcn.0049e091
mov edi, eax
pop ecx
pop ecx
cmp edi, esi
jne 0x40460d
xor bl, bl
push esi
push 1
lea ecx, [ebp]
call fcn.004058b3
mov al, bl
jmp 0x404777
push dword [ebp - 0x10]
push edi
push dword [ebp - 0x1c]
call ebx
mov dword [ebp - 0x10], eax
jmp 0x40461d
xor esi, esi
push edi
cmp dword [ebp - 0x10], esi
je 0x404663
call dword [sym.imp.KERNEL32.dll_lstrlenA]
mov esi, eax
inc esi
cmp esi, 0x3fffffff
jle 0x404638
xor eax, eax
jmp 0x40464d
lea eax, [esi + esi]
call fcn.004a0cd0
mov eax, esp
push 3
push esi
push edi
mov esi, eax
call fcn.0040123d
mov ecx, dword [ebp - 0x18]
push eax
call fcn.00405394
push edi
call fcn.0049eec0
pop ecx
mov bl, 1
xor esi, esi
jmp 0x4045fb
call fcn.0049eec0
lea ecx, [ebp - 0x38]
mov dword [esp], str.CSystemCommands::GetSafeEnv__GetEnvironmentVariableA_fails
call fcn.00404bd0
lea eax, [ebp - 0x38]
push eax
mov byte [ebp - 4], 5
call fcn.004017f5
pop ecx
xor edi, edi
push esi
inc edi
push edi
lea ecx, [ebp - 0x38]
mov byte [ebp - 4], 2
call fcn.004058b3
push dword [ebp - 0x1c]
lea eax, [ebp - 0x14]
push eax
call fcn.004049cb
push str.APPDATA
lea eax, [ebp - 0x14]
push eax
mov byte [ebp - 4], 6
call fcn.00404a1a
test eax, eax
jne 0x4046bd
push esi
push 0x1c
jmp 0x4046e9
push str.COMMONAPPDATA
lea eax, [ebp - 0x14]
push eax
call fcn.00404a1a
test eax, eax
jne 0x4046d4
push esi
push 0x23
jmp 0x4046e9
push str.ProgramFiles
lea eax, [ebp - 0x14]
push eax
call fcn.00404a1a
test eax, eax
jne 0x40473f
push esi
push 0x26
lea eax, [ebp + 0x1c]
push eax
push esi
call dword [sym.imp.SHELL32.dll_SHGetSpecialFolderPathW]
cmp eax, edi
jne 0x40473f
mov ecx, dword [ebp - 0x18]
lea eax, [ebp + 0x1c]
push eax
call fcn.00405394
push str.CSystemCommands::GetSafeEnv__using_SHGetSpecialFolderPath__returns:
lea ecx, [ebp - 0x54]
call fcn.00404bd0
push dword [ebp - 0x18]
lea eax, [ebp - 0x54]
push eax
mov byte [ebp - 4], 7
call fcn.00401985
pop ecx
pop ecx
push esi
push edi
lea ecx, [ebp - 0x54]
call fcn.004058b3
mov ecx, dword [ebp - 0x14]
add ecx, 0xfffffff0
call fcn.00401713
mov bl, 1
jmp 0x4045fb
mov ecx, dword [ebp - 0x14]
add ecx, 0xfffffff0
call fcn.00401713
push esi
lea ecx, [ebp]
jmp 0x40476f
push str.CSystemCommands::GetSafeEnv____varName__NULL__quits
lea ecx, [ebp - 0x38]
call fcn.00404bd0
lea eax, [ebp - 0x38]
push eax
mov dword [ebp - 4], edi
call fcn.004017f5
pop ecx
push 0
lea ecx, [ebp - 0x38]
push edi
call fcn.004058b3
xor al, al
lea esp, [ebp - 0x64]
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebx
mov ecx, dword [ebp + 0x224]
xor ecx, ebp
call fcn.0049f533
add ebp, 0x228
leave
ret