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

后端 未结 2 1865
面向向阳花
面向向阳花 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().

    0 讨论(0)
  • 2020-12-18 14:42

    WTSEnumerateProcesses works like gangbusters here:

    http://msdn.microsoft.com/en-us/library/aa383831%28VS.85%29.aspx

    0 讨论(0)
提交回复
热议问题