Function at 0x404530
Capabilities:
Get logon sessions

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x3c
mov eax, dword [0x490274]
xor eax, ebp
mov dword [ebp - 4], eax
push ebx
push esi
push edi
push str.Wtsapi32.dll
mov ebx, ecx
mov dword [ebp - 8], 0
mov dword [ebp - 0x2c], 0
call dword [sym.imp.KERNEL32.dll_LoadLibraryW]
mov esi, eax
push str.WTSEnumerateSessionsW
push esi
call dword [sym.imp.KERNEL32.dll_GetProcAddress]
test eax, eax
je 0x4045af
lea ecx, [ebp - 0xc]
push ecx
lea ecx, [ebp - 0x2c]
push ecx
push 1
push 0
push 0
call eax
mov edx, dword [ebp - 0xc]
xor eax, eax
test edx, edx
je 0x4045a8
mov edi, dword [ebp - 0x2c]
lea ecx, [edi + 8]
nop
cmp dword [ecx], 0
je 0x40459f
inc eax
add ecx, 0xc
cmp eax, edx
jb 0x404590
jmp 0x4045a8
lea eax, [eax + eax*2]
mov eax, dword [edi + eax*4]
mov dword [ebp - 8], eax
push esi
call dword [sym.imp.KERNEL32.dll_FreeLibrary]
lea eax, [ebp - 0x2c]
mov dword [ebp - 0x2c], 0
push eax
push dword [ebp - 8]
call fcn.00403ac0
test al, al
je 0x4047f1
push dword [ebp - 0x2c]
mov dword [ebp - 0x3c], 0
push 0
push 0x400
call dword [sym.imp.KERNEL32.dll_OpenProcess]
mov edi, eax
test edi, edi
je 0x4047f1
lea eax, [ebp - 0x2c]
mov dword [ebp - 0x2c], 0
push eax
push 0xf01ff
push edi
call dword [sym.imp.ADVAPI32.dll_OpenProcessToken]
test eax, eax
je 0x40462f
lea eax, [ebp - 0x3c]
push eax
push 1
push 2
push 0
push 0xf01ff
push dword [ebp - 0x2c]
call dword [sym.imp.ADVAPI32.dll_DuplicateTokenEx]
mov esi, dword [sym.imp.KERNEL32.dll_CloseHandle]
push dword [ebp - 0x2c]
test eax, eax
jne 0x404636
call esi
jmp 0x404635
mov esi, dword [sym.imp.KERNEL32.dll_CloseHandle]
push edi
call esi
mov eax, dword [ebx + 4]
lea ecx, [ebx + 4]
mov dword [ebp - 0x34], 0
cmp eax, 0xffffffff
jne 0x40465c
push ecx
call fcn.00403cf0
mov eax, dword [ebx + 4]
cmp eax, 0xffffffff
je 0x4047f1
lea ecx, [ebp - 0x34]
push ecx
push ecx
push eax
call fcn.00403a20
test al, al
je 0x4047f1
mov esi, dword [ebp - 0x34]
test esi, esi
je 0x4046c4
lea eax, [ebp - 0x10]
xorps xmm0, xmm0
push eax
push str.SeCreateTokenPrivilege
push 0
movups xmmword [ebp - 0x28], xmm0
movlpd qword [ebp - 0x10], xmm0
call dword [sym.imp.ADVAPI32.dll_LookupPrivilegeValueW]
test eax, eax
je 0x4046c4
mov eax, dword [ebp - 0x10]
push 0
push 0
mov dword [ebp - 0x24], eax
mov eax, dword [ebp - 0xc]
push 0x10
mov dword [ebp - 0x20], eax
lea eax, [ebp - 0x28]
push eax
push 0
push esi
mov dword [ebp - 0x28], 1
mov dword [ebp - 0x1c], 2
call dword [sym.imp.ADVAPI32.dll_AdjustTokenPrivileges]
push dword [ebp - 0x34]
call dword [sym.imp.ADVAPI32.dll_ImpersonateLoggedOnUser]
lea eax, [ebp - 0x38]
xor ebx, ebx
push eax
lea eax, [ebp - 0x14]
mov dword [ebp - 0x30], ebx
xor esi, esi
mov dword [ebp - 0x38], ebx
push eax
mov dword [ebp - 0x2c], esi
call dword [sym.imp.Secur32.dll_LsaEnumerateLogonSessions]
test eax, eax
js 0x4047f1
xor edi, edi
cmp dword [ebp - 0x14], ebx
jbe 0x4047a2
nop dword [eax + eax]
lea eax, [ebp - 0x30]
push eax
mov eax, dword [ebp - 0x38]
lea eax, [eax + edi*8]
push eax
call dword [sym.imp.Secur32.dll_LsaGetLogonSessionData]
test eax, eax
js 0x4047a2
mov ecx, dword [ebp - 0x30]
cmp dword [ecx + 0x10], 0
je 0x404778
mov eax, dword [ecx + 0x28]
cmp eax, dword [ebp - 8]
jne 0x404778
mov eax, dword [ebp - 0x38]
lea eax, [eax + edi*8]
push eax
push dword [ebp - 0x3c]
call fcn.00403dd0
mov esi, eax
mov dword [ebp - 0xc], 0
lea eax, [ebp - 0xc]
push eax
push 4
lea eax, [ebp - 0x18]
push eax
push 0x12
push esi
call dword [sym.imp.ADVAPI32.dll_GetTokenInformation]
test eax, eax
je 0x404796
mov eax, dword [ebp - 0x18]
cmp eax, 2
je 0x404796
cmp eax, 1
jne 0x40476e
test ebx, ebx
jne 0x40478b
mov ebx, esi
jmp 0x404775
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov ecx, dword [ebp - 0x30]
push ecx
call dword [sym.imp.Secur32.dll_LsaFreeReturnBuffer]
inc edi
cmp edi, dword [ebp - 0x14]
jb 0x404700
jmp 0x4047a2
push esi
mov esi, dword [sym.imp.KERNEL32.dll_CloseHandle]
call esi
jmp 0x4047a8
push dword [ebp - 0x30]
mov dword [ebp - 0x2c], esi
call dword [sym.imp.Secur32.dll_LsaFreeReturnBuffer]
mov esi, dword [sym.imp.KERNEL32.dll_CloseHandle]
mov eax, dword [ebp - 0x2c]
test eax, eax
cmovne ebx, eax
test ebx, ebx
je 0x4047c3
push 4
lea eax, [ebp - 8]
push eax
push 0xc
push ebx
call dword [sym.imp.ADVAPI32.dll_SetTokenInformation]
cmp dword [ebp - 0x34], 0
je 0x4047d4
call dword [sym.imp.ADVAPI32.dll_RevertToSelf]
push dword [ebp - 0x34]
call esi
mov eax, dword [ebp - 0x3c]
test eax, eax
je 0x4047de
push eax
call esi
mov eax, ebx
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.00435bdb
mov esp, ebp
pop ebp
ret
mov ecx, dword [ebp - 4]
xor eax, eax
pop edi
pop esi
xor ecx, ebp
pop ebx
call fcn.00435bdb
mov esp, ebp
pop ebp
ret