<div class="content" name="RpcWinStationEnumerateProcesses" uuid="3559bc19-8ca3-4bcf-842e-cf25f592dc1a"><p>The RpcWinStationEnumerateProcesses method retrieves the
processes running on a remote server on which the caller has WINSTATION_QUERY
permission to retrieve information. The method checks whether the caller has
WINSTATION_QUERY permission (section <span><a href="4507e852-be3d-45b6-bc47-8ca0b552c94d" data-linktype="relative-path">3.1.1</a></span>) by setting
it as the Access Request mask, and fails if the caller does not have the
permission.<a id="Appendix_A_Target_192"></a><a aria-label="Product behavior note 192" href="7ce7f717-461b-4f18-9829-6690168c7707#Appendix_A_192" data-linktype="relative-path">&lt;192&gt;</a></p><dl>
<dd>
<div><pre> BOOLEAN RpcWinStationEnumerateProcesses(
   [in] SERVER_HANDLE hServer,
   [out] DWORD* pResult,
   [out, size_is(ByteCount)] PBYTE pProcessBuffer,
   [in, range(0, 0x8000 )] DWORD ByteCount
 );
</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>.
hServer 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>pResult: </b> Failure error code if the call to
RpcWinStationEnumerateProcesses failed. If the call was successful, this
parameter MUST be STATUS_SUCCESS (0x00000000), as specified in <span><a href="../ms-erref/1bc92ddf-b79e-413c-bbaa-99a5281a6c90" data-linktype="relative-path">[MS-ERREF]</a></span>.</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>STATUS_INFO_LENGTH_MISMATCH 0xC0000004</td>
  <td>ByteCount is too small to receive the data.</td>
 </tr></tbody></table>
</dd></dl><p><b>pProcessBuffer: </b> Pointer to a buffer receiving
the list of processes.</p><dl>
<dd>
<p>In <i>pProcessBuffer</i> for each process, the
server will return the following in the buffer, in this order:</p>
</dd></dl><ol><li><p><span>   
</span>A <span><a href="0a8a73d9-3c9e-4d2d-91e4-7fef48b6c29d" data-linktype="relative-path">TS_PROCESS_INFORMATION_NT4</a></span>
structure.</p>
</li><li><p><span>   
</span>A number of SYSTEM_THREAD_INFORMATION (see [WININTERNALS] or <span><a href="https://go.microsoft.com/fwlink/?LinkId=208768" data-linktype="external">[MSFT-WINSYSINTERNALS]</a></span>)
structures equal to the maximum number of threads in the process.</p>
</li><li><p><span>   
</span>A <span><a href="96702c7d-6f5f-4965-8f29-5fdbea73278e" data-linktype="relative-path">TS_SYS_PROCESS_INFORMATION</a></span>
structure for the process.</p>
</li></ol><dl>
<dd>
<p>Only up to SIZEOF
TS4_SYSTEM_THREAD_INFORMATION of the SYSTEM_THREAD_INFORMATION structure (as
specified in [WININTERNALS] or [MSFT-WINSYSINTERNALS]) is copied into the
buffer and only up to SIZEOF TS4_SYSTEM_PROCESS_INFORMATION of the
TS_SYS_PROCESS_INFORMATION_NT4 structure is copied into the buffer.</p>
</dd></dl><p><b>ByteCount: </b> The size, in bytes, of the <i>pProcessBuffer</i>
parameter. If ByteCount is too small to receive the data, the method returns an
error code (STATUS_INFO_LENGTH_MISMATCH, as specified in [MS-ERREF]) in the <i>pResult</i>
parameter. Note that during failure no indication is given to the caller
specifying the correct size if <i>pProcessBuffer</i> is too small.</p><p><b>Return Values: </b> Returns TRUE if the call
succeeded, or FALSE if the method failed. On failure, <i>pResult</i> 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>