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

Disassembly:
push ebp
lea ebp, [esp - 0x228]
sub esp, 0x228
push 0xffffffffffffffff
push 0x4adca0
mov eax, dword fs:[0]
push eax
sub esp, 0x44
mov eax, dword [0x4d25ac]
xor eax, ebp
mov dword [ebp + 0x224], eax
push ebx
push esi
push edi
push eax
lea eax, [ebp - 0xc]
mov dword fs:[0], eax
xor eax, eax
mov ebx, ecx
mov edi, edx
mov word [ebp - 0x24], ax
push 0x2c
mov eax, str.CSystemCommands::GetSafeEnv____bool____start
lea esi, [ebp - 0x28]
mov dword [ebp - 0x30], ebx
mov dword [ebp - 0x2c], edi
mov dword [ebp - 0x10], 7
mov dword [ebp - 0x14], 0
call fcn.00401f30
mov ecx, esi
push ecx
mov dword [ebp - 4], 0
call fcn.00403780
add esp, 4
mov dword [ebp - 4], 0xffffffff
cmp dword [ebp - 0x10], 8
jb 0x4071c1
mov edx, dword [ebp - 0x24]
push edx
call fcn.00491101
add esp, 4
push 0
mov eax, 0x4b49f8
mov esi, edi
call fcn.00401f30
test ebx, ebx
je 0x40747f
mov eax, ebx
lea edx, [eax + 1]
lea esp, [esp]
mov cl, byte [eax]
inc eax
test cl, cl
jne 0x4071e0
sub eax, edx
je 0x40747f
push ebx
call dword [sym.imp.KERNEL32.dll_lstrlenA]
mov edi, eax
inc edi
cmp edi, 0x3fffffff
jle 0x407205
xor eax, eax
jmp 0x40721a
lea eax, [edi + edi]
call fcn.0049a5e0
mov esi, esp
push 3
mov edx, edi
mov eax, ebx
call fcn.00404150
xor ebx, ebx
xor ecx, ecx
mov word [ebp + 4], cx
mov edi, 7
mov ecx, eax
mov dword [ebp + 0x18], edi
mov dword [ebp + 0x14], ebx
lea esi, [ecx + 2]
mov dx, word [ecx]
add ecx, 2
cmp dx, bx
jne 0x407232
sub ecx, esi
sar ecx, 1
push ecx
lea esi, [ebp]
call fcn.00401f30
mov dword [ebp - 4], 2
xor edx, edx
push 0x24
mov eax, str.CSystemCommands::GetSafeEnv__varName
lea esi, [ebp - 0x28]
mov dword [ebp - 0x10], edi
mov dword [ebp - 0x14], ebx
mov word [ebp - 0x24], dx
call fcn.00401f30
mov eax, esi
push eax
lea ecx, [ebp]
mov byte [ebp - 4], 3
call fcn.004035d0
add esp, 4
mov byte [ebp - 4], 2
cmp dword [ebp - 0x10], 8
jb 0x407294
mov ecx, dword [ebp - 0x24]
push ecx
call fcn.00491101
add esp, 4
push 0x104
call fcn.0048ffb8
mov edi, dword [ebp - 0x30]
add esp, 4
push 0
push 0
push edi
call dword [sym.imp.KERNEL32.dll_GetEnvironmentVariableA]
mov esi, eax
test esi, esi
jbe 0x4072cd
push esi
call fcn.0048ffb8
add esp, 4
push esi
mov ebx, eax
push ebx
push edi
call dword [sym.imp.KERNEL32.dll_GetEnvironmentVariableA]
mov esi, eax
test esi, esi
jne 0x4073d5
mov eax, str.CSystemCommands::GetSafeEnv__GetEnvironmentVariableA_fails
lea ecx, [ebp - 0x28]
call fcn.00401fe0
lea edx, [ebp - 0x28]
push edx
mov byte [ebp - 4], 4
call fcn.00403780
add esp, 4
mov byte [ebp - 4], 2
cmp dword [ebp - 0x10], 8
jb 0x407306
mov eax, dword [ebp - 0x24]
push eax
call fcn.00491101
add esp, 4
push str.APPDATA
push edi
call fcn.004a1115
add esp, 8
test eax, eax
jne 0x407321
push eax
push 0x1c
lea ecx, [ebp + 0x1c]
push ecx
jmp 0x407355
push str.COMMONAPPDATA
push edi
call fcn.004a1115
add esp, 8
test eax, eax
jne 0x40733c
push eax
push 0x23
lea edx, [ebp + 0x1c]
push edx
jmp 0x407355
push str.ProgramFiles
push edi
call fcn.004a1115
add esp, 8
test eax, eax
jne 0x407361
push eax
push 0x26
lea eax, [ebp + 0x1c]
push eax
push 0
call dword [sym.imp.SHELL32.dll_SHGetSpecialFolderPathW]
test eax, eax
jne 0x407393
mov eax, str.CSystemCommands::GetSafeEnv__failed_to_read_folder_name
lea ecx, [ebp - 0x4c]
call fcn.00401fe0
lea ecx, [ebp - 0x4c]
push ecx
mov byte [ebp - 4], 5
call fcn.00403780
add esp, 4
lea esi, [ebp - 0x4c]
call fcn.0040a810
lea esi, [ebp]
call fcn.0040a810
jmp 0x4074c6
mov esi, dword [ebp - 0x2c]
push esi
lea eax, [ebp + 0x1c]
call fcn.00403350
mov eax, str.CSystemCommands::GetSafeEnv__using_SHGetSpecialFolderPath__returns:
lea ecx, [ebp - 0x4c]
call fcn.00401fe0
lea edx, [ebp - 0x4c]
push edx
mov ecx, esi
mov byte [ebp - 4], 6
call fcn.004035d0
add esp, 4
lea esi, [ebp - 0x4c]
call fcn.0040a810
lea esi, [ebp]
call fcn.0040a810
mov al, 1
jmp 0x4074c8
test ebx, ebx
jne 0x4073dd
xor eax, eax
jmp 0x407408
push ebx
call dword [sym.imp.KERNEL32.dll_lstrlenA]
mov edi, eax
inc edi
cmp edi, 0x3fffffff
jle 0x4073f3
xor eax, eax
jmp 0x407408
lea eax, [edi + edi]
call fcn.0049a5e0
mov esi, esp
push 3
mov edx, edi
mov eax, ebx
call fcn.00404150
mov ecx, eax
lea esi, [ecx + 2]
lea ecx, [ecx]
mov dx, word [ecx]
add ecx, 2
test dx, dx
jne 0x407410
sub ecx, esi
mov esi, dword [ebp - 0x2c]
sar ecx, 1
push ecx
call fcn.00401f30
test ebx, ebx
je 0x407435
push ebx
call fcn.00491101
add esp, 4
mov eax, str.CSystemCommands::GetSafeEnv__returns:
lea ecx, [ebp - 0x4c]
call fcn.00401fe0
lea eax, [ebp - 0x4c]
push eax
mov ecx, esi
mov byte [ebp - 4], 7
call fcn.004035d0
mov esi, 8
add esp, 4
cmp dword [ebp - 0x34], esi
jb 0x40746a
mov ecx, dword [ebp - 0x48]
push ecx
call fcn.00491101
add esp, 4
cmp dword [ebp + 0x18], esi
jb 0x40747b
mov edx, dword [ebp + 4]
push edx
call fcn.00491101
add esp, 4
mov al, 1
jmp 0x4074c8
xor eax, eax
mov word [ebp - 0x24], ax
push 0x35
mov eax, str.CSystemCommands::GetSafeEnv____varName__NULL__quits
lea esi, [ebp - 0x28]
mov dword [ebp - 0x10], 7
mov dword [ebp - 0x14], 0
call fcn.00401f30
mov ecx, esi
push ecx
mov dword [ebp - 4], 1
call fcn.00403780
add esp, 4
cmp dword [ebp - 0x10], 8
jb 0x4074c6
mov edx, dword [ebp - 0x24]
push edx
call fcn.00491101
add esp, 4
xor al, al
lea esp, [ebp - 0x60]
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.0049110c
add ebp, 0x228
mov esp, ebp
pop ebp
ret