3.3.4.3.9 RpcGetEnumResultEx (Opnum 9)

The RpcGetEnumResultEx method returns a pointer of the type PSESSIONENUM_EX, which points to the list of sessions currently running on the terminal server after applying the specified filter. This method MUST be called after RpcOpenEnum. 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.

 HRESULT RpcGetEnumResultEx(
   [in] ENUM_HANDLE hEnum,
   [out, size_is(,*pEntries)] PSESSIONENUM_EX* ppSessionEnumResult,
   [in] DWORD Level,
   [out] ULONG* pEntries
 );

hEnum: The handle to the session enumeration object. This is of type ENUM_HANDLE.

ppSessionEnumResult: A pointer of the type PSESSIONENUM_EX which points to the list of sessions currently running on the terminal server.

Level: The level of information requested. This field MUST be set to the supported values of 1, 2, or 3. If the server does not support the level requested, it will set the level to the maximum supported level and return information accordingly.<152>

Value

Meaning

1

The union SessionInfo_Ex will have the SessionEnum_Level1 structure.

2

The union SessionInfo_Ex will have the SessionEnum_Level2 structure.

3

The union SessionInfo_Ex will have the SessionEnum_Level3 structure.

pEntries: The number of sessions currently running on the terminal server and returned in the ppSessionEnumResult 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.