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

Disassembly:
sub esp, 0x214
mov eax, dword [0x41f00c]
xor eax, esp
mov dword [esp + 0x210], eax
push ebp
push esi
push 0x41b958
call dword [sym.imp.KERNEL32.dll_SetDllDirectoryW]
push 0xfffe
call fcn.00404aaa
push 0xfffe
mov esi, eax
call fcn.00404aaa
add esp, 8
mov ebp, eax
mov dword [esp + 0xc], ebp
test esi, esi
je 0x403f1e
push 0xfffe
push 0
push esi
call fcn.004065f0
add esp, 0xc
push 0x7fff
push esi
push 0x41cf3c
call dword [sym.imp.KERNEL32.dll_GetEnvironmentVariableW]
test eax, eax
je 0x403f04
cmp eax, 0x7fff
jbe 0x404007
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 0xcb
jne 0x404007
push esi
call fcn.00404aa5
add esp, 4
push 0x820
call fcn.00404aaa
push 0x820
mov esi, eax
push 0
push esi
call fcn.004065f0
add esp, 0x10
xor eax, eax
cmp ax, word [esi]
jne 0x403fce
push 0x208
push eax
lea eax, [esp + 0x18]
push eax
call fcn.004065f0
add esp, 0xc
lea eax, [esp + 0x10]
push 0x104
push eax
call dword [sym.imp.KERNEL32.dll_GetSystemDirectoryW]
test eax, eax
je 0x403f86
cmp eax, 0x104
ja 0x403f86
lea eax, [esp + 0x10]
push eax
push 0x410
push esi
call fcn.00408ed6
add esp, 0xc
push 0x104
lea eax, [esp + 0x14]
push eax
call dword [sym.imp.KERNEL32.dll_GetWindowsDirectoryW]
test eax, eax
je 0x403fce
cmp eax, 0x104
ja 0x403fce
xor eax, eax
cmp ax, word [esi]
je 0x403fbb
push 0x41cf48
push 0x410
push esi
call fcn.00408ed6
add esp, 0xc
lea eax, [esp + 0x10]
push eax
push 0x410
push esi
call fcn.00408ed6
add esp, 0xc
push esi
push 0x41cf3c
call dword [sym.imp.KERNEL32.dll_SetEnvironmentVariableW]
push esi
call fcn.00404aa5
add esp, 4
test ebp, ebp
je 0x403ff0
push ebp
call fcn.00404aa5
add esp, 4
mov ecx, dword [esp + 0x218]
pop esi
pop ebp
xor ecx, esp
call fcn.004043c7
add esp, 0x214
ret
push edi
lea eax, [esp + 0xc]
mov dword [esp + 0xc], 0
push eax
push 0x2000e
call dword [sym.imp.KERNEL32.dll_GetCurrentProcess]
push eax
call dword [sym.imp.ADVAPI32.dll_OpenProcessToken]
mov edi, eax
neg edi
sbb edi, edi
and edi, dword [esp + 0xc]
mov dword [esp + 0xc], edi
test ebp, ebp
je 0x404085
push 0xfffe
push 0
push ebp
call fcn.004065f0
add esp, 0xc
push 0x7fff
push ebp
push esi
test edi, edi
je 0x404061
push edi
call dword [sym.imp.USERENV.dll_ExpandEnvironmentStringsForUserW]
test eax, eax
jne 0x404081
jmp 0x404072
call dword [sym.imp.KERNEL32.dll_ExpandEnvironmentStringsW]
test eax, eax
je 0x404072
cmp eax, 0x7fff
jbe 0x404081
push esi
push 0x7fff
push ebp
call fcn.00408e67
add esp, 0xc
mov edi, dword [esp + 0xc]
test edi, edi
je 0x404098
push edi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov dword [esp + 0xc], 0
push 0xfffe
push 0
push esi
call fcn.004065f0
xor eax, eax
add esp, 0xc
mov edi, ebp
cmp ax, word [ebp]
je 0x40414a
lea ebp, [eax + 0x3b]
push ebx
nop word [eax + eax]
push 0x3b
push edi
call fcn.00406444
mov ebx, eax
add esp, 8
test ebx, ebx
je 0x4040d6
xor eax, eax
mov word [ebx], ax
xor eax, eax
cmp ax, word [edi]
je 0x404130
push 0x25
push edi
call fcn.00406444
add esp, 8
test eax, eax
jne 0x404130
movzx eax, word [edi]
push eax
call fcn.0040901b
add esp, 4
test eax, eax
je 0x404130
cmp word [edi + 2], 0x3a
jne 0x404130
movzx eax, word [edi + 4]
cmp eax, 0x2f
je 0x404111
cmp eax, 0x5c
jne 0x404130
push edi
push 0x7fff
push esi
call fcn.00408ed6
push 0x41cf48
push 0x7fff
push esi
call fcn.00408ed6
add esp, 0x18
test ebx, ebx
je 0x404145
lea edi, [ebx + 2]
mov word [ebx], bp
xor eax, eax
cmp ax, word [edi]
jne 0x4040c0
mov ebp, dword [esp + 0x14]
pop ebx
cmp word [esi], 0
pop edi
je 0x40416a
mov eax, esi
cmp word [eax + 2], 0
lea eax, [eax + 2]
jne 0x404153
cmp word [eax - 2], 0x3b
jne 0x40416a
xor ecx, ecx
mov word [eax - 2], cx
xor eax, eax
cmp ax, word [esi]
jne 0x403fce
jmp 0x403f3a