Description:
SplProtWrite is an optional API and is exported by protocol converters. It is called by PrtWrite to put a BIDI protocol wrapper around print data and then send the data to the printer.
SplProtWrite is responsible for breaking write packets into sub-packets to accommodate packet size restrictions from the printer.
If the BIDI software protocol being used requires print job data to have a wrapper around it (see BIDI_Q_SW(800Ch) in BIDI Command Structures and Command Flow), the spooler calls SplProtWrite, the protocol converter's API. SplProtWrite then calls the port driver's SplPdWrite routine with an updated buffer.
#define INCL_SPL
#define INCL_SPLBIDI
#include <os2.h>
HFILE hDevice; /* Handle from SplPdOpen to pass to SplPdWrite. */
PSZ pszDeviceName; /* Device name. */
PFN pfnPdWrite; /* Address of port driver function SplPdWrite. */
PFN pfnBaseProtWrite; /* Base protocol converter address for ProtWrite routine. */
PVOID pchData; /* Pointer to the data buffer to write. */
ULONG cbInData; /* Length of information in pchData, in bytes. */
PULONG pcbWritten; /* Pointer to count of bytes actually written to the device. */
ULONG rc; /* Return codes. */
rc = SplProtWrite(hDevice, pszDeviceName,
pfnPdWrite, pfnBaseProtWrite, pchData,
cbInData, pcbWritten);