Function at 0x10021880
Capabilities:
Query environment variable

Disassembly:
push ebp
mov ebp, esp
push 0xffffffffffffffff
push 0x10081ee0
mov eax, dword fs:[0]
push eax
sub esp, 0x18
push ebx
push esi
push edi
mov eax, dword [section..data]
xor eax, ebp
push eax
lea eax, [ebp - 0xc]
mov dword fs:[0], eax
mov dword [ebp - 4], 0
mov dword [ebp - 0x14], 0
call fcn.10021470
xor ecx, ecx
mov edx, eax
test edx, edx
setne cl
test ecx, ecx
jne 0x100218d2
push 0x80004005
call fcn.10021340
mov eax, dword [edx]
mov ecx, edx
call dword [eax + 0xc]
lea esi, [eax + 0x10]
mov dword [ebp - 0x18], esi
mov byte [ebp - 4], 1
lea eax, [ebp - 0x10]
push dword [ebp + 8]
push str.SoftwareVOS_s
push eax
call fcn.1003a800
add esp, 0xc
lea eax, [ebp - 0x14]
mov byte [ebp - 4], 2
push eax
push 1
push 0
push dword [ebp - 0x10]
push SysReAllocStringLen
call dword [sym.imp.ADVAPI32.dll_RegOpenKeyExW]
test eax, eax
jne 0x10021a1d
push dword [ebp - 0x14]
call dword [sym.imp.ADVAPI32.dll_RegCloseKey]
mov eax, dword [esi - 8]
mov ecx, 1
sub ecx, dword [esi - 4]
sub eax, 0x104
or eax, ecx
jge 0x10021946
push 0x104
lea ecx, [ebp - 0x18]
call fcn.10023670
mov esi, dword [ebp - 0x18]
push 0x104
push esi
push str.USERNAME
call dword [sym.imp.KERNEL32.dll_GetEnvironmentVariableW]
push dword [esi - 8]
mov edi, eax
push esi
call fcn.1006b17d
add esp, 8
test eax, eax
js 0x10021a13
cmp eax, dword [esi - 8]
jg 0x10021a13
xor ecx, ecx
mov dword [esi - 0xc], eax
or ebx, 0xffffffff
mov word [esi + eax*2], cx
test edi, edi
je 0x100219dd
push ecx
mov ecx, esp
mov dword [ebp - 0x1c], esp
push 0x1008ee6c
call fcn.10022bb0
push ecx
lea ecx, [esi - 0x10]
mov byte [ebp - 4], 3
mov edi, esp
call fcn.100236e0
add eax, 0x10
xor ecx, ecx
mov dword [edi], eax
mov byte [ebp - 4], 2
call fcn.1003cfd0
add esp, 8
test eax, eax
jne 0x100219dd
push ecx
mov eax, esp
push esi
push str.IsSystemProcess:_USERNAME_s__secondary_envvar_check_:_this_is_indeed_a_USER_process
push eax
call fcn.1003a800
add esp, 0xc
call fcn.10021810
add esp, 4
xor edi, edi
jmp 0x10021a65
push esi
lea eax, [ebp - 0x1c]
push 0x1008ee70
push eax
call fcn.1003a800
add esp, 0xc
mov byte [ebp - 4], 4
mov edx, dword [ebp - 0x1c]
call fcn.100394f0
mov byte [ebp - 4], 2
mov ecx, ebx
mov edx, dword [ebp - 0x1c]
add edx, 0xfffffff0
lea eax, [edx + 0xc]
lock xadd dword [eax], ecx
dec ecx
test ecx, ecx
jmp 0x10021a56
push 0x80070057
call fcn.10021340
push dword [ebp - 0x10]
lea eax, [ebp - 0x1c]
push str.IsSystemProcess:_cannot_access_HKCU_s__this_is_a_SYSTEM_process
push eax
call fcn.1003a800
add esp, 0xc
mov byte [ebp - 4], 5
mov edx, dword [ebp - 0x1c]
call fcn.100394f0
mov byte [ebp - 4], 2
or ebx, 0xffffffff
mov edx, dword [ebp - 0x1c]
mov eax, ebx
add edx, 0xfffffff0
lea ecx, [edx + 0xc]
lock xadd dword [ecx], eax
dec eax
test eax, eax
jg 0x10021a60
mov ecx, dword [edx]
push edx
mov eax, dword [ecx]
call dword [eax + 4]
mov edi, 1
mov byte [ebp - 4], 1
mov ecx, ebx
mov edx, dword [ebp - 0x10]
add edx, 0xfffffff0
lea eax, [edx + 0xc]
lock xadd dword [eax], ecx
dec ecx
test ecx, ecx
jg 0x10021a85
mov ecx, dword [edx]
push edx
mov eax, dword [ecx]
call dword [eax + 4]
add esi, 0xfffffff0
mov byte [ebp - 4], 0
mov ecx, ebx
lea eax, [esi + 0xc]
lock xadd dword [eax], ecx
dec ecx
test ecx, ecx
jg 0x10021aa2
mov ecx, dword [esi]
push esi
mov eax, dword [ecx]
call dword [eax + 4]
mov dword [ebp - 4], 0xffffffff
mov esi, dword [ebp + 8]
add esi, 0xfffffff0
lea eax, [esi + 0xc]
lock xadd dword [eax], ebx
dec ebx
test ebx, ebx
jg 0x10021ac3
mov ecx, dword [esi]
push esi
mov edx, dword [ecx]
call dword [edx + 4]
mov eax, edi
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret