IPrintOemUni2::WritePrinter method

The IPrintOemUni2::WritePrinter method, if supported, enables a rendering plug-in to capture all output data generated by a Unidrv driver. If this method is not supported, the output data would otherwise be sent to the spooler in a call to the spooler's WritePrinter API (described in the Microsoft Windows SDK documentation).


HRESULT WritePrinter(
  PDEVOBJ pdevobj,
  PVOID   pBuf,
  DWORD   cbBuffer,
  PDWORD  pcbWritten



Pointer to a DEVOBJ structure.


Pointer to the first byte of an array of bytes that contains the output data generated by the Unidrv driver.


Specifies the size, in bytes, of the array pointed to by pBuf.


Pointer to a DWORD value that receives the number of bytes of data that were successfully sent to the plug-in.

Return Value

If successful, this method returns S_OK. Otherwise, this method should return an appropriate value in the returned HRESULT.


At DrvEnablePDEV time, the Unidrv driver calls this method with pBuf and pdevobj set to NULL, and cbBuf set to 0, to detect whether the plug-in implements this function. The plug-in should return S_OK to indicate it implements this method, and should return E_NOTIMPL otherwise.

This method should report the number of bytes written to the spooler's WritePrinter function in pcbWritten. A value of zero carries no special meaning; errors must be reported through the returned HRESULT.

The IPrintOemUni2::WritePrinter method is optional. If a rendering plug-in implements this method, the plug-in's IPrintOemUni::GetImplementedMethod method must return S_OK when it receives "WritePrinter" as input.


Target Platform Desktop
Header prcomoem.h (include Prcomoem.h)