Function at 0x4040a0
Capabilities:
Get logon sessions

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x3c
mov eax, dword [0x46e224]
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 0x40411f
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 0x404118
mov edi, dword [ebp - 0x2c]
lea ecx, [edi + 8]
nop
cmp dword [ecx], 0
je 0x40410f
inc eax
add ecx, 0xc
cmp eax, edx
jb 0x404100
jmp 0x404118
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.00403630
test al, al
je 0x404353
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 0x404353
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 0x40419f
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 0x4041a6
call esi
jmp 0x4041a5
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 0x4041cc
push ecx
call fcn.00403870
mov eax, dword [ebx + 4]
cmp eax, 0xffffffff
je 0x404353
lea ecx, [ebp - 0x34]
push ecx
push ecx
push eax
call fcn.00403590
test al, al
je 0x404353
mov esi, dword [ebp - 0x34]
test esi, esi
je 0x404230
lea eax, [ebp - 0x10]
xorps xmm0, xmm0
push eax
push str.SeCreateTokenPrivilege
push 0
movlpd qword [ebp - 0x10], xmm0
call dword [sym.imp.ADVAPI32.dll_LookupPrivilegeValueW]
test eax, eax
je 0x404230
mov eax, dword [ebp - 0x10]
mov ecx, dword [ebp - 0xc]
push 0
push 0
push 0x10
mov dword [ebp - 0x24], eax
lea eax, [ebp - 0x28]
push eax
push 0
push esi
mov dword [ebp - 0x28], 1
mov dword [ebp - 0x20], ecx
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 esi, esi
push eax
lea eax, [ebp - 0x14]
mov dword [ebp - 0x30], esi
push eax
xor edi, edi
mov dword [ebp - 0x38], esi
call dword [sym.imp.Secur32.dll_LsaEnumerateLogonSessions]
test eax, eax
js 0x404353
xor ebx, ebx
cmp dword [ebp - 0x14], ebx
jbe 0x4042eb
lea eax, [ebp - 0x30]
push eax
mov eax, dword [ebp - 0x38]
lea eax, [eax + ebx*8]
push eax
call dword [sym.imp.Secur32.dll_LsaGetLogonSessionData]
test eax, eax
js 0x4042e9
mov ecx, dword [ebp - 0x30]
cmp dword [ecx + 0x10], 0
je 0x4042d8
mov eax, dword [ecx + 0x28]
cmp eax, dword [ebp - 8]
jne 0x4042d8
mov eax, dword [ebp - 0x38]
lea eax, [eax + ebx*8]
push eax
push dword [ebp - 0x3c]
call fcn.00403950
mov edi, eax
mov dword [ebp - 0xc], 0
lea eax, [ebp - 0xc]
push eax
push 4
lea eax, [ebp - 0x18]
push eax
push 0x12
push edi
call dword [sym.imp.ADVAPI32.dll_GetTokenInformation]
test eax, eax
je 0x404325
mov eax, dword [ebp - 0x18]
cmp eax, 2
je 0x404325
cmp eax, 1
jne 0x4042ce
test esi, esi
jne 0x40431c
mov esi, edi
jmp 0x4042d5
push edi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov ecx, dword [ebp - 0x30]
push ecx
call dword [sym.imp.Secur32.dll_LsaFreeReturnBuffer]
inc ebx
cmp ebx, dword [ebp - 0x14]
jb 0x404264
xor edi, edi
test edi, edi
cmovne esi, edi
test esi, esi
je 0x404303
push 4
lea eax, [ebp - 8]
push eax
push 0xc
push esi
call dword [sym.imp.ADVAPI32.dll_SetTokenInformation]
cmp dword [ebp - 0x34], 0
je 0x404330
call dword [sym.imp.ADVAPI32.dll_RevertToSelf]
push dword [ebp - 0x34]
mov ebx, dword [sym.imp.KERNEL32.dll_CloseHandle]
call ebx
jmp 0x404336
push edi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
jmp 0x4042f4
push dword [ebp - 0x30]
call dword [sym.imp.Secur32.dll_LsaFreeReturnBuffer]
jmp 0x4042eb
mov ebx, dword [sym.imp.KERNEL32.dll_CloseHandle]
mov eax, dword [ebp - 0x3c]
test eax, eax
je 0x404340
push eax
call ebx
mov eax, esi
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.00432107
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.00432107
mov esp, ebp
pop ebp
ret