<div class="content" name="RpcWinStationGetProcessSid" uuid="94fc771f-7583-4a4d-8579-efac05820551"><p>The RpcWinStationGetProcessSid method retrieves the process
security identifier (SID), as specified in <span><a href="../ms-dtyp/cca27429-5689-4a16-b2b4-9325d93e4ba2" data-linktype="relative-path">[MS-DTYP]</a></span>
section <span><a href="../ms-dtyp/78eb9013-1c3a-4970-ad1f-2b1dad588a25" data-linktype="relative-path">2.4.2</a></span>,
for a given process ID and process start time combination.<a id="Appendix_A_Target_193"></a><a aria-label="Product behavior note 193" href="7ce7f717-461b-4f18-9829-6690168c7707#Appendix_A_193" data-linktype="relative-path">&lt;193&gt;</a>The caller MUST have the
PROCESS_QUERY_INFORMATION access right to the process being queried and the
TOKEN_QUERY access right to the access token associated with the process. For
more information on the process access rights, see <span><a href="https://go.microsoft.com/fwlink/?LinkId=208137" data-linktype="external">[MSDN-PROCRIGHTS]</a></span>.
For more information on access rights for access tokens, see <span><a href="https://go.microsoft.com/fwlink/?LinkId=208138" data-linktype="external">[MSDN-TOKENRIGHTS]</a></span>.</p><dl>
<dd>
<div><pre> BOOLEAN RpcWinStationGetProcessSid(
   [in] SERVER_HANDLE hServer,
   [in] DWORD dwUniqueProcessId,
   [in] LARGE_INTEGER ProcessStartTime,
   [out] LONG* pResult,
   [in, out, unique, size_is(dwSidSize)] 
     PBYTE pProcessUserSid,
   [in, range(0, 1024 )] DWORD dwSidSize,
   [in, out] DWORD* pdwSizeNeeded
 );
</pre></div>
</dd></dl><p><b>hServer:</b> Handle to the server object. This is
of type <span><a href="49484cdf-2feb-4de9-a588-5d01cf8995dc" data-linktype="relative-path">SERVER_HANDLE</a></span>. The <i>hServer</i>
argument MUST be obtained from a previous call to <span><a href="fd6f339d-f5dd-452c-a9a9-ec753c22a36a" data-linktype="relative-path">RpcWinStationOpenServer</a></span>.</p><p><b>dwUniqueProcessId: </b> The process ID to retrieve
the SID.</p><p><b>ProcessStartTime: </b> The start time of the
process indicated by <i>dwUniqueProcessId</i>. This is a 64-bit value
representing the number of 100-nanosecond intervals since January 1, 1601 (UTC).
<i>ProcessStartTime</i> combined with <i>dwUniqueProcessId</i> is used to
identify a process.</p><p><b>pResult: </b> Failure error code if the call to
RpcWinStationGetProcessSid failed. If the call was successful, this parameter
MUST be STATUS_SUCCESS (0x00000000).</p><dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Value</p>
   </th>
   <th>
   <p>Meaning</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>STATUS_SUCCESS 0x00000000</td>
  <td>The call succeeded.</td>
 </tr><tr>
  <td>0x8007007A</td>
  <td>The size of pProcessUserSid buffer is too small.&lt;194&gt;</td>
 </tr><tr>
  <td>STATUS_BUFFER_TOO_SMALL 0xC0000023</td>
  <td>The size of pProcessUserSid buffer is too small.&lt;195&gt;</td>
 </tr><tr>
  <td>0x80070005</td>
  <td>The caller does not have necessary permissions.&lt;196&gt;</td>
 </tr><tr>
  <td>STATUS_ACCESS_DENIED 0xC0000022</td>
  <td>The caller does not have necessary permissions.&lt;197&gt;</td>
 </tr></tbody></table>
</dd></dl><p><b>pProcessUserSid: </b> The buffer into which the
method MUST copy the SID of the process. MUST be NULL if <b>dwSidSize</b> is
zero, in which case the correct size will be returned in <b>pdwSizeNeeded</b>.</p><p><b>dwSidSize: </b> The size of the buffer, in bytes,
pointed to by <b>pProcessUserSid</b>. If the buffer is too small,
STATUS_BUFFER_TOO_SMALL<a id="Appendix_A_Target_198"></a><a aria-label="Product behavior note 198" href="7ce7f717-461b-4f18-9829-6690168c7707#Appendix_A_198" data-linktype="relative-path">&lt;198&gt;</a> or
0x8007007A<a id="Appendix_A_Target_199"></a><a aria-label="Product behavior note 199" href="7ce7f717-461b-4f18-9829-6690168c7707#Appendix_A_199" data-linktype="relative-path">&lt;199&gt;</a> is returned in <b>pResult</b>.</p><p><b>pdwSizeNeeded: </b> Indicates the length of the
SID. If STATUS_BUFFER_TOO_SMALL<a id="Appendix_A_Target_200"></a><a aria-label="Product behavior note 200" href="7ce7f717-461b-4f18-9829-6690168c7707#Appendix_A_200" data-linktype="relative-path">&lt;200&gt;</a> or 0x8007007A<a id="Appendix_A_Target_201"></a><a aria-label="Product behavior note 201" href="7ce7f717-461b-4f18-9829-6690168c7707#Appendix_A_201" data-linktype="relative-path">&lt;201&gt;</a> is returned in <b>pResult</b>,
this indicates to the caller the correct size to allocate to a buffer prior to
calling the method again.</p><p><b>Return Values: </b> Returns TRUE if the call succeeded,
and FALSE if the method failed. On failure, <b>pResult</b> indicates the
failure status code.</p><dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Return value/code</p>
   </th>
   <th>
   <p>Description</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>0x01 TRUE</td>
  <td>Successful completion.</td>
 </tr><tr>
  <td>0x00 FALSE</td>
  <td>Method call failed.</td>
 </tr></tbody></table>
</dd></dl><p> </p></div>