Function at 0x140040a78
Capabilities:
Check mutex on windows
Encode data using xor
Get token membership

Disassembly:
mov qword [rsp + 8], rbx
push rbp
push rsi
push rdi
push r12
push r13
push r14
push r15
lea rbp, [rsp - 0x120]
sub rsp, 0x220
xor r15d, r15d
mov rsi, r8
mov r14d, edx
mov qword [r8], r15
mov rdi, rcx
xor eax, eax
lea r12d, [r15 + 1]
lock cmpxchg dword [0x1401329b4], r12d
je 0x140040ae4
xor eax, eax
lock cmpxchg dword [0x1401329b4], r15d
or ebx, 0xffffffff
jmp 0x140040adb
mov ecx, r12d
call qword [sym.imp.KERNEL32.dll_Sleep]
xor eax, eax
lock cmpxchg dword [0x1401329b4], r15d
cmp eax, ebx
jne 0x140040ac7
jmp 0x140040d3c
call qword [sym.imp.KERNEL32.dll_GetTickCount]
mov r13d, 0x20
mov dword [rsp + 0x60], r15d
mov dword [0x140132c68], eax
lea rcx, [rsp + 0x60]
lea rax, [rsp + 0x78]
mov word [rsp + 0x64], 0x500
mov qword [rsp + 0x50], rax
mov r9d, 0x220
mov dword [rsp + 0x48], r15d
mov r8d, r13d
mov dword [rsp + 0x40], r15d
mov dl, 2
mov dword [rsp + 0x38], r15d
mov dword [rsp + 0x30], r15d
mov dword [rsp + 0x28], r15d
mov dword [rsp + 0x20], r15d
mov qword [rsp + 0x78], r15
call qword [sym.imp.ADVAPI32.dll_AllocateAndInitializeSid]
test eax, eax
je 0x140040b8b
mov rdx, qword [rsp + 0x78]
lea r8, [rbp + 0x170]
xor ecx, ecx
call qword [sym.imp.ADVAPI32.dll_CheckTokenMembership]
mov rcx, qword [rsp + 0x78]
neg eax
sbb edx, edx
and edx, dword [rbp + 0x170]
mov dword [rbp + 0x170], edx
test rcx, rcx
je 0x140040b83
call qword [sym.imp.ADVAPI32.dll_FreeSid]
mov edx, dword [rbp + 0x170]
test edx, edx
jne 0x140040c1f
lea rax, [rbp - 0x80]
mov dword [rsp + 0x68], r15d
mov qword [rsp + 0x50], rax
lea rcx, [rsp + 0x68]
mov dword [rsp + 0x48], r15d
xor r9d, r9d
mov dword [rsp + 0x40], r15d
mov dl, r12b
mov dword [rsp + 0x38], r15d
mov dword [rsp + 0x30], r15d
mov dword [rsp + 0x28], r15d
lea r8d, [r9 + 0x12]
mov dword [rsp + 0x20], r15d
mov word [rsp + 0x6c], 0x500
mov qword [rbp - 0x80], r15
call qword [sym.imp.ADVAPI32.dll_AllocateAndInitializeSid]
test eax, eax
je 0x140040d29
mov rdx, qword [rbp - 0x80]
lea r8, [rbp + 0x178]
xor ecx, ecx
call qword [sym.imp.ADVAPI32.dll_CheckTokenMembership]
mov rcx, qword [rbp - 0x80]
neg eax
sbb edx, edx
and edx, dword [rbp + 0x178]
mov dword [rbp + 0x178], edx
test rcx, rcx
je 0x140040c17
call qword [sym.imp.ADVAPI32.dll_FreeSid]
mov edx, dword [rbp + 0x178]
test edx, edx
je 0x140040d29
mov ebx, r15d
call qword [sym.imp.KERNEL32.dll_GetCurrentProcess]
lea r8, [rbp - 0x68]
mov edx, r13d
mov rcx, rax
call qword [sym.imp.ADVAPI32.dll_OpenProcessToken]
test eax, eax
je 0x140040d29
lea r8, [rbp - 0x4c]
xor ecx, ecx
lea rdx, str.SeLoadDriverPrivilege
call qword [sym.imp.ADVAPI32.dll_LookupPrivilegeValueW]
test eax, eax
je 0x140040c81
mov rcx, qword [rbp - 0x68]
lea r8, [rbp - 0x50]
mov qword [rsp + 0x28], r15
xor r9d, r9d
xor edx, edx
mov qword [rsp + 0x20], r15
mov dword [rbp - 0x50], r12d
mov dword [rbp - 0x44], 2
call qword [sym.imp.ADVAPI32.dll_AdjustTokenPrivileges]
mov ebx, eax
mov rcx, qword [rbp - 0x68]
call qword [sym.imp.KERNEL32.dll_CloseHandle]
test ebx, ebx
je 0x140040d29
mov ebx, 0x104
lea r13, [0x140132a60]
mov edx, ebx
mov rcx, r13
call qword [sym.imp.KERNEL32.dll_GetSystemWindowsDirectoryW]
test eax, eax
je 0x140040d1d
cmp eax, ebx
jae 0x140040cbf
lea edx, [rax - 1]
cmp word [r13 + rdx*2], 0x5c
cmove eax, edx
test eax, eax
je 0x140040d1d
mov ecx, eax
lea rax, [rcx + 0xf]
cmp rax, rbx
ja 0x140040d1d
mov word [r13 + rcx*2], r15w
lea rcx, [0x1401329c0]
call fcn.1400411d8
test eax, eax
je 0x140040d1d
cmp word [0x1401329e0], r15w
je 0x140040d1d
test dword [0x1401329c4], 0x30000
je 0x140040d1d
lea rdx, [0x1401329b0]
mov word [0x140132a5e], r15w
lea rcx, [0x1401329e0]
call fcn.1400410dc
mov dword [0x1401329b8], eax
jmp 0x140040d33
mov dword [0x1401329b8], 0x32
jmp 0x140040d33
mov dword [0x1401329b8], 5
or ebx, 0xffffffff
xchg dword [0x1401329b4], ebx
mov ebx, dword [0x1401329b8]
test ebx, ebx
jne 0x140040f56
movaps xmm0, xmmword [0x1401329d0]
lea rax, [rbp - 0x40]
movdqu xmmword [rbp - 0x40], xmm0
sub rdi, rax
lea rcx, [rbp - 0x40]
lea edx, [rbx + 0x10]
mov al, byte [rdi + rcx]
xor byte [rcx], al
add rcx, r12
sub rdx, r12
jne 0x140040d64
lea ebx, [rdx + 0x57]
lea rax, str.Global_sptd2_adapter_mutex_
mov qword [rsp + 0x28], rax
lea edx, [rbx + 0x29]
lea r9, [rbp - 0x78]
mov qword [rsp + 0x20], r15
lea r8, [rbp - 0x70]
lea rcx, [rbp + 0x20]
call fcn.140041a70
test eax, eax
js 0x140040f56
mov dil, r15b
mov rdx, qword [rbp - 0x78]
lea r9, [rbp - 0x78]
movzx eax, dil
lea r8, [rbp - 0x70]
movzx ecx, byte [rbp + rax - 0x40]
lea rax, [0x1400e39e0]
mov dword [rsp + 0x30], ecx
mov rcx, qword [rbp - 0x70]
mov qword [rsp + 0x28], rax
mov qword [rsp + 0x20], r15
call fcn.140041a70
test eax, eax
js 0x140040de4
add dil, r12b
cmp dil, 0x10
jb 0x140040da4
cmp dil, 0x10
jne 0x140040f56
test r14d, r14d
je 0x140040f56
mov rdx, qword [rbp - 0x78]
lea r8, str.__08X
mov rcx, qword [rbp - 0x70]
mov r9d, r14d
call fcn.140013d30
test eax, eax
js 0x140040f56
lea rax, [rbp - 0x58]
mov dword [rsp + 0x70], r15d
mov qword [rsp + 0x50], rax
lea rcx, [rsp + 0x70]
mov dword [rsp + 0x48], r15d
xor r9d, r9d
mov dword [rsp + 0x40], r15d
xor r8d, r8d
mov dword [rsp + 0x38], r15d
mov dl, r12b
mov dword [rsp + 0x30], r15d
mov rdi, r15
mov dword [rsp + 0x28], r15d
mov dword [rsp + 0x20], r15d
mov word [rsp + 0x74], 0x100
call qword [sym.imp.ADVAPI32.dll_AllocateAndInitializeSid]
test eax, eax
je 0x140040f2b
xor edx, edx
lea rcx, [rbp - 0x18]
lea r8d, [rdx + 0x30]
call fcn.1400b5f30
mov rax, qword [rbp - 0x58]
lea r9, [rbp - 0x60]
xor r8d, r8d
mov qword [rbp + 0x10], rax
lea rdx, [rbp - 0x18]
mov dword [rbp - 0x18], 0x1f0001
mov ecx, r12d
mov qword [rbp - 0x14], 2
mov dword [rbp + 4], r15d
mov dword [rbp + 8], 5
call qword [sym.imp.ADVAPI32.dll_SetEntriesInAclW]
test eax, eax
jne 0x140040f21
lea edx, [rax + 0x28]
lea ecx, [rax + 0x40]
call qword [sym.imp.KERNEL32.dll_LocalAlloc]
mov rbx, rax
test rax, rax
je 0x140040f17
mov edx, r12d
mov rcx, rax
call qword [sym.imp.ADVAPI32.dll_InitializeSecurityDescriptor]
test eax, eax
je 0x140040f0e
mov r8, qword [rbp - 0x60]
xor r9d, r9d
mov edx, r12d
mov rcx, rbx
call qword [sym.imp.ADVAPI32.dll_SetSecurityDescriptorDacl]
test eax, eax
je 0x140040f0e
lea r8, [rbp + 0x20]
mov dword [rbp - 0x30], 0x18
xor edx, edx
mov qword [rbp - 0x28], rbx
lea rcx, [rbp - 0x30]
mov dword [rbp - 0x20], r15d
call qword [sym.imp.KERNEL32.dll_CreateMutexW]
mov rdi, rax
mov rcx, rbx
call qword [sym.imp.KERNEL32.dll_LocalFree]
mov rcx, qword [rbp - 0x60]
call qword [sym.imp.KERNEL32.dll_LocalFree]
mov rcx, qword [rbp - 0x58]
call qword [sym.imp.ADVAPI32.dll_FreeSid]
mov qword [rsi], rdi
test rdi, rdi
je 0x140040f51
or ebx, 0xffffffff
mov rcx, rdi
mov edx, ebx
call qword [sym.imp.KERNEL32.dll_WaitForSingleObject]
cmp eax, ebx
jne 0x140040f73
mov rcx, qword [rsi]
call qword [sym.imp.KERNEL32.dll_CloseHandle]
mov qword [rsi], r15
mov ebx, 8
mov eax, ebx
mov rbx, qword [rsp + 0x260]
add rsp, 0x220
pop r15
pop r14
pop r13
pop r12
pop rdi
pop rsi
pop rbp
ret
mov ebx, r15d
jmp 0x140040f56