Function at 0x4067f0
Capabilities:
Get session user name
Impersonate user
Query environment variable
Set environment variable

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x83c
mov eax, dword [0x411014]
xor eax, ebp
mov dword [ebp - 4], eax
mov eax, dword [ebp + 0xc]
xorps xmm0, xmm0
push ebx
push edi
mov edi, dword [ebp + 8]
push 0x20
push 1
mov dword [ebp - 0x838], eax
mov byte [ebp - 0x831], 0
mov dword [ebp - 0x808], 0x400
movups xmmword [ebp - 0x830], xmm0
mov dword [ebp - 0x80c], 0
movups xmmword [ebp - 0x820], xmm0
mov dword [ebp - 0x810], 0
mov dword [eax], 0
call dword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_calloc]
mov ebx, eax
add esp, 8
test ebx, ebx
jne 0x406874
push str.calloc_failed_n
push 2
call fcn.004027c0
add esp, 8
jmp 0x406b0e
push 2
push 0
push 0
lea eax, [ebx + 4]
mov dword [ebx], 1
push eax
call dword [sym.imp.KERNEL32.dll_GetCurrentProcess]
push eax
push edi
call dword [sym.imp.KERNEL32.dll_GetCurrentProcess]
push eax
call dword [sym.imp.KERNEL32.dll_DuplicateHandle]
test eax, eax
jne 0x4068b8
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.DuplicateHandle_failed:__d_n
push 2
call fcn.004027c0
add esp, 0xc
jmp 0x406b0e
lea eax, [ebp - 0x804]
mov dword [ebp - 0x830], 0x20
push edi
mov dword [ebp - 0x828], eax
call dword [sym.imp.ADVAPI32.dll_ImpersonateLoggedOnUser]
test eax, eax
jne 0x4068f4
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.ImpersonateLoggedOnUser_failed:__d_n
push 2
call fcn.004027c0
add esp, 0xc
jmp 0x406b0e
push esi
lea eax, [ebp - 0x808]
push eax
lea eax, [ebp - 0x804]
push eax
call dword [sym.imp.ADVAPI32.dll_GetUserNameW]
mov esi, eax
call dword [sym.imp.ADVAPI32.dll_RevertToSelf]
test eax, eax
je 0x406ba3
test esi, esi
jne 0x406938
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.GetUserName_failed:__d_n
push 2
call fcn.004027c0
add esp, 0xc
jmp 0x406b0d
push 1
lea eax, [ebp - 0x804]
push 0xffffffffffffffff
push eax
call sub.vmwarebase.DLL_Unicode_AllocWithLength
mov esi, eax
push esi
push str.CreateLogonSession:_spawn_with_username:__s_n
call sub.vmwarebase.DLL_Log
push esi
call dword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
push edi
call sub.vmwarebase.DLL_Util_TokenHasAdminPriv
test eax, eax
mov edx, str.is_NOT
mov ecx, 0x40d060
cmove ecx, edx
push ecx
push str.___Account__s_administrator__n
call sub.vmwarebase.DLL_Log
add esp, 0x24
call dword [sym.imp.KERNEL32.dll_GetEnvironmentStringsW]
mov esi, eax
mov dword [ebp - 0x83c], esi
test esi, esi
jne 0x4069a7
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.GetEnvironmentStrings___failed:__d_n
push 2
call fcn.004027c0
add esp, 0xc
push 0
push 0
lea eax, [ebp - 0x80c]
push eax
call sub.USERENV.dll_CreateEnvironmentBlock
test eax, eax
jne 0x4069fa
mov dword [ebp - 0x80c], eax
call dword [sym.imp.KERNEL32.dll_GetLastError]
test eax, eax
jne 0x4069df
push str.The_system_environment_block_appears_to_be_corrupted._Please_fix_your_environment_block_and_try_again._n
push 2
call fcn.004027c0
add esp, 8
jmp 0x406aac
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.CreateEnvironmentBlock_NULL__failed:__d_n
push 2
call fcn.004027c0
add esp, 0xc
jmp 0x406aac
lea eax, [ebp - 0x830]
push eax
push edi
call dword [sym.imp.USERENV.dll_LoadUserProfileW]
test eax, eax
jne 0x406a27
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.LoadUserProfile_failed:__d_n
push 2
call fcn.004027c0
add esp, 0xc
jmp 0x406aac
push 0
push edi
lea eax, [ebp - 0x810]
push eax
call sub.USERENV.dll_CreateEnvironmentBlock
test eax, eax
jne 0x406a73
mov dword [ebp - 0x810], eax
call dword [sym.imp.KERNEL32.dll_GetLastError]
test eax, eax
jne 0x406a5b
push str.Your_environment_block_appears_to_be_corrupted._Please_fix_your_environment_block_and_try_again._n
push 2
call fcn.004027c0
add esp, 8
jmp 0x406aac
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.CreateEnvironmentBlock_hToken__failed:__d_n
push 2
call fcn.004027c0
add esp, 0xc
jmp 0x406aac
push dword [0x411004]
mov eax, dword [ebp - 0x814]
push dword [ebp - 0x80c]
mov dword [ebx + 8], eax
push dword [ebp - 0x810]
call fcn.004064f0
add esp, 0xc
mov dword [ebx + 0xc], eax
test eax, eax
je 0x406aac
mov eax, dword [ebp - 0x838]
mov byte [ebp - 0x831], 1
mov dword [eax], ebx
test esi, esi
je 0x406b0d
cmp word [esi], 0
mov edi, esi
je 0x406b06
mov esi, edi
lea ecx, [esi + 2]
nop dword [eax]
mov ax, word [esi]
add esi, 2
test ax, ax
jne 0x406ac0
sub esi, ecx
mov eax, edi
sar esi, 1
mov edx, esi
je 0x406af4
cmp word [eax], 0x3d
lea ecx, [eax + 2]
je 0x406ae7
mov eax, ecx
sub edx, 1
jne 0x406ad5
jmp 0x406af4
push ecx
xor edx, edx
push edi
mov word [eax], dx
call dword [sym.imp.KERNEL32.dll_SetEnvironmentVariableW]
lea edi, [edi + esi*2]
add edi, 2
cmp word [edi], 0
jne 0x406ab8
mov esi, dword [ebp - 0x83c]
push esi
call dword [sym.imp.KERNEL32.dll_FreeEnvironmentStringsW]
pop esi
mov eax, dword [ebp - 0x80c]
test eax, eax
je 0x406b1e
push eax
call sub.USERENV.dll_DestroyEnvironmentBlock
mov eax, dword [ebp - 0x810]
test eax, eax
je 0x406b2e
push eax
call sub.USERENV.dll_DestroyEnvironmentBlock
mov al, byte [ebp - 0x831]
test al, al
jne 0x406b93
test ebx, ebx
je 0x406b93
dec dword [ebx]
cmp dword [ebx], 0
jg 0x406b93
mov eax, dword [ebx + 0xc]
test eax, eax
je 0x406b5b
push eax
call dword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
add esp, 4
mov dword [ebx + 0xc], 0
mov eax, dword [ebx + 8]
test eax, eax
je 0x406b73
push eax
push dword [ebx + 4]
call dword [sym.imp.USERENV.dll_UnloadUserProfile]
mov dword [ebx + 8], 0xffffffff
push dword [ebx + 4]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
push ebx
mov dword [ebx + 4], 0xffffffff
call dword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_free]
mov al, byte [ebp - 0x831]
add esp, 4
mov ecx, dword [ebp - 4]
pop edi
xor ecx, ebp
pop ebx
call fcn.004083a0
mov esp, ebp
pop ebp
ret
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.RevertToSelf_failed:__d_n
call fcn.00402700
int3