<div class="content" name="RpcWinStationEnumerate" uuid="fa654a9c-a67f-4e58-9fa7-5dd0ae6305a1"><p>The RpcWinStationEnumerate method retrieves a list of <span><a href="e5c755e8-6d66-494d-873f-4540267fe2f4" data-linktype="relative-path">LOGONID</a></span>
structures for sessions on a <span><a href="c41d3367-04c9-4c93-babf-9b5de834eb29#gt_b416f72e-cf04-4d80-bf93-f5753f3b0998" data-linktype="relative-path">terminal server</a></span>. No
special permissions are required to call this method. However, only sessions to
which the caller has WINSTATION_QUERY permission are enumerated. 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.</p><dl>
<dd>
<div><pre> BOOLEAN RpcWinStationEnumerate(
   [in] SERVER_HANDLE hServer,
   [out] DWORD* pResult,
   [in, out] PULONG pEntries,
   [in, out, unique, size_is(*pByteCount)] 
     PCHAR pLogonId,
   [in, out] PULONG pByteCount,
   [in, out] PULONG pIndex
 );
</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
hServer 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>pResult: </b>If the call was successful, this
parameter will 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>;
otherwise, it MUST be an implementation-specific negative value.</p><p><b>pEntries: </b> Pointer to the number of entries to
return to the caller. On return from this method, this is the number of logon
IDs actually returned in this call to RpcWinStationEnumerate.</p><p><b>pLogonId: </b> Buffer where the logon IDs are
stored when the method returns. This will be an array of LOGONID structures.
Caller MUST cast this to <span><a href="../ms-dtyp/77e1033f-b31d-4bd2-b3d5-9f3c9faa22eb" data-linktype="relative-path">PCHAR</a></span>
before calling this method.</p><p><b>pByteCount: </b> Size of the buffer, in bytes, to
which <i>pLogonId</i> points.</p><p><b>pIndex: </b> Last index of the logon ID lookup
from this call, passed to the server the next time this method is called.
Initial value of this passed by the caller MUST be 0.</p><p><b>Return Values: </b> Returns TRUE if the call
succeeded, or FALSE if the lookup failed. On failure, <i>pResult</i> indicates
the failure status code. If all of the logon IDs have already been retrieved
from the server, TRUE will be returned, and pResult will be
STATUS_NO_MORE_ENTRIES (as specified in [MS-ERREF]), indicating to the call
that all logon IDs have been retrieved.</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>