Jump to content

PrtOpen: Difference between revisions

From EDM2
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..."
 
Ak120 (talk | contribs)
mNo edit summary
 
Line 1: Line 1:
PrtOpen opens a device (port), file, named pipe, or UNC name, and returns its spooler handle in the location addressed by phDevice.  
PrtOpen opens a device (port), file, named pipe, or UNC name, and returns its spooler handle in the location addressed by phDevice.


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


==Parameters==
==Parameters==
; pszDeviceName (PSZ) - input  
;pszDeviceName (PSZ) - input: A pointer to a string identifying the device.
: 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.
; phDevice (PHFILE) - input  
;cbFile (ULONG) - input: The initial size in bytes, of the output file.  
: A pointer to a location for the returned spooler file handle for the device.  
;ulFat (ULONG) - input: The file attribute.
 
;fnOpen (ULONG) - input: The Open function type.
; psAction (PUSHORT) - input  
;flMode (ULONG) - input: The Open mode of the file.
: A pointer to location for the returned value that identifies the action taken by the system.  
;lRes (ULONG) - input: Reserved. Must be zero.
 
; 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==
==Return Code==
; rc (ULONG) - returns  
;rc (ULONG) - returns: Return codes.
: Return codes.  
This function returns the same codes as DosOpen:
 
* ERROR_ACCESS_DENIED
This function returns the same codes as DosOpen:  
* ERROR_CANNOT_MAKE
 
* ERROR_DEVICE_IN_USE
* ERROR_ACCESS_DENIED  
* ERROR_DISK_FULL
* ERROR_CANNOT_MAKE  
* ERROR_DRIVE_LOCKED
* ERROR_DEVICE_IN_USE  
* ERROR_FILE_NOT_FOUND
* ERROR_DISK_FULL  
* ERROR_FILENAME_EXCED_RANGE
* ERROR_DRIVE_LOCKED  
* ERROR_INVALID_ACCESS
* ERROR_FILE_NOT_FOUND  
* ERROR_INVALID_PARAMETER
* ERROR_FILENAME_EXCED_RANGE  
* ERROR_NOT_DOS_DISK
* ERROR_INVALID_ACCESS  
* ERROR_OPEN_FAILED
* ERROR_INVALID_PARAMETER  
* ERROR_PATH_NOT_FOUND
* ERROR_NOT_DOS_DISK  
* ERROR_PIPE_BUSY
* ERROR_OPEN_FAILED  
* ERROR_SHARING_BUFFER_EXCEEDED
* ERROR_PATH_NOT_FOUND  
* ERROR_SHARING_VIOLATION
* ERROR_PIPE_BUSY  
* ERROR_TOO_MANY_OPEN_FILES
* ERROR_SHARING_BUFFER_EXCEEDED  
* NO_ERROR
* ERROR_SHARING_VIOLATION  
* ERROR_TOO_MANY_OPEN_FILES  
* NO_ERROR  


==Remarks==
==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.  
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==
<PRE>
#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);
</PRE>


[[Category:Prt]]
[[Category:Prt]]

Latest revision as of 16:03, 30 May 2021

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

Syntax

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.