Jump to content

SplPdInitPort

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

SplPdInitPort initializes a port on behalf of the spooler.

Syntax

SplPdInitPort(hfile, pszPortName)

Parameters

hfile (HFILE) - input
The handle to an open file.
pszPortName (PSZ) - input
The name of the port to be initialized.

Returns

rc (APIERR) - returns
Return codes.

This handling routine returns the following errors:

  • ERROR_INVALID_PARAMETER
  • NO_ERROR

Sample

#include <os2.h>

HFILE     hfile;        /*  The handle to an open file. */
PSZ       pszPortName;  /*  The name of the port to be initialized. */
APIERR    rc;           /*  Return codes. */

rc = SplPdInitPort(hfile, pszPortName);

Remarks

The port driver reads the initialization data from the INI file, interprets the data, and issues the appropriate DosDevIOCtl calls to the open port given by the file handle.

This function is called from the spooler function, PrtOpen, to complete port opening. Note that PrtOpen issues the actual DosOpen first. PrtOpen holds a semaphore for each port in use, and a linked list of threads waiting on the semaphore because, although the spooler serializes output, it is still possible for applications to write directly to the port by using DevOpenDC (OD_DIRECT).