RpcEndDocPrinter (Opnum 23)

RpcEndDocPrinter notifies the print server that the application is at the end of the current print job.

 DWORD RpcEndDocPrinter(
   [in] PRINTER_HANDLE hPrinter

hPrinter: A handle to a printer object or port object that was opened by RpcAddPrinter (section, RpcAddPrinterEx (section, RpcOpenPrinter (section, or RpcOpenPrinterEx (section

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:

  • Perform the validation steps that are specified in PRINTER_HANDLE Parameters, section This method SHOULD assume that the handle to the printer or port object can be used without further access checks.

  • Verify that a print job has been associated with hPrinter using RpcStartDocPrinter (section, and if that verification fails, return ERROR_SPL_NO_STARTDOC [MS-ERREF].

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:

  • If any clients have registered for notification of job object changes, a notification MUST be broadcast to them.

  • Modify the state of the job object to indicate the job has completed spooling if hPrinter is a printer object handle; or has completed printing if hPrinter is a port object handle.

  • If the hPrinter parameter is a printer object handle, schedule the job for printing—subject to the configuration of the server and implementation-specific policies—and modify the state of the job object to indicate the job is printing.

  • Return the status of the operation.