Function at 0x406750
Capabilities:
Get logon sessions
Get session information

Disassembly:
push ebp
mov ebp, esp
push 0xffffffffffffffff
push 0x42b991
mov eax, dword fs:[0]
push eax
sub esp, 0x90
mov eax, dword [0x43c00c]
xor eax, ebp
mov dword [ebp - 0x10], eax
push ebx
push esi
push edi
push eax
lea eax, [ebp - 0xc]
mov dword fs:[0], eax
mov edi, ecx
mov esi, dword [ebp + 8]
lea ebx, [edi + 0x60]
mov dword [ebp - 0x9c], esi
mov dword [ebp - 0x78], 0
cmp byte [edi + 0xa8], 0
mov dword [ebp - 0x80], esi
mov dword [ebp - 0x98], ebx
je 0x4067d0
lea eax, [edi + 0x64]
push eax
call dword [sym.imp.ADVAPI32.dll_IsValidSid]
test eax, eax
je 0x4067d0
push ebx
mov ecx, esi
call fcn.00408570
mov dword [ebp - 4], 0
mov dword [ebp - 0x78], 1
mov eax, esi
jmp 0x406b39
mov dword [ebp - 0x74], 0
mov dword [ebp - 4], 1
lea eax, [ebp - 0x94]
push eax
lea eax, [ebp - 0x74]
mov dword [ebp - 0x94], 0
push eax
push 0x18
call dword [sym.imp.KERNEL32.dll_WTSGetActiveConsoleSessionId]
push eax
push 0
call dword [sym.imp.WTSAPI32.dll_WTSQuerySessionInformationW]
test eax, eax
jne 0x406855
call dword [sym.imp.KERNEL32.dll_GetLastError]
test eax, eax
jle 0x40681a
movzx eax, ax
or eax, 0x80070000
push eax
mov edx, 0x35
mov ecx, str.Environment::GetActiveUserSid
call fcn.00408eb0
add esp, 4
mov ecx, edi
push esi
call fcn.004065f0
mov dword [ebp - 0x78], 1
mov byte [ebp - 4], 0
mov eax, dword [ebp - 0x74]
test eax, eax
je 0x40684e
push eax
call dword [sym.imp.WTSAPI32.dll_WTSFreeMemory]
mov eax, esi
jmp 0x406b39
mov dword [ebp - 0x88], 0
mov dword [ebp - 0x7c], 0
mov byte [ebp - 4], 2
lea eax, [ebp - 0x7c]
push eax
lea eax, [ebp - 0x88]
push eax
call dword [sym.imp.Secur32.dll_LsaEnumerateLogonSessions]
test eax, eax
je 0x4068cf
push eax
call dword [sym.imp.ADVAPI32.dll_LsaNtStatusToWinError]
test eax, eax
jle 0x406892
movzx eax, ax
or eax, 0x80070000
push eax
mov edx, 0x3e
mov ecx, str.Environment::GetActiveUserSid
call fcn.00408eb0
add esp, 4
mov ecx, edi
push esi
call fcn.004065f0
mov dword [ebp - 0x78], 1
mov byte [ebp - 4], 1
mov eax, dword [ebp - 0x7c]
test eax, eax
je 0x40683c
push eax
call dword [sym.imp.Secur32.dll_LsaFreeReturnBuffer]
jmp 0x40683c
mov eax, dword [ebp - 0x74]
lea ecx, [ebp - 0x90]
add eax, 0x82
push eax
call fcn.00403e60
mov byte [ebp - 4], 3
lea ecx, [ebp - 0x8c]
mov eax, dword [ebp - 0x74]
add eax, 0x60
push eax
call fcn.00403e60
mov byte [ebp - 4], 4
xor ebx, ebx
cmp dword [ebp - 0x88], ebx
jbe 0x406a3e
nop dword [eax + eax]
cmp byte [edi + 0xa8], 0
je 0x40692b
lea eax, [edi + 0x64]
push eax
call dword [sym.imp.ADVAPI32.dll_IsValidSid]
test eax, eax
jne 0x406a3b
mov dword [ebp - 0x84], 0
mov byte [ebp - 4], 5
lea eax, [ebp - 0x84]
push eax
mov eax, dword [ebp - 0x7c]
lea eax, [eax + ebx*8]
push eax
call dword [sym.imp.Secur32.dll_LsaGetLogonSessionData]
test eax, eax
jne 0x406a19
mov eax, dword [ebp - 0x84]
cmp dword [eax + 0x24], 2
jne 0x406a19
mov ecx, dword [ebp - 0x74]
mov edx, dword [eax + 0x28]
cmp edx, dword [ecx + 4]
jne 0x406a19
mov ecx, dword [eax + 0x10]
test ecx, ecx
je 0x406b57
mov edx, dword [ebp - 0x90]
mov si, word [edx]
cmp si, word [ecx]
jne 0x4069ab
test si, si
je 0x4069a7
mov si, word [edx + 2]
cmp si, word [ecx + 2]
jne 0x4069ab
add edx, 4
add ecx, 4
test si, si
jne 0x406985
xor ecx, ecx
jmp 0x4069b0
sbb ecx, ecx
or ecx, 1
test ecx, ecx
jne 0x406a19
mov ecx, dword [eax + 0x18]
test ecx, ecx
je 0x406b57
mov edx, dword [ebp - 0x8c]
mov si, word [edx]
cmp si, word [ecx]
jne 0x4069eb
test si, si
je 0x4069e7
mov si, word [edx + 2]
cmp si, word [ecx + 2]
jne 0x4069eb
add edx, 4
add ecx, 4
test si, si
jne 0x4069c5
xor ecx, ecx
jmp 0x4069f0
sbb ecx, ecx
or ecx, 1
test ecx, ecx
jne 0x406a19
push ecx
push dword [eax + 0x2c]
lea ecx, [ebp - 0x70]
call fcn.00407ce0
mov byte [ebp - 4], 6
lea ecx, [edi + 0x60]
push eax
call fcn.00407e50
mov byte [ebp - 4], 5
lea ecx, [ebp - 0x70]
call fcn.00401980
mov byte [ebp - 4], 4
mov eax, dword [ebp - 0x84]
test eax, eax
je 0x406a2e
push eax
call dword [sym.imp.Secur32.dll_LsaFreeReturnBuffer]
inc ebx
cmp ebx, dword [ebp - 0x88]
jb 0x406910
mov esi, dword [ebp - 0x80]
cmp byte [edi + 0xa8], 0
je 0x406aac
lea eax, [edi + 0x64]
push eax
call dword [sym.imp.ADVAPI32.dll_IsValidSid]
test eax, eax
je 0x406aac
mov ebx, dword [ebp - 0x98]
mov ecx, ebx
call fcn.00407fd0
push eax
push str.Active_user_SID___S
push 0x53
push str.Environment::GetActiveUserSid
call fcn.00408e10
add esp, 0x10
mov ecx, esi
push ebx
call fcn.00408570
mov dword [ebp - 0x78], 1
mov byte [ebp - 4], 3
or esi, 0xffffffff
mov edx, dword [ebp - 0x8c]
mov eax, esi
add edx, 0xfffffff0
lock xadd dword [edx + 0xc], eax
dec eax
test eax, eax
jg 0x406aaa
mov ecx, dword [edx]
push edx
mov eax, dword [ecx]
call dword [eax + 4]
jmp 0x406af3
push str.cant_get_valid_user
push 0x58
push str.Environment::GetActiveUserSid
call fcn.00408e10
add esp, 0xc
mov ecx, edi
push esi
call fcn.004065f0
mov dword [ebp - 0x78], 1
mov byte [ebp - 4], 3
or esi, 0xffffffff
mov edx, dword [ebp - 0x8c]
mov eax, esi
add edx, 0xfffffff0
lock xadd dword [edx + 0xc], eax
dec eax
test eax, eax
jg 0x406af3
mov ecx, dword [edx]
push edx
mov eax, dword [ecx]
call dword [eax + 4]
mov byte [ebp - 4], 2
mov edx, dword [ebp - 0x90]
add edx, 0xfffffff0
lock xadd dword [edx + 0xc], esi
dec esi
test esi, esi
jg 0x406b12
mov ecx, dword [edx]
push edx
mov eax, dword [ecx]
call dword [eax + 4]
mov byte [ebp - 4], 1
mov eax, dword [ebp - 0x7c]
test eax, eax
je 0x406b24
push eax
call dword [sym.imp.Secur32.dll_LsaFreeReturnBuffer]
mov byte [ebp - 4], 0
mov eax, dword [ebp - 0x74]
test eax, eax
je 0x406b36
push eax
call dword [sym.imp.WTSAPI32.dll_WTSFreeMemory]
mov eax, dword [ebp - 0x80]
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 0x10]
xor ecx, ebp
call fcn.0040c5eb
mov esp, ebp
pop ebp
ret 4
push 0x80004005
push 0x5a4
mov edx, str.ATL::CStringT_wchar_t_class_ATL::StrTraitATL_wchar_t_class_ATL::ChTraitsCRT_wchar_t_____::Compare
mov ecx, str.c:program_files__x86_microsoft_visual_studio2017_buildtools_vc_toolsmsvc14.16.27023_atlmfcincludecstringt.h
call fcn.00405890
int3