Function at 0x401311
Capabilities:
Check os version
Get common file path
Get hostname
Get session user name
Query environment variable
Set environment variable

Disassembly:
push ebp
mov ebp, esp
push 0x148
call fcn.0040a961
push ebx
push ecx
push edx
push esi
push edi
sub esp, 0x10c
push 0
mov eax, dword [0x4142f0]
xor ecx, ecx
xor ebx, ebx
mov edx, 0x4131a6
call fcn.00401010
mov esi, eax
test eax, eax
jne 0x401364
mov dword [ebp - 0x1c], 0x104
lea eax, [ebp - 0x1c]
push eax
lea eax, [ebp - 0x120]
push eax
push 1
call dword [sym.imp.KERNEL32.DLL_GetComputerNameExA]
lea esi, [ebp - 0x120]
push esi
push 0x4131ae
call dword [sym.imp.KERNEL32.DLL_SetEnvironmentVariableA]
push esi
push 0x4131a6
call dword [sym.imp.KERNEL32.DLL_SetEnvironmentVariableA]
push 0
mov eax, dword [0x4142f0]
xor ecx, ecx
xor ebx, ebx
mov edx, 0x4131b9
call fcn.00401010
test eax, eax
je 0x4013a1
push eax
push 0x4131c0
call dword [sym.imp.KERNEL32.DLL_SetEnvironmentVariableA]
push 0
mov eax, dword [0x4142f0]
xor ecx, ecx
xor ebx, ebx
mov edx, 0x4131ca
call fcn.00401010
mov esi, eax
test eax, eax
jne 0x4013da
mov dword [ebp - 0x1c], 0x104
lea eax, [ebp - 0x1c]
push eax
lea eax, [ebp - 0x120]
push eax
call dword [sym.imp.ADVAPI32.DLL_GetUserNameA]
lea esi, [ebp - 0x120]
push esi
push 0x4131cf
call dword [sym.imp.KERNEL32.DLL_SetEnvironmentVariableA]
mov edx, 0x104
lea eax, [ebp - 0x120]
call fcn.0040c0c4
push esi
push 0x4131d7
call dword [sym.imp.KERNEL32.DLL_SetEnvironmentVariableA]
call fcn.0040c107
test eax, eax
je 0x401412
mov eax, 0x4131e2
jmp 0x401417
mov eax, 0x4131e5
push eax
push 0x4131e8
call dword [sym.imp.KERNEL32.DLL_SetEnvironmentVariableA]
mov edx, 0x415728
lea eax, [ebp - 0x120]
call fcn.0040c130
xor eax, eax
lea esi, [ebp - 0x120]
mov dl, byte [esi]
test dl, dl
je 0x40144b
cmp dl, 0x5c
jne 0x401448
mov eax, esi
inc esi
jmp 0x40143b
test eax, eax
je 0x401451
mov byte [eax], dl
lea eax, [ebp - 0x120]
push eax
push 0x4131f4
call dword [sym.imp.KERNEL32.DLL_SetEnvironmentVariableA]
mov ecx, dword [0x4142f4]
test ecx, ecx
jne 0x401492
push ecx
mov eax, dword [0x4142f0]
xor ebx, ebx
mov edx, 0x413201
call fcn.00401010
test eax, eax
je 0x401492
cmp byte [eax], 0
je 0x401492
call fcn.0040c160
mov dword [0x4142f4], eax
cmp dword [0x4142f4], 0
je 0x4014a2
mov eax, 0x413207
jmp 0x4014a7
mov eax, 0x413209
push eax
push 0x41320b
call dword [sym.imp.KERNEL32.DLL_SetEnvironmentVariableA]
push 0
mov eax, dword [0x4142f0]
xor ecx, ecx
mov ebx, 0x413209
mov edx, 0x413214
call fcn.00401010
test eax, eax
je 0x4014ea
cmp byte [eax], 0
je 0x4014ea
call fcn.0040c160
mov dword [0x4142f8], eax
test eax, eax
jge 0x4014ea
xor esi, esi
mov dword [0x4142f8], esi
push 0
mov eax, dword [0x4142f0]
xor ecx, ecx
xor ebx, ebx
mov edx, 0x413224
call fcn.00401010
test eax, eax
je 0x401512
cmp byte [eax], 0
je 0x401512
call fcn.0040c160
mov dword [0x4142fc], eax
push 0
mov eax, dword [0x4142f0]
xor ecx, ecx
xor ebx, ebx
mov edx, 0x413235
call fcn.00401010
test eax, eax
je 0x40153a
cmp byte [eax], 0
je 0x40153a
call fcn.0040c160
mov dword [0x414300], eax
call dword [sym.imp.KERNEL32.DLL_GetVersion]
push eax
push 0x413244
call fcn.0040a9d4
add esp, 8
call dword [sym.imp.KERNEL32.DLL_GetVersion]
and eax, 0xff
cmp eax, 6
setae al
mov edi, eax
and edi, 0xff
xor esi, esi
jmp 0x4015cb
cmp byte [ebp - 0x120], 0
jne 0x40159b
mov eax, esi
shl eax, 4
mov ecx, dword [eax + 0x414314]
test ecx, ecx
je 0x40159b
mov eax, ecx
call fcn.0040c1b0
test eax, eax
je 0x40159b
mov edx, eax
lea eax, [ebp - 0x120]
call fcn.0040c130
mov eax, esi
shl eax, 4
mov ebx, dword [eax + 0x414318]
test ebx, ebx
je 0x4015c1
cmp byte [ebp - 0x120], 0
je 0x4015c1
lea edx, [ebp - 0x120]
push edx
push ebx
call dword [sym.imp.KERNEL32.DLL_SetEnvironmentVariableA]
inc esi
cmp esi, 8
jae 0x4016b2
mov ebx, 0x104
xor edx, edx
lea eax, [ebp - 0x120]
call fcn.0040aa70
test edi, edi
je 0x40163f
mov eax, esi
shl eax, 4
cmp dword [eax + 0x41430c], 0
je 0x40163f
xor ecx, ecx
mov dword [ebp - 0x18], ecx
lea edx, [ebp - 0x18]
push edx
push ecx
push ecx
mov ebx, dword [eax + 0x41430c]
push ebx
call dword [sym.imp.SHELL32.DLL_SHGetKnownFolderPath]
cmp eax, 1
jae 0x40163f
test eax, eax
jne 0x40163f
push eax
push 0x41325c
push 0x104
lea eax, [ebp - 0x120]
push eax
push 0xffffffffffffffff
mov eax, dword [ebp - 0x18]
push eax
push 0x240
push 0
call dword [sym.imp.KERNEL32.DLL_WideCharToMultiByte]
mov edx, dword [ebp - 0x18]
push edx
call dword [sym.imp.OLE32.DLL_CoTaskMemFree]
cmp byte [ebp - 0x120], 0
jne 0x40156b
mov eax, esi
shl eax, 4
mov ecx, dword [eax + 0x414310]
cmp ecx, 0xffffffff
je 0x40156b
lea edx, [ebp - 0x120]
push edx
push 0
push 0
push ecx
push 0
call dword [sym.imp.SHFOLDER.DLL_SHGetFolderPathA]
cmp eax, 1
jae 0x401681
test eax, eax
je 0x40156b
push 0
mov eax, esi
shl eax, 4
mov edx, dword [eax + 0x414310]
push edx
lea eax, [ebp - 0x120]
push eax
push 0
call dword [sym.imp.SHELL32.DLL_SHGetSpecialFolderPathA]
test eax, eax
jne 0x40156b
mov byte [ebp - 0x120], 0
jmp 0x401574
push 0
mov eax, dword [0x4142f0]
xor ecx, ecx
xor ebx, ebx
mov edx, 0x41325e
call fcn.00401010
test eax, eax
je 0x4016dc
cmp byte [eax], 0
je 0x4016dc
push eax
push 0x41325e
call dword [sym.imp.KERNEL32.DLL_SetEnvironmentVariableA]
push 0
mov eax, dword [0x4142f0]
xor ecx, ecx
xor ebx, ebx
mov edx, 0x413264
call fcn.00401010
test eax, eax
je 0x401731
cmp byte [eax], 0
je 0x401731
push 0x104
lea edx, [ebp - 0x120]
push edx
push eax
call dword [sym.imp.KERNEL32.DLL_ExpandEnvironmentStringsA]
lea eax, [ebp - 0x120]
push eax
push 0x413269
call dword [sym.imp.KERNEL32.DLL_SetEnvironmentVariableA]
lea eax, [ebp - 0x120]
push eax
push 0x413271
call dword [sym.imp.KERNEL32.DLL_SetEnvironmentVariableA]
xor eax, eax
lea esp, [ebp - 0x14]
pop edi
pop esi
pop edx
pop ecx
pop ebx
pop ebp
ret