Function at 0x401350
Capabilities:
Compare security identifiers
Enumerate processes on remote desktop session host

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x24
push ebx
push esi
push edi
push str.GetRealUserToken_In
mov esi, ecx
mov dword [ebp - 0x18], 0
mov dword [ebp - 0x14], 0
mov dword [ebp - 0xc], 0
mov dword [ebp - 0x10], 0
mov dword [ebp - 0x1c], 0
mov dword [ebp - 4], 0
call fcn.00401060
mov ebx, dword [sym.imp.KERNEL32.dll_GetLastError]
add esp, 4
test esi, esi
je 0x4013bb
lea eax, [ebp - 0x10]
push eax
push esi
call dword [sym.imp.ADVAPI32.dll_ConvertStringSidToSidW]
test eax, eax
jne 0x4013bb
call ebx
push eax
push str.GetRealUserToken___:_ConvertStringSidToSid___err___d_n
call fcn.00401060
add esp, 8
cmp dword [ebp - 0x10], 0
je 0x4013e9
lea eax, [ebp - 0xc]
push eax
lea eax, [ebp - 0x14]
push eax
push 1
push 0
push 0
call dword [sym.imp.WTSAPI32.dll_WTSEnumerateProcessesW]
test eax, eax
jne 0x4013e9
call ebx
push eax
push str.GetRealUserToken___:_WTSEnumerateProcesses___err___d_n
call fcn.00401060
add esp, 8
cmp dword [ebp - 0xc], 0
je 0x401483
call dword [sym.imp.KERNEL32.dll_GetCurrentProcess]
test eax, eax
je 0x401427
push 0
push 0
push 0x400
lea ecx, [ebp - 0x1c]
push ecx
push eax
push eax
push eax
call dword [sym.imp.KERNEL32.dll_DuplicateHandle]
test eax, eax
jne 0x401427
call ebx
push eax
push str.GetRealUserToken___:_DuplicateHandle___err___d_n
call fcn.00401060
add esp, 8
mov eax, dword [ebp - 0x1c]
test eax, eax
je 0x401452
lea ecx, [ebp - 4]
push ecx
push 0xf01ff
push eax
call dword [sym.imp.ADVAPI32.dll_OpenProcessToken]
test eax, eax
jne 0x401452
call ebx
push eax
push str.GetRealUserToken___:_OpenProcessToken___err___d_n
call fcn.00401060
add esp, 8
mov eax, dword [ebp - 4]
test eax, eax
je 0x401483
push ecx
mov edx, str.SeBackupPrivilege
mov ecx, eax
call fcn.004010e0
mov ecx, dword [ebp - 4]
mov edx, str.SeRestorePrivilege
call fcn.004010e0
mov ecx, dword [ebp - 4]
mov edx, str.SeIncreaseQuotaPrivilege
call fcn.004010e0
add esp, 4
cmp dword [ebp - 0xc], 0
mov esi, dword [sym.imp.KERNEL32.dll_CloseHandle]
mov dword [ebp - 0x20], 0
jbe 0x40157d
xor edi, edi
nop dword [eax]
cmp dword [ebp - 4], 0
je 0x40157d
cmp dword [ebp - 0x18], 0
jne 0x40157d
mov eax, dword [ebp - 0x14]
mov eax, dword [edi + eax + 0xc]
test eax, eax
je 0x40156a
push eax
push dword [ebp - 0x10]
call dword [sym.imp.ADVAPI32.dll_EqualSid]
test eax, eax
je 0x40156a
mov eax, dword [ebp - 0x14]
mov dword [ebp - 8], 0
push dword [edi + eax + 4]
push 0
push 0x400
call dword [sym.imp.KERNEL32.dll_OpenProcess]
mov esi, eax
test esi, esi
je 0x401517
lea eax, [ebp - 8]
push eax
push 0xb
push esi
call dword [sym.imp.ADVAPI32.dll_OpenProcessToken]
test eax, eax
jne 0x401517
call ebx
push eax
push str.OpenProcessToken___failed__GetLastError__:__d_n
call fcn.00401060
add esp, 8
mov eax, dword [ebp - 8]
test eax, eax
je 0x40154b
lea ecx, [ebp - 0x18]
push ecx
push 1
push 3
push 0
push 0x2000000
push eax
call dword [sym.imp.ADVAPI32.dll_DuplicateTokenEx]
test eax, eax
jne 0x401548
call ebx
push eax
push str.DuplicateTokenEx___failed__GetLastError__:__d_n
call fcn.00401060
add esp, 8
mov eax, dword [ebp - 8]
test esi, esi
je 0x40155d
push esi
mov esi, dword [sym.imp.KERNEL32.dll_CloseHandle]
call esi
mov eax, dword [ebp - 8]
jmp 0x401563
mov esi, dword [sym.imp.KERNEL32.dll_CloseHandle]
test eax, eax
je 0x40156a
push eax
call esi
mov eax, dword [ebp - 0x20]
add edi, 0x10
inc eax
mov dword [ebp - 0x20], eax
cmp eax, dword [ebp - 0xc]
jb 0x4014a0
mov eax, dword [ebp - 0x1c]
test eax, eax
je 0x401587
push eax
call esi
mov eax, dword [ebp - 4]
test eax, eax
je 0x401591
push eax
call esi
mov eax, dword [ebp - 0x10]
test eax, eax
je 0x40159f
push eax
call dword [sym.imp.KERNEL32.dll_LocalFree]
mov eax, dword [ebp - 0x14]
test eax, eax
je 0x4015ad
push eax
call dword [sym.imp.WTSAPI32.dll_WTSFreeMemory]
push dword [ebp - 0x18]
push str.GetRealUserToken_Out__ret__0x_x_n
call fcn.00401060
mov eax, dword [ebp - 0x18]
add esp, 8
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret