Function at 0x140006580
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 [0x1401737a8]
xor rax, rsp
mov qword [rsp + 0x280], rax
cmp byte [0x140179254], 0
jne 0x140006afc
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 [0x140179254], 1
call fcn.140035800
mov rcx, rax
lea rdx, str.Wow64EnableWow64FsRedirection
call qword [sym.imp.KERNEL32.dll_GetProcAddress]
mov edx, 1
lea rcx, str.Kernel32.dll
mov qword [0x140178828], rax
call fcn.140035800
mov rcx, rax
lea rdx, str.Wow64DisableWow64FsRedirection
call qword [sym.imp.KERNEL32.dll_GetProcAddress]
mov edx, 1
lea rcx, str.Kernel32.dll
mov qword [0x140178a38], rax
call fcn.140035800
mov rcx, rax
lea rdx, str.Wow64RevertWow64FsRedirection
call qword [sym.imp.KERNEL32.dll_GetProcAddress]
mov edx, 1
lea rcx, str.advapi32.dll
mov qword [0x140178c48], rax
call fcn.140035800
mov rcx, rax
lea rdx, str.RegDeleteKeyExW
call qword [sym.imp.KERNEL32.dll_GetProcAddress]
mov qword [0x140178798], rax
call qword [sym.imp.KERNEL32.dll_TlsAlloc]
mov edx, eax
xor ecx, ecx
mov dword [0x140178818], eax
call qword [sym.imp.KERNEL32.dll_TlsSetValue]
lea rbx, [0x140177f60]
mov edx, 0x104
mov rcx, rbx
call qword [sym.imp.KERNEL32.dll_GetSystemWindowsDirectoryW]
xor r15d, r15d
lea rsi, [0x140178830]
mov ecx, r15d
nop dword [rax]
movzx eax, word [rcx + rbx]
mov word [rcx + rsi], ax
lea rcx, [rcx + 2]
test ax, ax
jne 0x1400066a0
lea rcx, [rsi - 2]
cmp word [rcx + 2], r15w
lea rcx, [rcx + 2]
jne 0x1400066b5
movups xmm0, xmmword [str.System32]
mov eax, dword [0x14011f0a8]
lea rbp, [0x140178a40]
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 0x140006701
mov rcx, r15
nop
movzx eax, word [rcx + rsi]
mov word [rcx + rbp], ax
lea rcx, [rcx + 2]
test ax, ax
jne 0x1400066f0
lea rbx, [0x140178170]
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 0x140006778
add rcx, 2
cmp rcx, 0xf
je 0x140006752
movzx eax, word [rdi + rcx*2]
cmp ax, word [rbx + rcx*2]
je 0x140006730
jmp 0x140006778
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, [0x140178380]
lea rcx, str._PROGRAMFILES_X86__
call qword [sym.imp.KERNEL32.dll_ExpandEnvironmentStringsW]
lea rdx, str.__x86_
mov rcx, rbx
call fcn.1400e3cd4
test rax, rax
je 0x1400067c9
lea rdx, str.__x86_
mov rcx, rbx
call fcn.1400e3cd4
mov rdx, rbx
lea rcx, str.PROGRAMFILES_X86_
mov word [rax], r15w
call qword [sym.imp.KERNEL32.dll_SetEnvironmentVariableW]
mov r8d, 0x104
lea rdx, [0x140178590]
lea rcx, str._programdata_
call qword [sym.imp.KERNEL32.dll_ExpandEnvironmentStringsW]
test eax, eax
jne 0x140006825
mov r8d, 0x104
lea rdx, [0x140178590]
lea rcx, str._allusersprofile_
call qword [sym.imp.KERNEL32.dll_ExpandEnvironmentStringsW]
test eax, eax
jne 0x140006825
movzx r9d, word [0x140177f60]
lea r8, str._c:programdata_
mov edx, 0x104
lea rcx, [0x140178590]
call fcn.140005040
mov r9, 0xffffffffffffffff
lea r8, str.MicrosoftWindows_Defender_
mov edx, 0x104
lea rcx, [0x140178590]
call fcn.1400e874c
lea rdx, str._PATH_
lea rcx, [rsp + 0x30]
call fcn.140018990
mov rbx, qword [0x140178c58]
lea rdi, [0x14011eaa0]
mov rcx, rdi
mov rdx, qword [rax]
test rdx, rdx
cmovne rcx, rdx
call fcn.1400e81d8
mov rcx, rbx
mov qword [0x140178c58], rax
call fcn.1400e825c
mov rcx, qword [rsp + 0x30]
call fcn.1400e825c
mov rax, qword [0x140178c58]
mov rbx, qword [0x140178c60]
test rax, rax
cmovne rdi, rax
mov rcx, rdi
call fcn.1400e81d8
mov rcx, rbx
mov qword [0x140178c60], rax
call fcn.1400e825c
mov rdi, qword [0x140178c60]
cmp word [rdi], r15w
je 0x140006944
mov qword [rsp + 0x298], r14
mov r14d, 0x3b
mov edx, r14d
mov rcx, rdi
call fcn.1400e3bac
mov rbx, rax
test rax, rax
je 0x1400068ec
mov word [rax], r15w
mov r8, 0xffffffffffffffff
inc r8
cmp word [rsi + r8*2], r15w
jne 0x1400068f3
mov rdx, rsi
mov rcx, rdi
call fcn.1400e8bbc
test eax, eax
jne 0x140006929
mov r8, 0xffffffffffffffff
inc r8
cmp word [rbp + r8*2], r15w
jne 0x140006913
mov rdx, rbp
mov rcx, rdi
call fcn.1400e896c
test rbx, rbx
je 0x14000693c
lea rdi, [rbx + 2]
mov word [rbx], r14w
cmp word [rdi], r15w
jne 0x1400068d5
mov r14, qword [rsp + 0x298]
lea rcx, [0x1401787f0]
call qword [sym.imp.KERNEL32.dll_InitializeCriticalSection]
lea rcx, str.SeDebugPrivilege
call fcn.140006b20
mov rsi, qword [rsp + 0x2c0]
mov rbp, qword [rsp + 0x2b8]
test eax, eax
je 0x140006ae4
xor edx, edx
lea ecx, [rdx + 2]
call sub.KERNEL32.dll_CreateToolhelp32Snapshot
mov rdi, rax
test rax, rax
je 0x140006ae4
lea rdx, [rsp + 0x40]
mov dword [rsp + 0x40], 0x238
mov rcx, rax
call sub.KERNEL32.dll_Process32FirstW
test eax, eax
je 0x140006adb
nop dword [rax + rax]
mov edx, 0x5c
lea rcx, [rsp + 0x6c]
lea rbx, [rsp + 0x6c]
call fcn.1400e3c28
test rax, rax
je 0x1400069e1
mov edx, 0x5c
lea rcx, [rsp + 0x6c]
call fcn.1400e3c28
mov rbx, rax
add rbx, 2
je 0x1400069f4
lea rdx, str.winlogon.exe
mov rcx, rbx
call fcn.1400e89f4
test eax, eax
je 0x140006a0a
lea rdx, [rsp + 0x40]
mov rcx, rdi
call sub.KERNEL32.dll_Process32NextW
test eax, eax
jne 0x1400069b0
jmp 0x140006adb
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 0x140006adb
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 0x140006ad2
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 0x140006ac7
lea rcx, str.SeImpersonatePrivilege
call fcn.140006b20
mov rcx, qword [rsp + 0x30]
call qword [sym.imp.ADVAPI32.dll_ImpersonateLoggedOnUser]
test eax, eax
je 0x140006abc
lea rcx, str.SeSecurityPrivilege
call fcn.140006b20
lea rcx, str.SeDebugPrivilege
call fcn.140006b20
lea rcx, str.SeBackupPrivilege
call fcn.140006b20
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.1400e17a0
add rsp, 0x2a8
ret