简体   繁体   English

如何从其句柄中获取进程 SID?

[英]How to get process SID from its handle?

Consider I have the following handle for process:考虑我有以下处理句柄:

HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, entry.th32ProcessID);

How can I get process's SID?如何获取进程的 SID? It's necessary as I need to give permission for this process to some file.这是必要的,因为我需要为此过程授予某些文件的权限。 I thought that maybe GetSecurityInfo() might help, however I have no idea how to use it for process.我认为GetSecurityInfo()可能会有所帮助,但是我不知道如何将其用于进程。 To be more specific, I don't know how to specify SE_OBJECT_TYPE (2nd parameter).更具体地说,我不知道如何指定SE_OBJECT_TYPE (第二个参数)。

According to the Doc: SID structure (winnt.h)根据文档: SID结构(winnt.h)

The security identifier (SID) structure is a variable-length structure used to uniquely identify users or groups.安全标识符 (SID) 结构是用于唯一标识用户或组的可变长度结构。

As far as I'm concerned, you couldn't get process's SID.就我而言,您无法获得进程的 SID。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM