Function at 0x40a2b5
Capabilities:
Compare security identifiers
Enumerate processes on remote desktop session host
Get session information
Get session user name
Get user security identifier

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x40
push ebx
lea eax, [ebp - 0x1c]
push eax
lea eax, [ebp - 0x18]
push eax
xor ebx, ebx
push 1
push ebx
push ebx
mov dword [ebp - 0x40], ecx
mov dword [ebp - 0x18], ebx
mov dword [ebp - 0x1c], ebx
mov dword [ebp - 0x30], ebx
call sub.WTSAPI32.dll_WTSEnumerateSessionsW
test eax, eax
je 0x40a4ce
push esi
xor esi, esi
cmp dword [ebp - 0x1c], ebx
jbe 0x40a4c5
mov ecx, dword [ebp - 0x18]
lea eax, [ecx + 8]
cmp dword [eax], ebx
je 0x40a307
inc esi
add eax, 0xc
cmp esi, dword [ebp - 0x1c]
jb 0x40a2f5
jmp 0x40a4c5
imul esi, esi, 0xc
mov dword [ebp - 0xc], ebx
mov dword [ebp - 8], ebx
mov dword [ebp - 0x2c], ebx
mov eax, dword [esi + ecx]
lea ecx, [ebp - 0x2c]
push ecx
lea ecx, [ebp - 0xc]
push ecx
push 7
push eax
push ebx
mov dword [ebp - 0x3c], eax
call sub.WTSAPI32.dll_WTSQuerySessionInformationW
lea eax, [ebp - 0x2c]
push eax
lea eax, [ebp - 8]
push eax
mov eax, dword [ebp - 0x18]
push 5
push dword [esi + eax]
push ebx
call sub.WTSAPI32.dll_WTSQuerySessionInformationW
test eax, eax
je 0x40a4b8
mov esi, dword [sym.imp.KERNEL32.dll_LocalAlloc]
push edi
mov dword [ebp - 0x24], ebx
mov dword [ebp - 0x20], ebx
mov dword [ebp - 0x10], ebx
mov dword [ebp - 0x28], ebx
cmp dword [ebp - 0xc], ebx
je 0x40a3cf
push dword [ebp - 0xc]
call fcn.004440e4
push dword [ebp - 8]
mov edi, eax
mov dword [ebp - 0x14], edi
call fcn.004440e4
pop ecx
add edi, eax
pop ecx
mov dword [ebp - 0x34], eax
lea eax, [edi + edi + 4]
push eax
push 0x40
call esi
mov dword [ebp - 4], eax
cmp eax, ebx
je 0x40a3cf
mov eax, dword [ebp - 0x14]
add eax, eax
push eax
push dword [ebp - 0xc]
mov dword [ebp - 0x14], eax
push dword [ebp - 4]
call fcn.00447690
mov ecx, dword [ebp - 4]
mov eax, dword [ebp - 0x14]
add eax, ecx
push 0x5c
pop ecx
mov word [eax], cx
mov ecx, dword [ebp - 0x34]
add ecx, ecx
push ecx
push dword [ebp - 8]
add eax, 2
push eax
call fcn.00447690
mov ecx, dword [ebp - 4]
add esp, 0x18
xor eax, eax
mov word [ecx + edi*2 + 2], ax
jmp 0x40a3d5
mov eax, dword [ebp - 8]
mov dword [ebp - 4], eax
mov edi, dword [sym.imp.ADVAPI32.dll_LookupAccountNameW]
lea eax, [ebp - 0x38]
push eax
lea eax, [ebp - 0x20]
push eax
push ebx
lea eax, [ebp - 0x24]
push eax
push ebx
push dword [ebp - 4]
push ebx
call edi
push dword [ebp - 0x24]
push 0x40
call esi
mov dword [ebp - 0x14], eax
mov eax, dword [ebp - 0x20]
add eax, eax
push eax
push 0x40
call esi
lea ecx, [ebp - 0x38]
push ecx
lea ecx, [ebp - 0x20]
push ecx
push eax
mov dword [ebp - 0x34], eax
lea eax, [ebp - 0x24]
push eax
push dword [ebp - 0x14]
push dword [ebp - 4]
push ebx
call edi
cmp dword [ebp - 0x14], ebx
je 0x40a491
lea eax, [ebp - 0x28]
push eax
lea eax, [ebp - 0x10]
push eax
push 1
push ebx
push ebx
call sub.WTSAPI32.dll_WTSEnumerateProcessesW
test eax, eax
je 0x40a491
xor edi, edi
cmp dword [ebp - 0x28], ebx
jbe 0x40a486
xor esi, esi
mov eax, dword [ebp - 0x10]
mov ecx, dword [ebp - 0x3c]
add eax, esi
cmp ecx, dword [eax]
jne 0x40a460
mov eax, dword [eax + 0xc]
cmp eax, ebx
je 0x40a460
push eax
push dword [ebp - 0x14]
call dword [sym.imp.ADVAPI32.dll_EqualSid]
test eax, eax
jne 0x40a46b
inc edi
add esi, 0x10
cmp edi, dword [ebp - 0x28]
jb 0x40a43f
jmp 0x40a486
push dword [ebp + 8]
mov eax, dword [ebp - 0x10]
push dword [ebp + 0xc]
mov ecx, dword [ebp - 0x40]
shl edi, 4
push dword [edi + eax + 4]
call fcn.0040a11a
mov dword [ebp - 0x30], eax
push dword [ebp - 0x10]
call sub.WTSAPI32.dll_WTSFreeMemory
mov dword [ebp - 0x10], ebx
push dword [ebp - 0x14]
mov edi, dword [sym.imp.KERNEL32.dll_LocalFree]
call edi
push dword [ebp - 0x34]
call edi
mov eax, dword [ebp - 4]
cmp eax, dword [ebp - 8]
je 0x40a4ac
push eax
call edi
push dword [ebp - 8]
call sub.WTSAPI32.dll_WTSFreeMemory
mov dword [ebp - 8], ebx
pop edi
cmp dword [ebp - 0xc], ebx
je 0x40a4c5
push dword [ebp - 0xc]
call sub.WTSAPI32.dll_WTSFreeMemory
push dword [ebp - 0x18]
call sub.WTSAPI32.dll_WTSFreeMemory
pop esi
mov eax, dword [ebp - 0x30]
pop ebx
leave
ret 8