Jump to content

SplCreatePort: Difference between revisions

From EDM2
Created page with " This function is called to create a printer port. The printer port can be a virtual port. ; Note: There is currently no support for using this API to remotely add a printer..."
 
Ak120 (talk | contribs)
mNo edit summary
 
Line 1: Line 1:
This function is called to create a printer port. The printer port can be a virtual port.


This function is called to create a printer port. The printer port can be a virtual port.  
;Note: There is currently no support for using this API to remotely add a printer port.


; Note: There is currently no support for using this API to remotely add a printer port.
== Syntax ==  
== Syntax ==  
  SplCreatePort(pszComputerName, pszPortName,
  SplCreatePort(pszComputerName, pszPortName, pszPortDriver, ulVersion, pBuf, cbBuf)
      pszPortDriver, ulVersion, pBuf, cbBuf);


== Parameters ==
== Parameters ==
; pszComputerName (PSZ) - input  
;pszComputerName (PSZ) - input:Name of computer where port is to be installed.
:Name of computer where port is to be installed.  
:A NULL string is used for installing a port on the local machine. This parameter currently must be NULL.
;pszPortName (PSZ) - input: Name of printer port to install.
:This port, virtual or regular, must not already exist. Following is an example of a port name:<br/><tt>LPT5</tt>
;pszPortDriver (PSZ) - input: Name of the port driver assigned to this port.
:If not NULL, this field must specify an installed port driver; it is case-sensitive. Following is an example of a port driver:<br/><tt>PARALLEL</tt>
;ulVersion (ULONG) - input: Version of port to create.
:Values are as follows:
::SPLPORT_VERSION_REGULAR - 0 - Creates normal printer port that can be connected to a print queue. This port will remain after a reboot.
::SPLPORT_VERSION_VIRTUAL - 1 - Creates a virtual printer port that can only be used for querying and setting. This port exists only until the spooler is disabled or the machine is rebooted.
;pBuf (PVOID) - input:Port-driver-specific buffer.
:If SPLPORT_VERSION_VIRTUAL is set, this is a port-driver-specific buffer that contains information necessary for the port driver to set up a virtual connection to the printer. There cannot be any imbedded pointers in this buffer. This buffer wil be passed to the port driver with the BIDI_ADD_VIRTUAL_PORT command.
;cbBuf (ULONG) - input:Length of the data in pBuf, in bytes.


:A NULL string is used for installing a port on the local machine. This parameter currently must be NULL.
;rc (ULONG) - returns: Return codes.
 
::0 Success
; pszPortName (PSZ) - input
::2 ERROR_FILE_NOT_FOUND - Port driver name is not valid.
: Name of printer port to install.  
::8 ERROR_NOT_ENOUGH_MEMORY - Not enough memory to satisfy request.
 
::50 ERROR_NOT_SUPPORTED - ''pszComputerName'' is not supported, or the port driver does not support the virtual port.
: This port, virtual or regular, must not already exist. Following is an example of a port name:  
::87 ERROR_INVALID_PARAMETER - An invalid buffer was given.
  LPT5
::99 ERROR_DEVICE_IN_USE - Port name is already defined.
 
::124 ERROR_INVALID_LEVEL - ulVersion is not 0 or 1.
 
::0x4009 PMERR_SPL_SPOOLER_NOT_INSTALLED - Spooler not enabled; virtual ports require spooler to be enabled.
; pszPortDriver (PSZ) - input
: Name of the port driver assigned to this port.
 
: If not NULL, this field must specify an installed port driver; it is case-sensitive. Following is an example of a port driver:
  PARALLEL
 
 
; ulVersion (ULONG) - input
: Version of port to create.
 
: Values are as follows:  
 
:;SPLPORT_VERSION_REGULAR - 0
::Creates normal printer port that can be connected to a print queue. This port will remain after a reboot.  
 
:;SPLPORT_VERSION_VIRTUAL - 1
::Creates a virtual printer port that can only be used for querying and setting. This port exists only until the spooler is disabled or the machine is rebooted.
 
;pBuf (PVOID) - input
:Port-driver-specific buffer.
 
:If SPLPORT_VERSION_VIRTUAL is set, this is a port-driver-specific buffer that contains information necessary for the port driver to set up a virtual connection to the printer. There cannot be any imbedded pointers in this buffer. This buffer wil be passed to the port driver with the BIDI_ADD_VIRTUAL_PORT command.  
 
;cbBuf (ULONG) - input
:Length of the data in pBuf, in bytes.  
 
== Returns ==
; rc (ULONG) - returns : Return codes.
 
* 0 Success
 
:;ERROR_DEVICE_IN_USE(99)
::Port name is already defined.  
 
:;ERROR_FILE_NOT_FOUND(2)
::Port driver name is not valid.
 
:;ERROR_INVALID_LEVEL(124)
::ulVersion is not 0 or 1.  
 
:;ERROR_INVALID_PARAMETER(87)
::An invalid buffer was given.
 
:;ERROR_NOT_ENOUGH_MEMORY(8)
::Not enough memory to satisfy request.
 
:;ERROR_NOT_SUPPORTED(50)
::pszComputerName is not supported, or the port driver does not support the virtual port.
 
:;PMERR_SPL_SPOOLER_NOT_INSTALLED(0x4009)
::Spooler not enabled; virtual ports require spooler to be enabled.  
 
 
== Sample ==
<pre>
#define INCL_SPL
#define INCL_SPLBIDI
#include <os2.h>
 
PSZ      pszComputerName;  /*  Name of computer where port is to be installed. */
PSZ      pszPortName;      /*  Name of printer port to install. */
PSZ      pszPortDriver;    /*  Name of the port driver assigned to this port. */
ULONG    ulVersion;        /*  Version of port to create. */
PVOID    pBuf;            /*  Port-driver-specific buffer. */
ULONG    cbBuf;            /*  Length of the data in pBuf, in bytes. */
ULONG    rc;              /*  Return codes. */
 
rc = SplCreatePort(pszComputerName, pszPortName,
      pszPortDriver, ulVersion, pBuf, cbBuf);
</pre>


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

Latest revision as of 14:17, 13 December 2019

This function is called to create a printer port. The printer port can be a virtual port.

Note
There is currently no support for using this API to remotely add a printer port.

Syntax

SplCreatePort(pszComputerName, pszPortName, pszPortDriver, ulVersion, pBuf, cbBuf)

Parameters

pszComputerName (PSZ) - input
Name of computer where port is to be installed.
A NULL string is used for installing a port on the local machine. This parameter currently must be NULL.
pszPortName (PSZ) - input
Name of printer port to install.
This port, virtual or regular, must not already exist. Following is an example of a port name:
LPT5
pszPortDriver (PSZ) - input
Name of the port driver assigned to this port.
If not NULL, this field must specify an installed port driver; it is case-sensitive. Following is an example of a port driver:
PARALLEL
ulVersion (ULONG) - input
Version of port to create.
Values are as follows:
SPLPORT_VERSION_REGULAR - 0 - Creates normal printer port that can be connected to a print queue. This port will remain after a reboot.
SPLPORT_VERSION_VIRTUAL - 1 - Creates a virtual printer port that can only be used for querying and setting. This port exists only until the spooler is disabled or the machine is rebooted.
pBuf (PVOID) - input
Port-driver-specific buffer.
If SPLPORT_VERSION_VIRTUAL is set, this is a port-driver-specific buffer that contains information necessary for the port driver to set up a virtual connection to the printer. There cannot be any imbedded pointers in this buffer. This buffer wil be passed to the port driver with the BIDI_ADD_VIRTUAL_PORT command.
cbBuf (ULONG) - input
Length of the data in pBuf, in bytes.
rc (ULONG) - returns
Return codes.
0 Success
2 ERROR_FILE_NOT_FOUND - Port driver name is not valid.
8 ERROR_NOT_ENOUGH_MEMORY - Not enough memory to satisfy request.
50 ERROR_NOT_SUPPORTED - pszComputerName is not supported, or the port driver does not support the virtual port.
87 ERROR_INVALID_PARAMETER - An invalid buffer was given.
99 ERROR_DEVICE_IN_USE - Port name is already defined.
124 ERROR_INVALID_LEVEL - ulVersion is not 0 or 1.
0x4009 PMERR_SPL_SPOOLER_NOT_INSTALLED - Spooler not enabled; virtual ports require spooler to be enabled.