3.3.4.3.8 RpcGetSessionIds (Opnum 8)

The RpcGetSessionIds method returns a list of the IDs associated with the sessions running on a terminal server that satisfy the specified filter. 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 3.1.1) by setting it as the Access Request mask, and skips sessions for which the caller does not have the permission.

 HRESULT RpcGetSessionIds(
   [in] handle_t hBinding,
   [in] SESSION_FILTER Filter,
   [in, range(0, 0xFFFF)] ULONG MaxEntries,
   [out, size_is(,*pcSessionIds)] LONG** pSessionIds,
   [out] ULONG* pcSessionIds
 );

hBinding:  The RPC binding handle. For more information, see [MSDN-RPCBIND].

Filter:  The filter to apply to the sessions running on the terminal server. This is of type SESSION_FILTER.

MaxEntries:  The maximum number of session IDs to return. This value MUST be less than or equal to the number of entries in the pSessionIds array.

pSessionIds:  An array to contain the list of session IDs running on the terminal server and filtered as specified by Filter.

pcSessionIds:  The number of session IDs returned.

Return Values:  The method MUST return S_OK (0x00000000) on success; otherwise, it MUST return an implementation-specific negative value.

Return value/code

Description

0x00000000

S_OK

Successful completion.