Jump to content

PrtOpen

From EDM2
Revision as of 20:05, 19 November 2019 by Martini (talk | contribs) (Created page with "PrtOpen opens a device (port), file, named pipe, or UNC name, and returns its spooler handle in the location addressed by phDevice. ==Syntax== rc = PrtOpen(pszDeviceName, p...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

PrtOpen opens a device (port), file, named pipe, or UNC name, and returns its spooler handle in the location addressed by phDevice.

Syntax

rc = PrtOpen(pszDeviceName, phDevice, psAction, cbFile, ulFat, fnOpen, flMode, lRes);

Parameters

pszDeviceName (PSZ) - input
A pointer to a string identifying the device.
phDevice (PHFILE) - input
A pointer to a location for the returned spooler file handle for the device.
psAction (PUSHORT) - input
A pointer to location for the returned value that identifies the action taken by the system.
cbFile (ULONG) - input
The initial size in bytes, of the output file.
ulFat (ULONG) - input
The file attribute.
fnOpen (ULONG) - input
The Open function type.
flMode (ULONG) - input
The Open mode of the file.
lRes (ULONG) - input
Reserved. Must be zero.

Return Code

rc (ULONG) - returns
Return codes.

This function returns the same codes as DosOpen:

  • ERROR_ACCESS_DENIED
  • ERROR_CANNOT_MAKE
  • ERROR_DEVICE_IN_USE
  • ERROR_DISK_FULL
  • ERROR_DRIVE_LOCKED
  • ERROR_FILE_NOT_FOUND
  • ERROR_FILENAME_EXCED_RANGE
  • ERROR_INVALID_ACCESS
  • ERROR_INVALID_PARAMETER
  • ERROR_NOT_DOS_DISK
  • ERROR_OPEN_FAILED
  • ERROR_PATH_NOT_FOUND
  • ERROR_PIPE_BUSY
  • ERROR_SHARING_BUFFER_EXCEEDED
  • ERROR_SHARING_VIOLATION
  • ERROR_TOO_MANY_OPEN_FILES
  • NO_ERROR

Remarks

If an attempt is made to open a device file that has already been opened by the spooler, this call will block on a semaphore. This call also calls the port driver to initialize the port. PrtOpen is an emulation of DosOpen. For a full description of the parameters, refer to the function "DosOpen" in the Presentation Manager Programming Reference.

Example Code

#include <os2.h>

PSZ        pszDeviceName;
PHFILE     phDevice;
PUSHORT    psAction;
ULONG      cbFile;
ULONG      ulFat;          /*  The file attribute. */
ULONG      fnOpen;         /*  The Open function type. */
ULONG      flMode;         /*  The Open mode of the file. */
ULONG      lRes;           /*  Reserved.  Must be zero. */
ULONG      rc;             /*  Return codes. */

rc = PrtOpen(pszDeviceName, phDevice, psAction,
       cbFile, ulFat, fnOpen, flMode, lRes);