Function at 0x4718dc
Capabilities:
Get common file path
Identify system language via api
Query environment variable

Disassembly:
push ebp
mov ebp, esp
push esi
push edi
push ebx
sub esp, 0xb64
mov esi, edx
mov dword [ebp - 0xb50], ecx
mov ebx, eax
mov eax, dword [0x4f195c]
xor eax, ebp
mov dword [ebp - 0x10], eax
cmp dword [esi], 3
je 0x472541
mov eax, dword [ebx + 0x118]
cmp eax, 0xfffffffc
je 0x4724e1
cmp eax, 0xfffffffd
je 0x471951
cmp eax, 0xfffffffe
jne 0x47193a
test byte [ebx + 0x195], 4
je 0x471c7b
test byte [ebx + 0x18c], 1
jne 0x471c7b
jmp 0x471974
cmp eax, 0xffffffff
jne 0x47197a
test byte [ebx + 0x195], 4
je 0x471beb
jmp 0x4725a1
movzx edx, byte [ebx + 0x195]
test dl, 4
je 0x471d0b
test byte [ebx + 0x18c], 1
jne 0x471d0b
jne 0x471c7b
jne 0x471beb
mov edx, dword [esi + 4]
test edx, edx
je 0x4719cf
mov eax, dword [esi + 8]
cmp eax, 0x104
jl 0x471990
mov eax, 0x104
push eax
push edx
mov dword [ebp - 0xb4c], eax
lea edx, [ebp - 0x21a]
push edx
mov dword [ebp - 0xb58], edx
call fcn.004a0860
add esp, 0xc
mov edi, dword [ebp - 0xb58]
mov eax, dword [ebp - 0xb4c]
mov dword [ebp - 0xb54], 1
mov byte [edi + eax], 0
movsx edx, byte [edi]
jmp 0x471d96
xor edx, edx
mov dword [ebp - 0xb4c], edx
mov dword [ebp - 0xb58], edx
cmp dword [0x4f1980], 0
je 0x471f4d
mov edx, dword [0x4f19f0]
push eax
push str.FORT_d
lea eax, [ebp - 0x21a]
push eax
call edx
add esp, 0xc
push 0x105
lea eax, [ebp - 0x31f]
push eax
lea edx, [ebp - 0x21a]
push edx
call dword [sym.imp.KERNEL32.dll_GetEnvironmentVariableA]
test eax, eax
jbe 0x471a29
cmp eax, 0x105
jae 0x471a29
inc eax
jmp 0x471a30
mov byte [ebp - 0x31f], 0
test eax, eax
je 0x471a59
dec eax
lea edi, [ebp - 0x31f]
mov dword [ebp - 0xb58], edi
mov dword [ebp - 0xb4c], eax
movsx edx, byte [edi]
mov dword [ebp - 0xb54], 1
jmp 0x471d96
mov eax, dword [ebx + 0x118]
add eax, 4
mov dword [ebp - 0xb58], 0
cmp eax, 0xa
ja 0x471b0c
movzx eax, byte [eax + str.66ee]
add eax, 0x471a84
jmp eax
mov dword [ebp - 0xb54], 1
test byte [ebx + 0x195], 4
jne 0x471bd0
test byte [ebx + 0x18d], 0x20
je 0x471b6f
mov edi, dword [ebx + 0x74]
mov ecx, edi
mov dword [ebp - 0xb58], edi
xor eax, eax
movzx edx, byte [ecx + eax]
test edx, edx
je 0x471b4e
movzx edx, byte [ecx + eax + 1]
add eax, 2
test edx, edx
jne 0x471b39
dec eax
mov dword [ebp - 0xb4c], eax
cmp dword [esi], 0
je 0x471b67
mov dword [esi], 0
movsx edx, byte [edi]
jmp 0x471d96
movsx edx, byte [edi]
jmp 0x471d96
cmp dword [0x4f1980], 0
je 0x471f43
mov edx, dword [0x4f19f0]
push dword [ebx + 0x118]
push str.fort._d
lea eax, [ebp - 0x21a]
push eax
call edx
add esp, 0xc
lea ecx, [ebp - 0x21a]
xor eax, eax
movzx edx, byte [ecx + eax]
test edx, edx
je 0x471bb6
movzx edx, byte [ecx + eax + 1]
add eax, 2
test edx, edx
jne 0x471ba1
dec eax
mov dword [ebp - 0xb4c], eax
lea edi, [ebp - 0x21a]
mov dword [ebp - 0xb58], edi
movsx edx, byte [edi]
jmp 0x471d96
xor eax, eax
lea edi, [ebp - 0x21a]
mov dword [ebp - 0xb58], edi
mov byte [edi], al
mov dword [ebp - 0xb4c], eax
jmp 0x471dee
xor eax, eax
mov dword [ebp - 0xb4c], eax
mov dword [ebp - 0xb58], eax
push 0x105
lea eax, [ebp - 0x31f]
push eax
push str.FOR_PRINT
call dword [sym.imp.KERNEL32.dll_GetEnvironmentVariableA]
test eax, eax
jbe 0x471c1e
cmp eax, 0x105
jae 0x471c1e
inc eax
jmp 0x471c25
mov byte [ebp - 0x31f], 0
test eax, eax
jne 0x471a34
push 0xfffffffffffffff5
call dword [sym.imp.KERNEL32.dll_GetStdHandle]
mov edi, 0x4c7190
mov ecx, edi
mov dword [ebx + 0xfc], eax
mov dword [ebp - 0xb58], edi
xor eax, eax
movzx edx, byte [ecx + eax]
test edx, edx
je 0x471c5f
movzx edx, byte [ecx + eax + 1]
add eax, 2
test edx, edx
jne 0x471c4a
dec eax
mov dword [ebp - 0xb4c], eax
movsx edx, byte [0x4c7190]
mov dword [ebp - 0xb54], 0
jmp 0x471d96
xor eax, eax
mov dword [ebp - 0xb4c], eax
mov dword [ebp - 0xb58], eax
push 0x105
lea eax, [ebp - 0x31f]
push eax
push str.FOR_TYPE
call dword [sym.imp.KERNEL32.dll_GetEnvironmentVariableA]
test eax, eax
jbe 0x471cae
cmp eax, 0x105
jae 0x471cae
inc eax
jmp 0x471cb5
mov byte [ebp - 0x31f], 0
test eax, eax
jne 0x471a34
push 0xfffffffffffffff5
call dword [sym.imp.KERNEL32.dll_GetStdHandle]
mov edi, 0x4c7190
mov ecx, edi
mov dword [ebx + 0xfc], eax
mov dword [ebp - 0xb58], edi
xor eax, eax
movzx edx, byte [ecx + eax]
test edx, edx
je 0x471cef
movzx edx, byte [ecx + eax + 1]
add eax, 2
test edx, edx
jne 0x471cda
dec eax
mov dword [ebp - 0xb4c], eax
movsx edx, byte [0x4c7190]
mov dword [ebp - 0xb54], 0
jmp 0x471d96
xor eax, eax
mov dword [ebp - 0xb4c], eax
mov dword [ebp - 0xb58], eax
push 0x105
lea eax, [ebp - 0x31f]
push eax
push str.FOR_ACCEPT
call dword [sym.imp.KERNEL32.dll_GetEnvironmentVariableA]
test eax, eax
jbe 0x471d3e
cmp eax, 0x105
jae 0x471d3e
inc eax
jmp 0x471d45
mov byte [ebp - 0x31f], 0
test eax, eax
jne 0x471a34
push 0xfffffffffffffff6
call dword [sym.imp.KERNEL32.dll_GetStdHandle]
mov edi, str.CONIN_
mov ecx, edi
mov dword [ebx + 0xfc], eax
mov dword [ebp - 0xb58], edi
xor eax, eax
movzx edx, byte [ecx + eax]
test edx, edx
je 0x471d7f
movzx edx, byte [ecx + eax + 1]
add eax, 2
test edx, edx
jne 0x471d6a
dec eax
mov dword [ebp - 0xb4c], eax
movsx edx, byte [str.CONIN_]
mov dword [ebp - 0xb54], 0
cmp edx, 0x20
jne 0x471dd0
test eax, eax
jle 0x471dec
inc edi
dec eax
cmp byte [edi], 0x20
jne 0x471dc4
test eax, eax
jle 0x4724ca
inc edi
dec eax
cmp byte [edi], 0x20
jne 0x471dc4
test eax, eax
jle 0x4724ca
inc edi
dec eax
cmp byte [edi], 0x20
je 0x471db5
mov dword [ebp - 0xb4c], eax
mov dword [ebp - 0xb58], edi
test eax, eax
jle 0x471dec
movsx edx, byte [eax + edi - 1]
test edx, 0xffffffdf
jne 0x471e2f
dec eax
mov dword [ebp - 0xb4c], eax
test eax, eax
jg 0x471dd4
jne 0x471e2f
test byte [ebx + 0x195], 4
je 0x471e2f
mov eax, ebx
lea edx, [ebp - 0xb58]
lea ecx, [ebp - 0xb4c]
call fcn.004725c0
test eax, eax
jne 0x471e16
mov edi, dword [ebp - 0xb58]
jmp 0x471e2f
mov ecx, dword [ebp - 0x10]
xor ecx, ebp
cmp ecx, dword [0x4f195c]
jne 0x471f63
lea esp, [ebp - 0xc]
pop ebx
pop edi
pop esi
pop ebp
ret
cmp dword [ebp - 0xb54], 0
jne 0x471e3f
xor ecx, ecx
jmp 0x471ec4
mov eax, dword [ebp - 0xb4c]
push edi
push ebx
mov byte [edi + eax], 0
call fcn.00445580
add esp, 8
cmp eax, 0xffffffff
je 0x471f78
cmp dword [0x508060], 0
jne 0x471e6f
cmp eax, 0xfffffffa
jne 0x471e6f
mov eax, 1
cmp eax, 1
je 0x471ea8
test eax, eax
jne 0x471e82
push 0xfffffffffffffff6
call dword [sym.imp.KERNEL32.dll_GetStdHandle]
jmp 0x471eb0
cmp eax, 2
jne 0x471e91
push 0xfffffffffffffff4
call dword [sym.imp.KERNEL32.dll_GetStdHandle]
jmp 0x471eb0
mov dword [ebp - 0xb54], 0
mov ecx, 1
mov edi, dword [ebp - 0xb58]
jmp 0x471ec4
push 0xfffffffffffffff5
call dword [sym.imp.KERNEL32.dll_GetStdHandle]
xor ecx, ecx
mov dword [ebx + 0xfc], eax
mov dword [ebp - 0xb54], ecx
mov edi, dword [ebp - 0xb58]
mov esi, dword [ebp - 0xb50]
mov dl, byte [edi]
inc edi
mov byte [esi], dl
inc esi
test dl, dl
jne 0x471eca
cmp dword [0x508060], 0
je 0x471ef1
cmp dword [ebp - 0xb54], 0
jne 0x471f03
cmp dword [ebx + 0xfc], 0xffffffff
je 0x471f68
jmp 0x471f03
cmp dword [ebp - 0xb54], 0
jne 0x471f03
cmp dword [ebx + 0xfc], 0xffffffff
je 0x471f14
test ecx, ecx
jne 0x471f14
mov edx, dword [ebp + 0x14]
mov eax, dword [ebp - 0xb54]
mov dword [edx], eax
jmp 0x471f1d
mov eax, dword [ebp + 0x14]
mov dword [eax], 1
mov ecx, dword [ebp - 0x10]
xor ecx, ebp
cmp ecx, dword [0x4f195c]
jne 0x471f63
xor eax, eax
lea esp, [ebp - 0xc]
pop ebx
pop edi
pop esi
pop ebp
ret
call fcn.004a0af0
jmp 0x471b7c
call fcn.004a0af0
mov edx, dword [0x4f19f0]
mov eax, dword [ebx + 0x118]
jmp 0x4719f0
call fcn.004a91cc
test ecx, ecx
jne 0x471f14
mov dword [ebx + 0xfc], 0
jmp 0x471f07
mov eax, dword [esi + 0xc]
test byte [ebx + 0x195], 8
jne 0x471f8e
test eax, eax
je 0x47208e
jmp 0x471f96
test eax, eax
je 0x4724ab
mov edi, dword [esi + 0x10]
cmp edi, 0x103
jg 0x472495
push edi
push eax
lea eax, [ebp - 0x115]
push eax
call fcn.004a0860
add esp, 0xc
mov byte [ebp + edi - 0x115], 0
lea edx, [ebp - 0x115]
cmp byte [edx], 0x20
jne 0x471fd4
test edi, edi
jle 0x471fed
inc edx
dec edi
cmp byte [edx], 0x20
je 0x471fc9
test edi, edi
jle 0x471fed
movsx eax, byte [edi + edx - 1]
test eax, 0xffffffdf
jne 0x472481
dec edi
test edi, edi
jg 0x471fd8
mov dword [ebp - 0xb60], 0
cmp dword [esi], 3
je 0x47234c
mov eax, edi
add eax, dword [ebp - 0xb4c]
add eax, dword [ebp - 0xb60]
cmp eax, 0x104
jle 0x472033
mov ecx, dword [ebp - 0x10]
xor ecx, ebp
cmp ecx, dword [0x4f195c]
jne 0x471f63
mov eax, 0x2b
lea esp, [ebp - 0xc]
pop ebx
pop edi
pop esi
pop ebp
ret
push edi
push edx
push dword [ebp - 0xb50]
call fcn.004a0860
add esp, 0xc
mov eax, dword [ebp - 0xb50]
cmp dword [ebp - 0xb60], 0
lea eax, [edi + eax]
je 0x472058
mov byte [eax], 0x5c
push dword [ebp - 0xb4c]
push dword [ebp - 0xb58]
add eax, dword [ebp - 0xb60]
push eax
call fcn.004a0860
add esp, 0xc
mov eax, dword [ebp - 0xb4c]
add eax, dword [ebp - 0xb50]
add edi, dword [ebp - 0xb60]
mov byte [edi + eax], 0
jmp 0x471f07
call dword [sym.imp.KERNEL32.dll_GetUserDefaultLangID]
movzx eax, ax
cmp eax, 0x411
je 0x4720b2
call dword [sym.imp.KERNEL32.dll_GetSystemDefaultLangID]
movzx eax, ax
cmp eax, 0x411
jne 0x472295
mov ecx, dword [ebp - 0xb58]
xor eax, eax
movzx edx, byte [ecx + eax]
test edx, edx
je 0x4720cf
movzx edx, byte [ecx + eax + 1]
add eax, 2
test edx, edx
jne 0x4720ba
dec eax
xor edi, edi
test eax, eax
jbe 0x4720fd
movzx eax, byte [edi + ecx]
mov word [ebp + edi*2 - 0x838], ax
xor eax, eax
movzx edx, byte [ecx + eax]
test edx, edx
je 0x4720f8
movzx edx, byte [ecx + eax + 1]
add eax, 2
test edx, edx
jne 0x4720e3
dec eax
inc edi
cmp edi, eax
jb 0x4720d5
xor eax, eax
lea edx, [ebp - 0xa42]
push eax
push edx
push 0x105
mov word [ebp + edi*2 - 0x838], ax
lea ecx, [ebp - 0x838]
push ecx
call dword [sym.imp.KERNEL32.dll_GetFullPathNameW]
mov dword [ebp - 0xb5c], eax
cmp dword [ebp - 0xb5c], 0
je 0x4722cb
cmp dword [ebp - 0xb5c], 0x105
jae 0x4722cb
cmp dword [ebp - 0xb5c], 0
jbe 0x4721a4
mov ecx, eax
shr ecx, 1
test ecx, ecx
jbe 0x4722d4
xor edi, edi
movzx edx, word [ebp + edi*4 - 0xa42]
movzx eax, word [ebp + edi*4 - 0xa40]
mov byte [ebp + edi*2 - 0x115], dl
mov byte [ebp + edi*2 - 0x114], al
lea eax, [edi + edi + 2]
inc edi
cmp edi, ecx
jb 0x47215b
lea ecx, [edi + edi + 1]
lea edx, [ecx - 1]
cmp edx, dword [ebp - 0xb5c]
jae 0x4721a6
movzx eax, word [ebp + edx*2 - 0xa42]
mov byte [ebp + ecx - 0x116], al
mov eax, ecx
jmp 0x4721a6
xor eax, eax
mov byte [ebp + eax - 0x115], 0
mov eax, dword [ebp - 0xb4c]
neg eax
add eax, dword [ebp - 0xb5c]
mov dword [ebp - 0xb60], eax
lea edx, [eax - 1]
mov dword [ebp - 0xb64], edx
test edx, edx
jle 0x4722cb
cmp dword [ebp - 0xb64], 0x60
jle 0x4722e0
xor eax, eax
lea edi, [ebp - 0x424]
lea ecx, [ebp - 0x115]
sub edi, ecx
mov ecx, dword [ebp - 0xb64]
cmp edi, ecx
setg al
xor edx, edx
neg edi
cmp edi, ecx
setg dl
or eax, edx
je 0x4722e0
push dword [ebp - 0xb64]
lea eax, [ebp - 0x115]
push eax
lea edx, [ebp - 0x424]
push edx
call fcn.004a0860
add esp, 0xc
mov eax, dword [ebp - 0xb64]
lea ecx, [ebp - 0x424]
mov byte [ebp + eax - 0x424], 0
xor eax, eax
movzx edx, byte [ecx + eax]
test edx, edx
je 0x472253
movzx edx, byte [ecx + eax + 1]
add eax, 2
test edx, edx
jne 0x47223e
dec eax
mov edx, eax
test edx, edx
jbe 0x47227b
xor ecx, ecx
xor eax, eax
movzx edi, byte [ebp + eax - 0x424]
test edi, 0x80
je 0x472272
mov ecx, 1
inc eax
cmp eax, edx
jb 0x47225d
test ecx, ecx
jne 0x4722cb
mov edx, dword [ebp - 0xb5c]
lea eax, [ebp - 0x115]
mov dword [ebp - 0xb58], eax
mov dword [ebp - 0xb4c], edx
jmp 0x4722cb
lea eax, [ebp - 0xb64]
push eax
lea edi, [ebp - 0x115]
push edi
push 0x105
push dword [ebp - 0xb58]
call dword [sym.imp.KERNEL32.dll_GetFullPathNameA]
test eax, eax
je 0x4722cb
cmp eax, 0x105
jae 0x4722cb
mov dword [ebp - 0xb58], edi
mov dword [ebp - 0xb4c], eax
xor edx, edx
xor edi, edi
jmp 0x471fed
xor eax, eax
mov ecx, 1
jmp 0x472186
mov eax, dword [ebp - 0xb64]
shr eax, 0x1f
mov edx, dword [ebp - 0xb60]
lea edi, [eax + edx - 1]
sar edi, 1
test edi, edi
jbe 0x472345
xor ecx, ecx
movzx edx, byte [ebp + ecx*2 - 0x115]
movzx eax, byte [ebp + ecx*2 - 0x114]
mov byte [ebp + ecx*2 - 0x424], dl
mov byte [ebp + ecx*2 - 0x423], al
inc ecx
cmp ecx, edi
jb 0x4722fb
lea edx, [ecx + ecx + 1]
lea eax, [edx - 1]
cmp eax, dword [ebp - 0xb64]
jae 0x472228
movzx eax, byte [ebp + edx - 0x116]
mov byte [ebp + edx - 0x425], al
jmp 0x472228
mov edx, 1
jmp 0x472322
test byte [ebx + 0x18d], 0x20
jne 0x472000
push 0x105
mov dword [ebp - 0xb60], edx
lea eax, [ebp - 0x529]
push eax
push str.FORT_TMPDIR
call dword [sym.imp.KERNEL32.dll_GetEnvironmentVariableA]
mov edx, dword [ebp - 0xb60]
test eax, eax
ja 0x472470
mov byte [ebp - 0x529], 0
cmp dword [esi + 0xc], 0
je 0x472406
push 0x105
push 0
mov dword [ebp - 0xb60], edx
lea edi, [ebp - 0x62e]
push edi
call fcn.004a08c0
mov edx, dword [ebp - 0xb60]
add esp, 0xc
push edi
push 0
push 0x4cebcc
push edx
call dword [sym.imp.KERNEL32.dll_GetTempFileNameA]
test eax, eax
je 0x4723ea
test byte [ebx + 0x195], 8
je 0x4723d5
lea edi, [ebp - 0x62c]
mov esi, dword [ebp - 0xb50]
mov dl, byte [edi]
inc edi
mov byte [esi], dl
inc esi
test dl, dl
jne 0x4723db
jmp 0x471f07
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov ecx, dword [ebp - 0x10]
xor ecx, ebp
cmp ecx, dword [0x4f195c]
jne 0x471f63
jmp 0x472026
test byte [ebx + 0x195], 8
je 0x472425
mov byte [ebp - 0xb48], 0x2e
lea edx, [ebp - 0xb48]
mov byte [edx + 1], 0
jmp 0x472391
test eax, eax
je 0x47244a
lea esi, [ebp - 0xb48]
lea edi, [ebp - 0x529]
mov dl, byte [edi]
inc edi
mov byte [esi], dl
inc esi
test dl, dl
jne 0x472435
lea edx, [ebp - 0xb48]
jmp 0x472391
lea esi, [ebp - 0xb48]
push esi
push 0x104
call dword [sym.imp.KERNEL32.dll_GetTempPathA]
test eax, eax
mov edx, esi
jne 0x472391
mov edx, 0
jmp 0x472391
cmp eax, 0x105
jae 0x472384
inc eax
jmp 0x47238b
xor eax, eax
cmp byte [edi + edx], 0x5c
setne al
mov dword [ebp - 0xb60], eax
jmp 0x471ff7
mov ecx, dword [ebp - 0x10]
xor ecx, ebp
cmp ecx, dword [0x4f195c]
jne 0x471f63
jmp 0x472026
cmp dword [esi], 3
jne 0x4724bd
test byte [ebx + 0x18d], 0x20
je 0x47208e
mov edi, dword [ebp - 0xb58]
xor ecx, ecx
jmp 0x471ec4
mov dword [ebp - 0xb4c], eax
mov dword [ebp - 0xb58], edi
je 0x471dee
jmp 0x471e2f
movzx edx, byte [ebx + 0x195]
test dl, 4
je 0x4724fa
test byte [ebx + 0x18c], 1
je 0x471958
xor eax, eax
mov dword [ebp - 0xb4c], eax
mov dword [ebp - 0xb58], eax
push 0x105
lea eax, [ebp - 0x31f]
push eax
push str.FOR_READ
call dword [sym.imp.KERNEL32.dll_GetEnvironmentVariableA]
test eax, eax
jbe 0x47252d
cmp eax, 0x105
jae 0x47252d
inc eax
jmp 0x472534
mov byte [ebp - 0x31f], 0
test eax, eax
je 0x471d4d
jmp 0x471a34
test byte [ebx + 0x18d], 0x20
jne 0x471905
xor eax, eax
mov dword [ebp - 0xb4c], eax
mov dword [ebp - 0xb58], eax
cmp dword [0x4f1980], 0
je 0x47259a
mov eax, dword [0x4f19f0]
push str.SCRATCH
lea edi, [ebp - 0x21a]
push edi
call eax
add esp, 8
mov dword [ebp - 0xb58], edi
mov dword [ebp - 0xb4c], 7
mov dword [ebp - 0xb54], 1
jmp 0x471e3f
call fcn.004a0af0
jmp 0x472565
test byte [ebx + 0x18c], 1
jne 0x471beb
jmp 0x47197a