Function at 0x40836a
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 0x408583
push esi
xor esi, esi
cmp dword [ebp - 0x1c], ebx
jbe 0x40857a
mov ecx, dword [ebp - 0x18]
lea eax, [ecx + 8]
cmp dword [eax], ebx
je 0x4083bc
inc esi
add eax, 0xc
cmp esi, dword [ebp - 0x1c]
jb 0x4083aa
jmp 0x40857a
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 0x40856d
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 0x408484
push dword [ebp - 0xc]
call fcn.0043d933
push dword [ebp - 8]
mov edi, eax
mov dword [ebp - 0x14], edi
call fcn.0043d933
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 0x408484
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.00440d00
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.00440d00
mov ecx, dword [ebp - 4]
add esp, 0x18
xor eax, eax
mov word [ecx + edi*2 + 2], ax
jmp 0x40848a
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 0x408546
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 0x408546
xor edi, edi
cmp dword [ebp - 0x28], ebx
jbe 0x40853b
xor esi, esi
mov eax, dword [ebp - 0x10]
mov ecx, dword [ebp - 0x3c]
add eax, esi
cmp ecx, dword [eax]
jne 0x408515
mov eax, dword [eax + 0xc]
cmp eax, ebx
je 0x408515
push eax
push dword [ebp - 0x14]
call dword [sym.imp.ADVAPI32.dll_EqualSid]
test eax, eax
jne 0x408520
inc edi
add esi, 0x10
cmp edi, dword [ebp - 0x28]
jb 0x4084f4
jmp 0x40853b
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.004081cf
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 0x408561
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 0x40857a
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