3.7.4.1.8 RpcWinStationSendMessage (Opnum 7)

The RpcWinStationSendMessage method displays a message box on a given terminal server session and, optionally, waits for a reply. The caller MUST have WINSTATION_MSG permission for this method to succeed. The method checks whether the caller has WINSTATION_MSG permission (section 3.1.1) by setting it as the Access Request mask, and fails if the caller does not have the permission.<175>

 BOOLEAN RpcWinStationSendMessage(
   [in] SERVER_HANDLE hServer,
   [out] DWORD* pResult,
   [in] DWORD LogonId,
   [in, size_is(TitleLength)] PWCHAR pTitle,
   [in, range(0, 1024 )] DWORD TitleLength,
   [in, size_is(MessageLength)] PWCHAR pMessage,
   [in, range(0, 1024 )] DWORD MessageLength,
   [in] DWORD Style,
   [in] DWORD Timeout,
   [out] DWORD* pResponse,
   [in] BOOLEAN DoNotWait
 );

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

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

Value

Meaning

STATUS_SUCCESS

0x00000000

The call succeeded.

STATUS_ACCESS_DENIED

0xC0000022

The caller does not have WINSTATION_MSG permission.

LogonId:  The session ID of the session on which to display the message box.

pTitle:  Pointer to the title for the message box to display.

TitleLength:  The length, in bytes, of the title to display.

pMessage:  Pointer to the message to display.

MessageLength:  The length, in bytes, of the message to display in the specified session.

Style:  Can be any value that the standard MessageBox() method's Style parameter takes. For more information, see [MSDN-MSGBOX].

Timeout:  The response time-out, in seconds. If the message box is not responded to in Timeout seconds, a response code of IDTIMEOUT MUST be returned in pResponse to indicate that the message box timed out. This time-out value is managed by another system component which dismisses the message box if no user input is entered during this interval.

pResponse:  The return code from the MessageBox method. This value will be a standard MessageBox return value. For more information, see [MSDN-MSGBOX].

DoNotWait:  If set to TRUE, do not wait for the response to the message. On return, if no errors occur in queuing the message, the pResponse parameter will be set to IDASYNC.

If FALSE, wait for a response.

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.