3.7.4.1.10 RpcWinStationNameFromLogonId (Opnum 9)

The RpcWinStationNameFromLogonId method retrieves the Windows Station (WinStation) name for a specific session. The caller MUST have WINSTATION_QUERY permission. The method checks whether the caller has WINSTATION_QUERY permission (section 3.1.1) by setting it as the Access Request mask, and fails if the caller does not have the permission.<177>

 BOOLEAN RpcWinStationNameFromLogonId(
   [in] SERVER_HANDLE hServer,
   [out] DWORD* pResult,
   [in] DWORD LoginId,
   [in, out, size_is(NameSize)] PWCHAR pWinStationName,
   [in, range(0, 256 )] DWORD NameSize
 );

hServer: Handle to the server object. This is of type SERVER_HANDLE. The hServer MUST be obtained from a previous call to RpcWinStationOpenServer.

pResult:  Failure error code if the call to RpcWinStationNameFromLogonId failed. If the call was successful, this parameter MUST be STATUS_SUCCESS (0x00000000).

Value

Meaning

STATUS_SUCCESS

0x00000000

The call succeeded.

STATUS_INVALID_PARAMETER

0xC000000D

NameSize value is less than WINSTATIONNAME_LENGTH + 1.

0x80071B6E

The session does not exist or the caller does not have WINSTATION_QUERY permission.

LoginId:  The ID of the session for which to retrieve the WinStation name.

pWinStationName:  Pointer to a buffer holding the session name. The length of the buffer MUST be equal to or greater than (WINSTATIONNAME_LENGTH + 1).

NameSize: The size, in bytes, of the buffer where the WinStation name will be stored.

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.