SplCreatePort

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.