RpcXcvData provides an extensible mechanism by which a client can control ports on the server and exchange port specific commands and data with the server.<363>

 DWORD RpcXcvData(
   [in] PRINTER_HANDLE hXcv,
   [in, string] const wchar_t* pszDataName,
   [in, size_is(cbInputData)] BYTE* pInputData,
   [in] DWORD cbInputData,
   [out, size_is(cbOutputData)] BYTE* pOutputData,
   [in] DWORD cbOutputData,
   [out] DWORD* pcbOutputNeeded,
   [in, out] DWORD* pdwStatus
 );

hXcv: A handle to a port or port monitor object that was opened by RpcOpenPrinter (section 3.1.4.2.2) or RpcOpenPrinterEx (section 3.1.4.2.14).

pszDataName: A pointer to a string representing the name of the requested data or action. The following table shows the actions that SHOULD be supported. Other port monitor–specific action strings MAY be supported.<364>

Value

Description

"AddPort"

Add an instance of a specific port type controlled by the port monitor.

"DeletePort"

Delete an instance of a specific port type controlled by the port monitor.

"MonitorUI"

The action returns the name of the associated port monitor client-side executable configuration module in the buffer that is referenced by the pOutputData parameter.

pInputData: A pointer to a buffer that contains input data. This parameter can be NULL if cbInputData equals zero.

cbInputData: The size, in bytes, of the buffer pointed to by the pInputData parameter.

pOutputData: A pointer to a buffer to receive output data. This parameter can be NULL if cbOutputData equals zero.

cbOutputData: The size, in bytes, of the buffer pointed to by the pOutputData parameter.

pcbOutputNeeded: A pointer to a location that receives the size, in bytes, required for the buffer pointed to by the pOutputData parameter.

pdwStatus: A pointer to a variable that receives the status value that is returned by the port monitor's XcvData method. The value MUST be zero to indicate successful completion or a nonzero Windows error code to indicate failure [MS-ERREF].

Return Values: This method MUST return zero (ERROR_SUCCESS) to indicate that the print server successfully called the port monitor's XcvData method, or a nonzero Windows error code to indicate failure [MS-ERREF].

Upon receiving this message, the server MUST validate parameters as follows:

The print server SHOULD<365> further validate parameters as follows:

If parameter validation fails, the server MUST fail the operation immediately and return a nonzero error response to the client. Otherwise, the server MUST process the message and compose a response to the client as follows:

The port monitor's XcvData method processes the message by performing the operation indicated by the string pointed to by the pszDataName parameter, and then composes a response as follows: