3.3.4.3.11 RpcGetAllSessionsEx (Opnum 11)

The RpcGetAllSessionsEx method returns a pointer of type PEXECENVDATAEX, which points to the list of sessions currently running on the terminal server and the sessions running on various virtual machines hosted by the server. 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 the sessions for which the caller does not have the permission.<155>

 HRESULT RpcGetAllSessionsEx(
   [in] handle_t hBinding,
   [in] ULONG Level,
   [out, size_is(,*pcEntries)] PEXECENVDATAEX* ppSessionData,
   [out] ULONG* pcEntries
 );

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

Level: The level of information requested. This field MUST be set to 1. If the server does not support the level requested, it will set the level to the maximum supported level and return an implementation-specific nonzero value.

Value

Meaning

1

The union ExecEnvDataEx has the EXECENVDATAEX_LEVEL1 structure.

ppSessionData: A pointer of type PEXECENVDATAEX (section 2.2.2.7), which points to the list of sessions currently running on the terminal server and the sessions running on virtual machines hosted by the server.

pcEntries: The number of sessions currently running on the terminal server and returned in the ppSessionData structure.

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.