How to get process SID from its handle?

484 Views Asked by At

Consider I have the following handle for process:

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

How can I get process's 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. To be more specific, I don't know how to specify SE_OBJECT_TYPE (2nd parameter).

1

There are 1 best solutions below

0
Jeaninez - MSFT On

According to the Doc: SID structure (winnt.h)

The security identifier (SID) structure is a variable-length structure used to uniquely identify users or groups.

As far as I'm concerned, you couldn't get process's SID.