Jump to content

SplQueryPath

From EDM2
Revision as of 12:33, 2 July 2023 by Ak120 (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This function returns the path to get printer drivers or port drivers.

When a new printer is being installed that requires a printer driver not yet installed, the print object calls this function to get the path to the print drivers.

Syntax

SplQueryPath(pszComputerName, pszRemoteQueueName, ulLevel, pBuf, cbBuf, pcbNeeded)

Parameters

pszComputerName (PSZ) - input
Name of the computer for which a network print object is being created.
This value can be NULL.
pszRemoteQueueName (PSZ) - input
Name of the remote queue the network print object is referencing.
This value can be NULL.
ulLevel (ULONG) - input
Level of information to return.
This must be 0 (zero).
pBuf (PVOID) - output
Receives the path to printer drivers for level 0.
cbBuf (ULONG) - input
Length of buffer pointed to by pBuf, in bytes.
pcbNeeded (PULONG) - output
Receives length, in bytes, of buffer needed to return path.

Returns

rc (ULONG) - returns
Return codes.
  • 0 Success
  • ERROR_NOT_SUPPORTED(50): A path to printer drivers cannot be found.
  • NERR_BufTooSmall(2123): Must call again with a bigger buffer.

Sample

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

PSZ       pszComputerName;     /*  Name of the computer for which a network print object is being created. */
PSZ       pszRemoteQueueName;  /*  Name of the remote queue the network print object is referencing. */
ULONG     ulLevel;             /*  Level of information to return. */
PVOID     pBuf;                /*  Receives the path to printer drivers for level 0. */
ULONG     cbBuf;               /*  Length of buffer pointed to by pBuf, in bytes. */
PULONG    pcbNeeded;           /*  Receives length, in bytes, of buffer needed to return path. */
ULONG     rc;                  /*  Return codes. */

rc = SplQueryPath(pszComputerName, pszRemoteQueueName,
       ulLevel, pBuf, cbBuf, pcbNeeded);

Remarks

The spooler will look in the following places for the path to printer drivers:

  1. The spooler will first look in the system .INI file for applicationName PM_SPOOLER_DRVSHARE. If found, the spooler will return the keyValue for keyName pszComputerName if it exists, or for the first keyName that exists under the applicationName.
  2. The spooler will check the pszComputerName field for a share called PRINTDRV.
  3. The spooler will check the user's logon domain LS:\\*ALIAS for a share called PRINTDRV.

If a path is found, the spooler will return the path to the caller. The path can be one of the following:

  • An extended UNC path (LS:\\SERVER1\PRINTDRV)
  • A UNC path with additional subdirectories defined: (LS:\\SERVER1\PRINTDRV\DIR1\NEXT)
  • A fully qualified pathname (Z:\OS2\SHARED)

The print object will use the path as follows:

  • Look in the root of the path for packed files (.DR_)
  • Look in the root of the path for unpacked files (.DRV)
  • Look in the subdirectory PMDD_n from path, where n is the OS2 printer driver diskette number.