Function at 0x1016f90
Capabilities:
Get common file path
Query environment variable
Set current directory
Set environment variable

Disassembly:
mov edi, edi
push ebp
mov ebp, esp
sub esp, 0x240
mov eax, dword [0x102c22c]
mov ecx, dword [ebp + 0x18]
push ebx
push esi
mov esi, dword [ebp + 0x14]
push edi
mov edi, dword [ebp + 8]
mov dword [ebp - 4], eax
mov eax, dword [ebp + 0xc]
mov dword [ebp - 0x22c], ecx
push eax
xor ecx, ecx
inc ecx
push 0x1005378
push ecx
mov dword [ebp - 0x230], edi
mov dword [ebp - 0x218], eax
mov dword [ebp - 0x220], ecx
call fcn.01027a2f
add esp, 0xc
push 0x104
lea eax, [ebp - 0x20c]
push eax
call dword [sym.imp.KERNEL32.dll_GetWindowsDirectoryA]
push esi
push 0x100536c
call dword [sym.imp.KERNEL32.dll_SetEnvironmentVariableA]
mov ebx, 0x1000
push ebx
call sub.msvcrt.dll_malloc
push ebx
mov dword [ebp - 0x210], eax
call sub.msvcrt.dll_malloc
xor esi, esi
cmp dword [ebp - 0x210], esi
pop ecx
pop ecx
mov dword [ebp - 0x228], eax
je 0x10172f7
cmp eax, esi
je 0x10172f7
lea eax, [ebp - 0x240]
push eax
push esi
push dword [ebp - 0x218]
push edi
call dword [sym.imp.UPDSPAPI.dll_UpdSpFindFirstLineA]
test eax, eax
je 0x10172df
push esi
push ebx
push dword [ebp - 0x210]
lea eax, [ebp - 0x240]
push esi
push esi
push esi
push eax
call dword [sym.imp.UPDSPAPI.dll_UpdSpGetLineTextA]
test eax, eax
je 0x10172df
push 0x40
pop ecx
xor eax, eax
mov byte [ebp - 0x108], 0
lea edi, [ebp - 0x107]
rep stosd dword es:[edi], eax
stosw word es:[edi], ax
stosb byte es:[edi], al
mov edi, dword [sym.imp.KERNEL32.dll_SetEnvironmentVariableA]
lea eax, [ebp - 0x20c]
push eax
mov dword [ebp - 0x21c], esi
mov esi, dword [ebp - 0x210]
push 0x1005358
mov dword [ebp - 0x224], 1
call edi
mov eax, esi
cmp byte [eax], 0x2a
jne 0x10170c9
mov dword [ebp - 0x21c], 1
lea esi, [eax + 1]
jmp 0x10170c4
inc esi
cmp byte [esi], 0x20
je 0x10170c3
cmp byte [esi], 0x7e
jne 0x10170ea
inc esi
cmp dword [0x102de54], 0
je 0x10170ea
push esi
push 0x100533c
call fcn.01015c5a
pop ecx
pop ecx
jmp 0x101732b
cmp byte [esi], 0x3f
jne 0x10170fc
and dword [ebp - 0x224], 0
inc esi
cmp byte [esi], 0x20
je 0x10170f6
cmp byte [esi], 0x23
jne 0x1017128
inc esi
mov eax, esi
jmp 0x101710c
cmp byte [esi], 0x2c
je 0x1017113
inc esi
cmp byte [esi], 0
jne 0x1017106
jmp 0x1017117
mov byte [esi], 0
inc esi
cmp byte [esi], 0x20
je 0x1017116
push eax
call fcn.0100d9c2
test eax, eax
jne 0x1017128
mov byte [esi], al
cmp byte [esi], 0x40
jne 0x1017197
inc esi
mov eax, esi
jmp 0x1017138
cmp byte [esi], 0x2c
je 0x101713f
inc esi
cmp byte [esi], 0
jne 0x1017132
jmp 0x1017143
mov byte [esi], 0
inc esi
cmp byte [esi], 0x20
je 0x1017142
cmp byte [esi], 0
je 0x1017194
push 0
push 0x104
lea ecx, [ebp - 0x108]
push ecx
push eax
push 0
push dword [ebp - 0x230]
call dword [sym.imp.UPDSPAPI.dll_UpdSpGetTargetPathA]
test eax, eax
je 0x1017194
cmp byte [ebp - 0x108], 0
je 0x1017194
lea eax, [ebp - 0x108]
push eax
call dword [sym.imp.KERNEL32.dll_SetCurrentDirectoryA]
lea eax, [ebp - 0x108]
push eax
push 0x1005358
call edi
jmp 0x1017197
mov byte [esi], 0
cmp byte [esi], 0
je 0x101732b
mov edi, dword [ebp - 0x228]
push ebx
push edi
push esi
call dword [sym.imp.KERNEL32.dll_ExpandEnvironmentStringsA]
test eax, eax
je 0x101732b
and dword [ebp - 0x214], 0
cmp dword [ebp - 0x21c], 0
je 0x10171d8
push 0x1005324
call fcn.01015c42
mov esi, 0x106d3c0
jmp 0x10171f2
push edi
push 0x100530c
mov esi, 0x106d3c0
push esi
call sub.ntdll.dll_sprintf
add esp, 0xc
push esi
call fcn.01015c42
cmp byte [ebp - 0x108], 0
je 0x1017226
cmp dword [ebp - 0x21c], 0
je 0x101720b
push 0x10052f4
jmp 0x1017221
lea eax, [ebp - 0x108]
push eax
push 0x10052dc
push esi
call sub.ntdll.dll_sprintf
add esp, 0xc
push esi
call fcn.01015c42
lea eax, [ebp - 0x214]
push eax
push dword [ebp + 0x10]
push edi
call fcn.01014dd5
test eax, eax
jne 0x101726b
cmp dword [ebp - 0x21c], eax
push dword [ebp - 0x214]
push dword [ebp - 0x218]
je 0x101725d
push 0x1005288
call fcn.01015c5a
add esp, 0xc
jmp 0x101726b
push edi
push 0x1005230
call fcn.01015c5a
add esp, 0x10
lea eax, [ebp - 0x20c]
push eax
call dword [sym.imp.KERNEL32.dll_SetCurrentDirectoryA]
push dword [ebp - 0x214]
push 0x100521c
push ebx
push esi
call sub.ntdll.dll__snprintf
add esp, 0x10
push esi
call fcn.01015c42
cmp dword [ebp - 0x224], 0
jne 0x101732b
mov ecx, dword [ebp - 0x214]
cmp ecx, 0xbc2
jne 0x10172bc
mov eax, dword [ebp - 0x22c]
mov dword [eax], 1
jmp 0x101732b
test ecx, ecx
je 0x101732b
xor eax, eax
mov dword [ebp - 0x220], eax
cmp ecx, dword [eax + 0x102c264]
je 0x1017321
add eax, 4
cmp eax, 0xc
jb 0x10172c8
push ecx
call dword [sym.imp.KERNEL32.dll_SetLastError]
push dword [ebp - 0x210]
call sub.msvcrt.dll_free
push dword [ebp - 0x228]
call sub.msvcrt.dll_free
pop ecx
pop ecx
push dword [ebp - 0x218]
push 0x1005200
push 1
call fcn.01027a2f
mov ecx, dword [ebp - 4]
mov eax, dword [ebp - 0x220]
add esp, 0xc
pop edi
pop esi
pop ebx
call fcn.0101439a
leave
ret 0x14
mov dword [ebp - 0x220], 1
lea eax, [ebp - 0x240]
push eax
push eax
call dword [sym.imp.UPDSPAPI.dll_UpdSpFindNextLine]
test eax, eax
je 0x10172df
xor eax, eax
push eax
push ebx
push dword [ebp - 0x210]
push eax
push eax
push eax
lea eax, [ebp - 0x240]
push eax
call dword [sym.imp.UPDSPAPI.dll_UpdSpGetLineTextA]
test eax, eax
je 0x10172df
xor esi, esi
jmp 0x101706c