DrvSplWritePrinter

BOOL DrvSplWritePrinter(

    HANDLE hDriver,

    LPVOID pBuf,

    DWORD cbBuf,

    LPDWORD pcWritten

   );

DrvSplWritePrinter writes data to a printer.

Parameters

hDriver
Identifies the per-job instance handle with which the printer and print job are associated. The driver generated this handle in response to a call to DrvSplStartDoc.
pBuf
Pointer to an array of printer data.
cbBuf
Specifies the size in bytes of the array to which pBuf points.
pcWritten
Pointer to a DWORD in which the number of bytes processed by the user-mode printer driver is returned.

Return Value

DrvSplWritePrinter returns TRUE if it succeeds; otherwise, an error is logged and the return value is FALSE. The spooler propagates the last-error code back to the kernel-mode printer driver.

Comments

The spooler calls DrvSplWritePrinter when GDI notifies the spooler of a kernel-mode printer driver’s call to EngWritePrinter. The kernel-mode driver can send any format of data understood by its corresponding user-mode printer driver for processing and sending to the printer. This data is not interpreted or altered in any way by GDI or the spooler; they simply pass the data on.

A user-mode printer driver can either render the data as it is received, or can buffer it and render the page in its entirety in DrvSplEndPage.

The buffer to which pBuf points is in user-mode address space.

The user-mode printer driver should take any steps necessary to protect itself in the event that multiple jobs are printed simultaneously.

DrvSplWritePrinter must be implemented if you do write a user-mode printer driver.