SplQueryPort

This function queries information about a printer port.

Syntax
SplQueryPort(pszComputerName, pszPortName,      ulLevel, pBuf, cbBuf, pcbNeeded);

Parameters

 * pszComputerName (PSZ) - input
 * Name of the computer connected to the port.


 * This value can be NULL for a local machine.


 * pszPortName (PSZ) - input
 * Name of the port to query.


 * ulLevel (ULONG) - input
 * Level of information to return.


 * This must be 2.


 * pBuf (PVOID) - output
 * Receives the PRPORTINFO2 data structure.


 * See PRPORTINFO2 in Data Types page=no. for details on this data structure.


 * cbBuf (ULONG) - input
 * Length of buffer pointed to by pBuf, in bytes.


 * pcbNeeded (PULONG) - output
 * Receives length, in bytes, of buffer needed to return all the port data.

Returns

 * rc (ULONG) - returns : Return codes.


 * 0 Success


 * ERROR_INVALID_LEVEL(124)
 * ulLevel is not 2.


 * ERROR_INVALID_PARAMETER(87)
 * An invalid parameter was specified; most likely an invalid pBuf value.


 * ERROR_MORE_DATA(234)
 * Not all data could fit in pBuf.


 * ERROR_NOT_SUPPORTED(50)
 * Command not supported on pszComputerName.


 * NERR_BufTooSmall(2123)
 * No data could fit in pBuf.


 * NERR_DestNotFound(2152)
 * The port name does not exist.

Sample

 * 1) define INCL_SPL
 * 2) define INCL_SPLBIDI
 * 3) include 

PSZ      pszComputerName;  /*  Name of the computer connected to the port. */ PSZ      pszPortName;      /*  Name of the port to query. */ ULONG    ulLevel;          /*  Level of information to return. */ PVOID    pBuf;             /*  Receives the PRPORTINFO2 data structure. */ ULONG    cbBuf;            /*  Length of buffer pointed to by pBuf, in bytes. */ PULONG   pcbNeeded;        /*  Receives length, in bytes, of buffer needed to return all the port data. */ ULONG    rc;               /*  Return codes. */

rc = SplQueryPort(pszComputerName, pszPortName,      ulLevel, pBuf, cbBuf, pcbNeeded);