RpcFlushPrinter is used by printer drivers to send a buffer of bytes to a specified port to cleanly abort a print job.<378> It also allows delaying the I/O line to the printer.

 DWORD RpcFlushPrinter(
   [in] PRINTER_HANDLE hPrinter,
   [in, size_is(cbBuf)] BYTE* pBuf,
   [in] DWORD cbBuf,
   [out] DWORD* pcWritten,
   [in] DWORD cSleep
 );

hPrinter: A handle to a 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 the array of bytes containing the data to be written to the printer. This parameter can be NULL if the value of the cbBuf parameter is zero.

cbBuf: The size, in bytes, of the array pointed to by the pBuf parameter.

pcWritten: A pointer to a variable that receives the number of bytes of data that were written to the printer.

cSleep: The time, in milliseconds, to delay the I/O line to the printer port. A value of zero indicates no delay.

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: