Function at 0x402250
Capabilities:
Get session information

Disassembly:
push ebp
mov ebp, esp
push 0xffffffffffffffff
push 0x583720
mov eax, dword fs:[0]
push eax
sub esp, 0x24
push ebx
push esi
push edi
mov eax, dword [0x5f63b0]
xor eax, ebp
push eax
lea eax, [ebp - 0xc]
mov dword fs:[0], eax
cmp byte [0x6bfe40], 0
je 0x40228b
mov ecx, str.CNagScreenApp::StartUserPart
call fcn.00401270
call dword [sym.imp.KERNEL32.dll_WTSGetActiveConsoleSessionId]
or ebx, 0xffffffff
cmp byte [0x6bfe40], 0
mov edi, eax
je 0x40230b
call fcn.004285d4
xor ecx, ecx
mov edx, eax
test edx, edx
setne cl
test ecx, ecx
jne 0x4022bb
push 0x80004005
call fcn.00404b40
mov eax, dword [edx]
mov ecx, edx
call dword [eax + 0xc]
add eax, 0x10
mov dword [ebp - 0x1c], eax
push edi
lea eax, [ebp - 0x1c]
push str.WTSGetActiveConsoleSessionId_returned:__x
push eax
mov dword [ebp - 4], 0
call fcn.004038c0
mov esi, dword [ebp - 0x1c]
add esp, 0xc
mov ecx, esi
call fcn.00401270
add esi, 0xfffffff0
mov dword [ebp - 4], 0xffffffff
lea eax, [esi + 0xc]
mov ecx, ebx
lock xadd dword [eax], ecx
dec ecx
test ecx, ecx
jg 0x40230b
mov ecx, dword [esi]
push esi
mov eax, dword [ecx]
call dword [eax + 4]
cmp edi, 0xffffffff
jne 0x402339
cmp byte [0x6bfe40], 0
je 0x402507
mov ecx, str.dwSessionID__0xffffffff___exit
call fcn.00401270
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
lea eax, [ebp - 0x24]
push eax
lea eax, [ebp - 0x14]
push eax
push 8
push edi
push 0
mov dword [ebp - 0x14], 0
mov dword [ebp - 0x24], 0
call dword [sym.imp.WTSAPI32.dll_WTSQuerySessionInformationW]
test eax, eax
jne 0x402386
cmp byte [0x6bfe40], al
je 0x402507
mov ecx, str.WTSQuerySessionInformation_failed___exit
call fcn.00401270
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
cmp dword [ebp - 0x24], 4
jae 0x4023be
push dword [ebp - 0x14]
call dword [sym.imp.WTSAPI32.dll_WTSFreeMemory]
cmp byte [0x6bfe40], 0
je 0x402507
mov ecx, str.Bytes_return__4___exit
call fcn.00401270
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
mov eax, dword [ebp - 0x14]
push eax
mov ecx, dword [eax]
mov dword [ebp - 0x28], ecx
call dword [sym.imp.WTSAPI32.dll_WTSFreeMemory]
cmp byte [0x6bfe40], 0
je 0x402421
lea ecx, [ebp - 0x1c]
call fcn.00403090
mov dword [ebp - 4], 1
push dword [ebp - 0x28]
lea eax, [ebp - 0x1c]
push str.Connection_State:__i
push eax
call fcn.004038c0
mov esi, dword [ebp - 0x1c]
add esp, 0xc
mov ecx, esi
call fcn.00401270
add esi, 0xfffffff0
mov dword [ebp - 4], 0xffffffff
lea eax, [esi + 0xc]
lock xadd dword [eax], ebx
dec ebx
test ebx, ebx
jg 0x402421
mov ecx, dword [esi]
push esi
mov eax, dword [ecx]
call dword [eax + 4]
cmp dword [ebp - 0x28], 0
je 0x402451
cmp byte [0x6bfe40], 0
je 0x40243a
mov ecx, str.eConnectionState___WTSActive___exit
call fcn.00401270
call fcn.00409540
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
lea eax, [ebp - 0x10]
push eax
push 0x200eb
mov dword [ebp - 0x18], 0
mov dword [ebp - 0x10], 0
call dword [sym.imp.KERNEL32.dll_GetCurrentProcess]
push eax
call dword [sym.imp.ADVAPI32.dll_OpenProcessToken]
test eax, eax
je 0x402507
mov eax, dword [ebp - 0x10]
mov ebx, dword [sym.imp.ADVAPI32.dll_LookupPrivilegeValueW]
mov dword [ebp - 0x28], eax
lea eax, [ebp - 0x20]
push eax
push str.SeTcbPrivilege
push 0
call ebx
mov esi, dword [sym.imp.KERNEL32.dll_CloseHandle]
test eax, eax
je 0x4024fa
mov ecx, dword [ebp - 0x28]
lea eax, [ebp - 0x20]
push eax
mov edx, 1
call fcn.004021e0
add esp, 4
test eax, eax
je 0x4024fa
lea eax, [ebp - 0x18]
push eax
push edi
call dword [sym.imp.WTSAPI32.dll_WTSQueryUserToken]
test eax, eax
je 0x4024d4
mov ecx, dword [ebp - 0x18]
call fcn.00402520
push dword [ebp - 0x18]
call esi
mov edi, dword [ebp - 0x10]
lea eax, [ebp - 0x2c]
push eax
push str.SeTcbPrivilege
push 0
call ebx
test eax, eax
je 0x402502
lea eax, [ebp - 0x2c]
push eax
xor edx, edx
mov ecx, edi
call fcn.004021e0
add esp, 4
jmp 0x402502
mov ecx, dword [ebp - 0x10]
call fcn.00402520
push dword [ebp - 0x10]
call esi
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret