<div class="content" name="RpcGetEnumResult" uuid="1a7d5d1d-1ce5-448f-bb4a-c79741982edb"><p>The RpcGetEnumResult method returns a pointer of the type <span><a href="fd8759ef-4f6c-45c6-b542-9d5e53e90f7d" data-linktype="relative-path">PSESSIONENUM</a></span>
which points to the list of sessions currently running on the <span><a href="c41d3367-04c9-4c93-babf-9b5de834eb29#gt_b416f72e-cf04-4d80-bf93-f5753f3b0998" data-linktype="relative-path">terminal
server</a></span> after applying the specified filter. This method MUST be
called after <span><a href="f17f4b8d-8d52-4538-acf3-cdfbe581a99b" data-linktype="relative-path">RpcOpenEnum</a></span>. No
special permissions are required to call this method. However, only sessions
for 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 skips the sessions for which the
caller does not have the permission. </p><dl>
<dd>
<div><pre> HRESULT RpcGetEnumResult(
   [in] ENUM_HANDLE hEnum,
   [out, size_is(,*pEntries)] PSESSIONENUM* ppSessionEnumResult,
   [in] DWORD Level,
   [out] ULONG* pEntries
 );
</pre></div>
</dd></dl><p><b>hEnum: </b> The <span><a href="c41d3367-04c9-4c93-babf-9b5de834eb29#gt_5044babb-08e3-4bb9-bc12-fe8f542b05ee" data-linktype="relative-path">handle</a></span> to the
session enumeration object. This is of type <span><a href="15f02d59-200a-435d-a07b-055e1276d01c" data-linktype="relative-path">ENUM_HANDLE</a></span>.</p><p><b>ppSessionEnumResult: </b>A pointer of the type
PSESSIONENUM which points to the list of sessions currently running on the
terminal server.</p><p><b>Level: </b>The level of information requested.
This field MUST be set to the supported values of 1 or 2. If the server does
not support the level requested, it will set the level to the maximum supported
level and return information accordingly.<a id="Appendix_A_Target_153"></a><a aria-label="Product behavior note 153" href="7ce7f717-461b-4f18-9829-6690168c7707#Appendix_A_153" data-linktype="relative-path">&lt;153&gt;</a></p><p><b>pEntries: </b> The number of sessions currently
running on the terminal server and returned in the <i>ppSessionEnumResult</i>
structure.</p><p><b>Return Values: </b> The method MUST return S_OK
(0x00000000) on success; otherwise, it MUST return an implementation-specific
negative value.</p><dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Return value/code</p>
   </th>
   <th>
   <p>Description</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>0x00000000 S_OK</td>
  <td>Successful completion.</td>
 </tr></tbody></table>
</dd></dl><p> </p></div>