2014. 1. 9. 10:24

Get Logon Session (AuthenticationId)

Process Explorer를 보면 Logon Session 이란 항목이 존재한다.

하나의 Session 내의 다수의 Logon 계정이 동시 존재할 수 있으며, 그 때마다 다른 Logon Session을 부여 받는다.

RunAs 인 경우가 대표적인 경우이다. 

해당 값을 구하는 코드는 다음과 같다.

TOKEN_STATISTICS 구조체의 AuthenticationId member에 해당 값이 존재한다.

PTOKEN_STATISTICS pStatic

if(!::GetTokenInformation(hToken, TokenStatistics, pStatic, buf.size(), &dwLength))

LUID luid = pStatic->AuthenticationId;