RpcReadPrinter retrieves data from the specified job or port.

 DWORD RpcReadPrinter(
   [in] PRINTER_HANDLE hPrinter,
   [out, size_is(cbBuf)] BYTE* pBuf,
   [in] DWORD cbBuf,
   [out] DWORD* pcNoBytesRead
 );

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

pBuf: A pointer to a buffer that receives the printer data. If the hPrinter parameter is the handle to a port object, this method returns the data that is returned by the port monitor.

This parameter can be NULL if the value of the cbBuf parameter is zero.

cbBuf: The size, in bytes, of data to be read into the buffer that is pointed to by the pBuf parameter.

pcNoBytesRead: A pointer to a variable that receives the number of bytes of data copied into the array to which pBuf points.

Return Values: This method MUST return zero (ERROR_SUCCESS) to indicate successful completion or a nonzero Windows error code to indicate failure [MS-ERREF].

Upon receiving this message, the server MUST 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: