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

Disassembly:
mov eax, dword fs:[0]
push 0xffffffffffffffff
push 0x626716
push eax
mov dword fs:[0], esp
sub esp, 0x430
push ebx
push ebp
push esi
mov esi, dword [esp + 0x44c]
test esi, esi
push edi
je 0x51874b
mov ebp, dword [esp + 0x454]
test ebp, ebp
je 0x51874b
mov edi, dword [esp + 0x458]
test edi, edi
je 0x51874b
push esi
call fcn.0042ba50
mov ebx, eax
add esp, 4
cmp ebx, edi
jb 0x5183af
mov dword [0x6a2b14], 0xea
push 0xea
jmp 0x518757
lea ecx, [edi + edi]
xor eax, eax
mov edx, ecx
mov edi, ebp
shr ecx, 2
rep stosd dword es:[edi], eax
mov ecx, edx
push esi
and ecx, 3
push ebp
rep stosb byte es:[edi], al
call fcn.0042ba2b
mov ax, word [esi]
mov edi, 0x5c
add esp, 8
cmp ax, di
jne 0x518686
push 0xc
push str.SystemRoot_
push esi
call fcn.0042c1ff
add esp, 0xc
test eax, eax
jne 0x5184bf
mov ecx, 0x81
lea edi, [esp + 0x32]
mov word [esp + 0x30], ax
push 0x104
rep stosd dword es:[edi], eax
stosw word es:[edi], ax
lea eax, [esp + 0x34]
add esi, 0x18
push eax
call dword [sym.imp.KERNEL32.dll_GetSystemDirectoryW]
test eax, eax
jbe 0x51849a
lea ecx, [esp + 0x30]
push 0x5c
push ecx
call fcn.0042b9c1
add esp, 8
test eax, eax
je 0x518438
mov word [eax], 0
lea edx, [esp + 0x30]
test edx, edx
je 0x518493
test esi, esi
mov edi, 0x7a
je 0x518469
mov ecx, dword [esp + 0x458]
lea eax, [esp + 0x30]
push esi
push eax
push 0x674e50
push ecx
push ebp
call fcn.0042c8cf
add esp, 0x14
xor edi, edi
jmp 0x5184a2
lea edx, [esp + 0x30]
push edx
call fcn.0042ba50
mov ecx, dword [esp + 0x45c]
add esp, 4
cmp ecx, eax
jbe 0x5184a2
lea eax, [esp + 0x30]
push eax
push ebp
call fcn.0042ba2b
add esp, 8
xor edi, edi
jmp 0x5184a2
mov edi, 0x57
jmp 0x5184a2
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov edi, eax
test edi, edi
mov dword [0x6a2b14], edi
je 0x5184b3
push edi
call dword [sym.imp.KERNEL32.dll_SetLastError]
xor eax, eax
test edi, edi
sete al
jmp 0x51875f
push 8
push str.__UNC_
push esi
call fcn.0042c1ff
add esp, 0xc
test eax, eax
je 0x51866c
push 8
push str._UNC_
push esi
call fcn.0042c1ff
add esp, 0xc
test eax, eax
je 0x51866c
push 8
push str..UNC_
push esi
call fcn.0042c1ff
add esp, 0xc
test eax, eax
je 0x51866c
push 4
push 0x679fa4
push esi
call fcn.0042c1ff
add esp, 0xc
test eax, eax
je 0x51863f
push 4
push str.__
push esi
call fcn.0042c1ff
add esp, 0xc
test eax, eax
je 0x51863f
push 4
push str.._
push esi
call fcn.0042c1ff
add esp, 0xc
test eax, eax
je 0x51863f
push 0x10
push 0x679f7c
push esi
call fcn.0042c1ff
add esp, 0xc
test eax, eax
jne 0x5186da
lea ecx, [esp + 0x20]
call fcn.0044c860
xor ebx, ebx
lea ecx, [esp + 0x10]
mov dword [esp + 0x448], ebx
call fcn.0044c860
lea ecx, [esp + 0x10]
lea edx, [esp + 0x20]
push ecx
push edx
mov byte [esp + 0x450], 1
call fcn.00533480
mov eax, dword [esp + 0x1c]
add esp, 8
test eax, eax
jle 0x518615
mov eax, dword [esp + 0x10]
mov eax, dword [eax + ebx*4]
mov edi, dword [eax - 8]
test edi, edi
jbe 0x5185d1
push edi
push esi
push eax
call fcn.0042c1ff
add esp, 0xc
test eax, eax
jne 0x5185d1
mov ax, word [esi + edi*2]
cmp ax, 0x5c
je 0x5185dc
cmp ax, 0x2f
je 0x5185dc
mov eax, dword [esp + 0x14]
inc ebx
cmp ebx, eax
jl 0x5185a4
jmp 0x518615
push esi
call fcn.0042ba50
mov ecx, dword [esp + 0x45c]
sub eax, edi
add eax, 2
add esp, 4
cmp eax, ecx
jae 0x518615
mov ecx, dword [esp + 0x20]
push 2
mov ebx, dword [ecx + ebx*4]
push ebx
push ebp
call fcn.0042ba6d
lea edx, [esi + edi*2]
lea eax, [ebp + 4]
push edx
push eax
call fcn.0042ba2b
add esp, 0x14
lea ecx, [esp + 0x10]
mov byte [esp + 0x448], 0
call fcn.0044c870
lea ecx, [esp + 0x20]
mov dword [esp + 0x448], 0xffffffff
call fcn.0044c870
jmp 0x5186da
cmp ebx, 7
jb 0x518660
cmp word [esi + 0xa], 0x3a
jne 0x518660
cmp word [esi + 0xc], di
jne 0x518660
add esi, 8
push esi
push ebp
call fcn.0042ba2b
add esp, 8
jmp 0x5186da
mov word [ebp + 2], di
mov word [ebp + 4], 0x2e
jmp 0x5186da
add esi, 0x10
lea ecx, [ebp + 4]
push esi
push ecx
mov word [ebp], di
mov word [ebp + 2], di
call fcn.0042ba2b
add esp, 8
jmp 0x5186da
cmp ax, 0x25
jne 0x5186da
lea edi, [esi + 2]
push 0x25
push edi
call fcn.0042c00c
push 0x5c
push edi
mov ebx, eax
call fcn.0042c00c
add esp, 0x10
test ebx, ebx
je 0x5186da
test eax, eax
je 0x5186da
cmp ebx, eax
jae 0x5186da
mov edx, dword [esp + 0x458]
lea edi, [edx - 1]
push edi
push ebp
push esi
call dword [sym.imp.KERNEL32.dll_ExpandEnvironmentStringsW]
test eax, eax
je 0x51875d
cmp eax, edi
ja 0x51875d
mov word [ebp + eax*2 - 2], 0
push ebp
call fcn.005191e0
add esp, 4
test eax, eax
je 0x518744
mov ecx, 0x103
xor eax, eax
lea edi, [esp + 0x32]
mov word [esp + 0x30], 0
rep stosd dword es:[edi], eax
stosw word es:[edi], ax
lea eax, [esp + 0x30]
push 0x208
push eax
push ebp
call fcn.00518ea0
add esp, 0xc
test eax, eax
je 0x518744
lea ecx, [esp + 0x30]
push ecx
call fcn.0042ba50
mov esi, eax
mov eax, dword [esp + 0x45c]
add esp, 4
cmp esi, eax
jge 0x518744
lea edx, [esp + 0x30]
push esi
push edx
push ebp
call fcn.0042ba6d
add esp, 0xc
mov word [ebp + esi*2], 0
mov eax, 1
jmp 0x51875f
mov dword [0x6a2b14], 0x57
push 0x57
call dword [sym.imp.KERNEL32.dll_SetLastError]
xor eax, eax
mov ecx, dword [esp + 0x440]
pop edi
pop esi
pop ebp
pop ebx
mov dword fs:[0], ecx
add esp, 0x43c
ret