Function at 0x140016d30
Capabilities:
Acquire debug privileges
Allocate thread local storage
Enumerate processes
Get common file path
Query environment variable
Set environment variable
Set thread local storage value

Disassembly:
mov r11, rsp
sub rsp, 0x2a8
mov rax, qword [0x1400a3758]
xor rax, rsp
mov qword [rsp + 0x280], rax
cmp byte [0x1400a6634], 0
jne 0x1400172ac
mov qword [r11 + 8], rbx
lea rcx, str.Kernel32.dll
mov qword [r11 + 0x10], rbp
mov edx, 1
mov qword [r11 + 0x18], rsi
mov qword [r11 - 8], rdi
mov qword [r11 - 0x18], r15
mov byte [0x1400a6634], 1
call fcn.140001700
mov rcx, rax
lea rdx, str.Wow64EnableWow64FsRedirection
call qword [sym.imp.KERNEL32.dll_GetProcAddress]
mov edx, 1
lea rcx, str.Kernel32.dll
mov qword [0x1400a5c18], rax
call fcn.140001700
mov rcx, rax
lea rdx, str.Wow64DisableWow64FsRedirection
call qword [sym.imp.KERNEL32.dll_GetProcAddress]
mov edx, 1
lea rcx, str.Kernel32.dll
mov qword [0x1400a5e28], rax
call fcn.140001700
mov rcx, rax
lea rdx, str.Wow64RevertWow64FsRedirection
call qword [sym.imp.KERNEL32.dll_GetProcAddress]
mov edx, 1
lea rcx, str.advapi32.dll
mov qword [0x1400a6038], rax
call fcn.140001700
mov rcx, rax
lea rdx, str.RegDeleteKeyExW
call qword [sym.imp.KERNEL32.dll_GetProcAddress]
mov qword [0x1400a5be8], rax
call qword [sym.imp.KERNEL32.dll_TlsAlloc]
mov edx, eax
xor ecx, ecx
mov dword [0x1400a555c], edx
call qword [sym.imp.KERNEL32.dll_TlsSetValue]
lea rbx, [0x1400a5350]
mov edx, 0x104
mov rcx, rbx
call qword [sym.imp.KERNEL32.dll_GetSystemWindowsDirectoryW]
xor r15d, r15d
lea rsi, [0x1400a5c20]
mov ecx, r15d
nop dword [rax]
movzx eax, word [rcx + rbx]
mov word [rcx + rsi], ax
lea rcx, [rcx + 2]
test ax, ax
jne 0x140016e50
lea rcx, [rsi - 2]
cmp word [rcx + 2], r15w
lea rcx, [rcx + 2]
jne 0x140016e65
movups xmm0, xmmword [str.System32]
mov eax, dword [0x1400821c8]
lea rbp, [0x1400a5e30]
mov edx, 0x104
movups xmmword [rcx], xmm0
mov dword [rcx + 0x10], eax
mov rcx, rbp
call qword [sym.imp.KERNEL32.dll_GetSystemWow64DirectoryW]
test eax, eax
jne 0x140016eb1
mov rcx, r15
nop
movzx eax, word [rcx + rsi]
mov word [rcx + rbp], ax
lea rcx, [rcx + 2]
test ax, ax
jne 0x140016ea0
lea rbx, [0x1400a5560]
mov r8d, 0x104
lea rdi, str._ProgramW6432_
mov rdx, rbx
mov rcx, rdi
call qword [sym.imp.KERNEL32.dll_ExpandEnvironmentStringsW]
mov rcx, 0xffffffffffffffff
nop dword [rax + rax]
movzx eax, word [rdi + rcx*2 + 2]
cmp ax, word [rbx + rcx*2 + 2]
jne 0x140016f28
add rcx, 2
cmp rcx, 0xf
je 0x140016f02
movzx eax, word [rdi + rcx*2]
cmp ax, word [rbx + rcx*2]
je 0x140016ee0
jmp 0x140016f28
mov r8d, 0x104
lea rcx, str._ProgramFiles_
mov rdx, rbx
call qword [sym.imp.KERNEL32.dll_ExpandEnvironmentStringsW]
mov rdx, rbx
lea rcx, str.ProgramW6432
call qword [sym.imp.KERNEL32.dll_SetEnvironmentVariableW]
mov r8d, 0x104
lea rdx, [0x1400a5770]
lea rcx, str._PROGRAMFILES_X86__
call qword [sym.imp.KERNEL32.dll_ExpandEnvironmentStringsW]
lea rdx, str.__x86_
mov rcx, rbx
call fcn.14004ebac
test rax, rax
je 0x140016f79
lea rdx, str.__x86_
mov rcx, rbx
call fcn.14004ebac
mov rdx, rbx
lea rcx, str.PROGRAMFILES_X86_
mov word [rax], r15w
call qword [sym.imp.KERNEL32.dll_SetEnvironmentVariableW]
mov r8d, 0x104
lea rdx, [0x1400a5980]
lea rcx, str._programdata_
call qword [sym.imp.KERNEL32.dll_ExpandEnvironmentStringsW]
test eax, eax
jne 0x140016fd5
mov r8d, 0x104
lea rdx, [0x1400a5980]
lea rcx, str._allusersprofile_
call qword [sym.imp.KERNEL32.dll_ExpandEnvironmentStringsW]
test eax, eax
jne 0x140016fd5
movzx r9d, word [0x1400a5350]
lea r8, str._c:programdata_
mov edx, 0x104
lea rcx, [0x1400a5980]
call fcn.140013df0
mov r9, 0xffffffffffffffff
lea r8, str.MicrosoftWindows_Defender_
mov edx, 0x104
lea rcx, [0x1400a5980]
call fcn.14005bc44
lea rdx, str._PATH_
lea rcx, [rsp + 0x30]
call fcn.14002cd00
mov rbx, qword [0x1400a6048]
lea rdi, [0x14007a7c4]
mov rcx, rdi
mov rdx, qword [rax]
test rdx, rdx
cmovne rcx, rdx
call fcn.140059d48
mov rcx, rbx
mov qword [0x1400a6048], rax
call fcn.140059d2c
mov rcx, qword [rsp + 0x30]
call fcn.140059d2c
mov rax, qword [0x1400a6048]
mov rbx, qword [0x1400a6050]
test rax, rax
cmovne rdi, rax
mov rcx, rdi
call fcn.140059d48
mov rcx, rbx
mov qword [0x1400a6050], rax
call fcn.140059d2c
mov rdi, qword [0x1400a6050]
cmp word [rdi], r15w
je 0x1400170f4
mov qword [rsp + 0x298], r14
mov r14d, 0x3b
mov edx, r14d
mov rcx, rdi
call fcn.14004eb30
mov rbx, rax
test rax, rax
je 0x14001709c
mov word [rax], r15w
mov r8, 0xffffffffffffffff
inc r8
cmp word [rsi + r8*2], r15w
jne 0x1400170a3
mov rdx, rsi
mov rcx, rdi
call fcn.14005bdfc
test eax, eax
jne 0x1400170d9
mov r8, 0xffffffffffffffff
inc r8
cmp word [rbp + r8*2], r15w
jne 0x1400170c3
mov rdx, rbp
mov rcx, rdi
call fcn.14005bd68
test rbx, rbx
je 0x1400170ec
lea rdi, [rbx + 2]
mov word [rbx], r14w
cmp word [rdi], r15w
jne 0x140017085
mov r14, qword [rsp + 0x298]
lea rcx, [0x1400a5bf0]
call qword [sym.imp.KERNEL32.dll_InitializeCriticalSection]
lea rcx, str.SeDebugPrivilege
call fcn.140017320
mov rsi, qword [rsp + 0x2c0]
mov rbp, qword [rsp + 0x2b8]
test eax, eax
je 0x140017294
xor edx, edx
lea ecx, [rdx + 2]
call sub.KERNEL32.dll_CreateToolhelp32Snapshot
mov rdi, rax
test rax, rax
je 0x140017294
lea rdx, [rsp + 0x40]
mov dword [rsp + 0x40], 0x238
mov rcx, rax
call sub.KERNEL32.dll_Process32FirstW
test eax, eax
je 0x14001728b
nop dword [rax + rax]
mov edx, 0x5c
lea rcx, [rsp + 0x6c]
lea rbx, [rsp + 0x6c]
call fcn.14004fa80
test rax, rax
je 0x140017191
mov edx, 0x5c
lea rcx, [rsp + 0x6c]
call fcn.14004fa80
mov rbx, rax
add rbx, 2
je 0x1400171a4
lea rdx, str.winlogon.exe
mov rcx, rbx
call fcn.14005a3cc
test eax, eax
je 0x1400171ba
lea rdx, [rsp + 0x40]
mov rcx, rdi
call sub.KERNEL32.dll_Process32NextW
test eax, eax
jne 0x140017160
jmp 0x14001728b
mov r8d, dword [rsp + 0x48]
xor edx, edx
mov ecx, 0x400
call qword [sym.imp.KERNEL32.dll_OpenProcess]
mov rbx, rax
test rax, rax
je 0x14001728b
lea r8, [rsp + 0x38]
mov qword [rsp + 0x38], r15
mov edx, 0xa
mov rcx, rax
call qword [sym.imp.ADVAPI32.dll_OpenProcessToken]
test eax, eax
je 0x140017282
mov rcx, qword [rsp + 0x38]
lea rax, [rsp + 0x30]
mov qword [rsp + 0x28], rax
mov r9d, 2
xor r8d, r8d
mov dword [rsp + 0x20], 2
mov edx, 0xf01ff
call qword [sym.imp.ADVAPI32.dll_DuplicateTokenEx]
test eax, eax
je 0x140017277
lea rcx, str.SeImpersonatePrivilege
call fcn.140017320
mov rcx, qword [rsp + 0x30]
call qword [sym.imp.ADVAPI32.dll_ImpersonateLoggedOnUser]
test eax, eax
je 0x14001726c
lea rcx, str.SeSecurityPrivilege
call fcn.140017320
lea rcx, str.SeDebugPrivilege
call fcn.140017320
lea rcx, str.SeBackupPrivilege
call fcn.140017320
call qword [sym.imp.ADVAPI32.dll_RevertToSelf]
mov rcx, qword [rsp + 0x30]
call qword [sym.imp.KERNEL32.dll_CloseHandle]
mov rcx, qword [rsp + 0x38]
call qword [sym.imp.KERNEL32.dll_CloseHandle]
mov rcx, rbx
call qword [sym.imp.KERNEL32.dll_CloseHandle]
mov rcx, rdi
call qword [sym.imp.KERNEL32.dll_CloseHandle]
mov rdi, qword [rsp + 0x2a0]
mov rbx, qword [rsp + 0x2b0]
mov r15, qword [rsp + 0x290]
mov rcx, qword [rsp + 0x280]
xor rcx, rsp
call fcn.14004bd30
add rsp, 0x2a8
ret