How do I get the SID / session of an arbitrary process?

后端 未结 2 1871
面向向阳花
面向向阳花 2020-12-18 13:58

I\'m writing a program to enumerate through processes, and I want to find out the SID/user ID and session of which the specified process is running under (i.e. i have

2条回答
  •  庸人自扰
    2020-12-18 14:41

    For the SID, call OpenProcess to get the handle, then pass the handle to GetSecurityInfo().

    For the session id, use ProcessIdToSessionId().

提交回复
热议问题