3.7.4.1.6 RpcWinStationQueryInformation (Opnum 5)
The RpcWinStationQueryInformation method retrieves various types of configuration information on a session. The caller MUST have the WINSTATION_QUERY permission right as well as specific permission rights for some operations as indicated in the following sections. The method checks whether the caller has WINSTATION_QUERY permission and the specific permission required for some operations (section 3.1.1) by setting it as the Access Request mask, and fails if the caller does not have the permission.<161>
-
BOOLEAN RpcWinStationQueryInformation( [in] SERVER_HANDLE hServer, [out] DWORD* pResult, [in] DWORD LogonId, [in] DWORD WinStationInformationClass, [in, out, unique, size_is(WinStationInformationLength)] PCHAR pWinStationInformation, [in, range(0, 0x8000)] DWORD WinStationInformationLength, [out] DWORD* pReturnLength );
hServer: Handle to the server object. This is of type SERVER_HANDLE. hServer MUST be obtained from a previous call to RpcWinStationOpenServer.
pResult: Failure error code if the call to RpcWinStationQueryInformation failed. If the call was successful, this parameter MUST be STATUS_SUCCESS (0x00000000).
-
Value
Meaning
STATUS_SUCCESS
0x00000000
Successful completion.
STATUS_INVALID_INFO_CLASS
0xC0000003
The class is not recognized.
STATUS_BUFFER_TOO_SMALL
0xC0000023
WinStationInformationLength is too small.
STATUS_ACCESS_DENIED
0xC0000022
The caller does not have permission for the operation.
LogonId: The session ID of the session for which to retrieve information.
WinStationInformationClass: The class of data to retrieve. These values come from the enum type WINSTATIONINFOCLASS.
-
The following classes are supported.
-
Value
Meaning
WinStationCreateData
0
Retrieves general information on the type of terminal server session (protocol) to which the session belongs.
The pWinStationInformation argument points to a WINSTATIONCREATE structure, and WinStationInformationLength MUST be sizeof(WINSTATIONCREATE).<162>
WinStationConfiguration
1
Retrieves general configuration data on the terminal server session.
The pWinStationInformation argument points to a WINSTACONFIGWIRE structure followed by a USERCONFIG structure. The WinStationInformationLength MUST be sizeof(WINSTACONFIGWIRE) + sizeof(USERCONFIG). The Size field in the USERCONFIG structure inside WINSTACONFIGWIRE MUST be set to sizeof(USERCONFIG) and the Offset set to sizeof(WINSTACONFIGWIRE). The Size field in the NewFields structure inside WINSTACONFIGWIRE MUST be set to 0, and the offset MUST be set to sizeof(WINSTACONFIGWIRE) + sizeof(USERCONFIG).
WinStationPdParams
2
Retrieves transport protocol driver parameters.<163> The structure coming into the function indicates via SDClass the specific protocol driver on which to receive parameter information. The result will be returned in the union in the structure.
The pWinStationInformation argument points to a PDPARAMSWIRE structure followed by a PDPARAMS structure. The WinStationInformationLength MUST be sizeof(PDPARAMSWIRE) + sizeof(PDPARAMS). The Size field in SdClassSpecific field inside PDPARAMSWIRE MUST be set to sizeof(PDPARAMS) and the offset MUST be set to sizeof(PDPARAMSWIRE).
WinStationWd
3
Retrieves WinStation protocol driver configuration data for the session.<164>
The pWinStationInformation argument points to a VARDATA_WIRE structure followed by a WDCONFIG structure. The WinStationInformationLength MUST be sizeof(VARDATA_WIRE) + sizeof(WDCONFIG). The Size field in the VARDATA_WIRE structure MUST be set to sizeof(WDCONFIG) and the Offset set to sizeof(VARDATA_WIRE).
WinStationPd
4
Retrieves transport protocol driver configuration data for the session.<165>
The pWinStationInformation argument points to a VARDATA_WIRE, followed by a PDPARAMSWIRE structure, followed by a PDCONFIG2 structure and finally ending with a PDPARAMS structure. The WinStationInformationLength MUST be sizeof(VARDATA_WIRE) + sizeof(PDPARAMSWIRE) + size of(PDCONFIG2) + sizeof(PDPARAMS). The Size field in the VARDATA_WIRE structure MUST be set to sizeof(PDCONFIG2) and the Offset set to sizeof(VARDATA_WIRE) + sizeof(PDPARAMSWIRE). The Size field in SdClassSpecific field inside PDPARAMSWIRE MUST be set to sizeof(PDPARAMS) - sizeof(SDCLASS), and the offset MUST be set to Offset + Size of the VARDATA_WIRE structure.
WinStationPrinter
5
Not supported.
WinStationClient
6
Retrieves data on the terminal server client of the session.
The pWinStationInformation argument points to a VARDATA_WIRE structure followed by a WINSTATIONCLIENT structure. The WinStationInformationLength MUST be sizeof(VARDATA_WIRE) + sizeof(WINSTATIONCLIENT). The Size field in the VARDATA_WIRE structure MUST be set to sizeof(WINSTATIONCLIENT) and the Offset set to sizeof(VARDATA_WIRE).
WinStationModules
7
Internal get function to retrieve data on protocol-specific binaries loaded for the given terminal server session. The structure pointed to by pWinStationInformation and the size of the buffer is Terminal Service protocol-specific.
WinStationInformation
8
Retrieves information on the session, including connect state, session's name, connect time, disconnect time, time last input was received from the client, logon time, user's username and domain, and the current time.
pWinStationInformation points to a VARDATA_WIRE structure followed by a WINSTATIONINFORMATION structure. The WinStationInformationLength MUST be sizeof(VARDATA_WIRE) + sizeof(WINSTATIONINFORMATION). The Size field in the VARDATA_WIRE structure MUST be set to sizeof(WINSTATIONINFORMATION) and the Offset set to sizeof(VARDATA_WIRE).
WinStationUserToken
14
Retrieves the user's token in the session. Caller requires WINSTATION_ALL_ACCESS permission.
The pWinStationInformation argument points to a WINSTATIONUSERTOKEN structure, and WinStationInformationLength MUST be sizeof(WINSTATIONUSERTOKEN).
WinStationVideoData
16
Retrieves resolution and color depth of the session.
The pWinStationInformation argument points to a WINSTATIONVIDEODATA structure, and WinStationInformationLength MUST be sizeof(WINSTATIONVIDEODATA).
WinStationCd
18
Retrieves connection driver configuration data.
The pWinStationInformation points to a CDCONFIG structure, and WinStationInformationLength MUST be sizeof(CDCONFIG).
WinStationVirtualData
20
Query client virtual data.
The pWinStationInformation argument MUST point to 8 bytes and WinStationInformationLength MUST be 8.
WinStationLoadBalanceSessionTarget
24
Retrieves the target session ID for a client redirected from another server in a load balancing cluster.
The pWinStationInformation points to a ULONG, and WinStationInformationLength MUST be sizeof(ULONG). If there is no redirection, -1 is returned in pWinStationInformation.<166>
WinStationLoadIndicator
25
Retrieves an indicator of the load on the server.
The pWinStationInformation argument points to a WINSTATIONLOADINDICATORDATA structure. WinStationInformationLength MUST be sizeof(WINSTATIONLOADINDICATORDATA).
WinStationShadowInfo
26
Retrieves the current shadow state of a session.
The pWinStationInformation argument points to a WINSTATIONSHADOW structure. WinStationInformationLength MUST be sizeof(WINSTATIONSHADOW).<167>
WinStationDigProductId
27
Retrieves the client product ID and current product ID of the session.
The pWinStationInformation argument points to a WINSTATIONPRODID structure. WinStationInformationLength MUST be sizeof(WINSTATIONPRODID).<168>
WinStationLockedState
28
Retrieves the current locked state of the session, TRUE or FALSE.
The pWinStationInformation argument points to a BOOL variable. WinStationInformationLength MUST be sizeof(BOOL).
WinStationRemoteAddress
29
Retrieves the remote IP address of the terminal server client in the session.
The pWinStationInformation argument points to a WINSTATIONREMOTEADDRESS structure. WinStationInformationLength MUST be sizeof(WINSTATIONREMOTEADDRESS).
WinStationIdleTime
30
Retrieves the idle time for the session, in seconds.
The pWinStationInformation argument points to a ULONG variable.
WinStationInformationLength MUST be sizeof(ULONG).<169>
WinStationLastReconnectType
31
Retrieves the last reconnect type for the session. The value placed in pWinStationInformation will come from the enum RECONNECT_TYPE.
The pWinStationInformation argument points to a ULONG variable.
WinStationInformationLength MUST be sizeof(ULONG).<170>
WinStationDisallowAutoReconnect
32
Retrieves the allow (1) or disallow (0) state for auto-reconnect, 1 or 0.
The pWinStationInformation argument points to a BOOLEAN variable.
WinStationInformationLength MUST be sizeof(BOOLEAN).
WinStationReconnectedFromId
37
In case of reconnected sessions, this will return the session ID of the temporary session from which it was reconnected, or -1 if no temporary session was created.
The WinStationInformationLength argument points to a ULONG variable.
WinStationInformationLength MUST be sizeof(ULONG).
WinStationEffectsPolicy
38
Return policies that differentiate among implementations.
The pWinStationInformation argument points to a ULONG variable.
WinStationInformationLength MUST be sizeof(ULONG).
WinStationType
39
Returns the type associated with this WinStation.
The pWinStationInformation argument points to a ULONG variable.
WinStationInformationLength MUST be sizeof(ULONG).
WinStationInformationEx
40
Retrieves extended information on the session, including connect state, flags, session's name, connect time, disconnect time, time last input was received from the client, logon time, user's username and domain, and the current time.
pWinStationInformation points to a VARDATA_WIRE structure followed by a WINSTATIONINFORMATIONEX structure.
The WinStationInformationLength MUST be sizeof(VARDATA_WIRE) + sizeof(WINSTATIONINFORMATIONEX). The Size field in the VARDATA_WIRE structure MUST be set to sizeof(WINSTATIONINFORMATIONEX) and the Offset set to sizeof(VARDATA_WIRE).
pWinStationInformation: Pointer to buffer allocated by the caller in which to retrieve the data. The data type or structure that pWinStationInformation points to is determined by the value of WinStationInformationClass. See previous sections for what pWinStationInformation SHOULD point to for each class.
WinStationInformationLength: Size of the data pointed to by pWinStationInformation, in bytes.
pReturnLength: Pointer to a variable to receive the size, in bytes, of the data retrieved. If WinStationInformationLength is too small, pReturnLength indicates the correct number of bytes for the caller to allocate.
Return Values: Returns TRUE if the call succeeded, or FALSE if the method failed. On failure, pResult indicates the failure status code.
-
Return value/code
Description
0x01
TRUE
Successful completion.
0x00
FALSE
Method call failed.