Jump to content

SplPdWrite: Difference between revisions

From EDM2
Created page with "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 ..."
 
Ak120 (talk | contribs)
mNo edit summary
Line 1: Line 1:
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.  
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 ==  
== Syntax ==  
Line 5: Line 5:


== Parameters ==
== Parameters ==
; hDevice (HFILE) - input  
;hDevice (HFILE) - input: Handle from SplPdOpen.
: Handle from SplPdOpen.  
;pchData (PVOID) - input: Pointer to data buffer to write.
 
;cbData (ULONG) - input: Length of data, in bytes.
; pchData (PVOID) - input  
;pcbWritten (ULONG) - input: Pointer to count of bytes actually written to the device.
: Pointer to data buffer to write.  
: This value can be updated even when an unsuccessful return code is given, if some of the data was sent to the printer.
 
; 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 ==
== Returns ==
; rc (ULONG) - returns : Return codes.  
;rc (ULONG) - returns : Return codes.
 
* 0 Success
* 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.
:;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.
* 6(ERROR_INVALID_HANDLE)  
*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.
:Invalid handle given.  
*87 (ERROR_INVALID_PARAMETER) Invalid buffer 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 ==
== Sample ==
Line 40: Line 26:
#include <os2.h>
#include <os2.h>


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


rc = SplPdWrite(hDevice, pchData, cbData,
rc = SplPdWrite(hDevice, pchData, cbData, pcbWritten);
      pcbWritten);
</pre>
</pre>


[[Category:Spl]]
[[Category:Spl]]

Revision as of 19:21, 4 May 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);