Jimm Chen
Jimm Chen

Reputation: 3787

How to know calling process's logon session LUID?

Using the WinObj utility, we can see there are many logon sessions on a Windows system, seen under \Sessions\0\DosDevices, something like 00000000-004e948e which is called LUID by MSDN.

WinObj DosDevices nodes

I also know that LogonSessions utility can show those information as well.

Then my question is, how does a logged-on user know which logon-session-id belongs to him currently? One indirect way I found is: Running code like

DefineDosDevice(DDD_RAW_TARGET_PATH, "CHJLINK", "chjTarget");

and see which node has CHJLINK created.

Is there any more direct way to achieve that information? Some Windows API, or some command line utility?

Upvotes: 0

Views: 1054

Answers (1)

RbMm
RbMm

Reputation: 33754

you need open process token and query it TokenStatistics and use AuthenticationId from TOKEN_STATISTICS structure.

Upvotes: 2

Related Questions