Jump to content

SplPdWrite: Difference between revisions

From EDM2
Ak120 (talk | contribs)
mNo edit summary
Ak120 (talk | contribs)
 
Line 5: Line 5:


== Parameters ==
== Parameters ==
;hDevice (HFILE) - input: Handle from SplPdOpen.
;hDevice (HFILE) - input: Handle from [[SplPdOpen]].
;pchData (PVOID) - input: Pointer to data buffer to write.
;pchData (PVOID) - input: Pointer to data buffer to write.
;cbData (ULONG) - input: Length of data, in bytes.
;cbData (ULONG) - input: Length of data, in bytes.

Latest revision as of 19:02, 4 June 2020

SplPdWrite is an API exported by port drivers. It is called by PrtWrite to send print job data to the device. 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), then the spooler will call the protocol converter's API, SplProtWrite. SplProtWrite will then call the port driver's SplPdWrite routine.

Syntax

SplPdWrite(hDevice, pchData, cbData, pcbWritten);

Parameters

hDevice (HFILE) - input
Handle from SplPdOpen.
pchData (PVOID) - input
Pointer to data buffer to write.
cbData (ULONG) - input
Length of data, in bytes.
pcbWritten (ULONG) - input
Pointer to count of bytes actually written to the device.
This value can be updated even when an unsuccessful return code is given, if some of the data was sent to the printer.

Returns

rc (ULONG) - returns
Return codes.
  • 0 Success
Note
: *pcbWritten is updated with the number of bytes sent to the printer. If all bytes were not written, it should be considered an error.
  • 6 (ERROR_INVALID_HANDLE) Invalid handle given.
  • 28 (ERROR_OUT_OF_PAPER) The printer is out of paper.
  • 29 (ERROR_WRITE_FAULT) Failure attempting to write to the device. Specific error alerts should be sent to the spooler to better define the problem.
  • 87 (ERROR_INVALID_PARAMETER) Invalid buffer given.

Sample

#define INCL_SPL
#define INCL_SPLBIDI
#include <os2.h>

HFILE    hDevice;     /* Handle from SplPdOpen. */
PVOID    pchData;     /* Pointer to data buffer to write. */
ULONG    cbData;      /* Length of data, in bytes. */
ULONG    pcbWritten;  /* Pointer to count of bytes actually written to the device. */
ULONG    rc;          /* Return codes. */

rc = SplPdWrite(hDevice, pchData, cbData, pcbWritten);