Jump to content

DosQHandType: Difference between revisions

From EDM2
No edit summary
Ak120 (talk | contribs)
mNo edit summary
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[image:legacy.png]]
This is the legacy function. It is recommended to use:  "[[OS2_API:CPI:DosQueryHType|DosQueryHType]]". [https://books.google.com.ec/books?id=u7WbsmbttwYC&pg=PT372&lpg=PT372&dq#v=onepage&q&f=false]
==Description==
This call determines whether a handle references a file or a device.
This call determines whether a handle references a file or a device.


==Syntax==
==Syntax==
<PRE>
  DosQHandType (FileHandle, HandType, FlagWord)
  DosQHandType
 
    (FileHandle, HandType, FlagWord)
</PRE>


==Parameters==
==Parameters==
; FileHandle (HFILE) - input : File handle.  
;FileHandle (HFILE) - input : File handle.
 
;HandType (PUSHORT) - output : Address of the value indicating the handle type. HandType is composed of two bytes:
; HandType (PUSHORT) - output : Address of the value indicating the handle type. HandType is composed of two bytes:
:15 - Network bit:
 
::0 = The handle refers to a local file, device, or pipe.
Bit        Description
::1 = Means that the handle refers to a remote file, device, or pipe.
15       Network bit:
:14-8 - Reserved.
        0 = The handle refers to a local file, device, or pipe.
:7-0 - HandleClass describes the handle class. It may take on the following values in the low byte of HandleType:
        1 = Means that the handle refers to a remote file, device, or pipe.  
::0 - Handle is for a disk file
14-8       Reserved.
::1 - Handle is for a character device
7-0       HandleClass describes the handle class. It may take on the following values in the low byte of HandleType:
::2 - Handle is for a pipe.
'''Value        Definition'''
::Values greater than 2 are reserved.  
0       Handle is for a disk file
;FlagWord (PUSHORT) - output : Address of the device driver's attribute word if HandleType indicates a local character device.
1       Handle is for a character device  
2       Handle is for a pipe.
 
  Values greater than 2 are reserved.  
   
; FlagWord (PUSHORT) - output : Address of the device driver's attribute word if HandleType indicates a local character device.


==Return Code==
==Return Code==
rc (USHORT) - return
;rc (USHORT) - return:Return code descriptions are:
 
* 0 NO_ERROR
Return code descriptions are:
* 6 ERROR_INVALID_HANDLE
 
* 0       NO_ERROR
* 6       ERROR_INVALID_HANDLE  


==Remarks==
==Remarks==
This function allows programs that are interactive or file-oriented to determine the source of their input. For example, CMD.EXE suppresses writing prompts if the input is from a disk file.  
This function allows programs that are interactive or file-oriented to determine the source of their input. For example, CMD.EXE suppresses writing prompts if the input is from a disk file.


==Example Code==
==Bindings==
=== C Binding===
===C===
<PRE>
<PRE>
#define INCL_DOSFILEMGR
#define INCL_DOSFILEMGR
Line 52: Line 33:
USHORT  rc = DosQHandType(FileHandle, HandType, FlagWord);
USHORT  rc = DosQHandType(FileHandle, HandType, FlagWord);


HFILE           FileHandle;    /* File handle */
HFILE   FileHandle;    /* File handle */
PUSHORT         HandType;      /* Handle type (returned) */
PUSHORT HandType;      /* Handle type (returned) */
PUSHORT         FlagWord;      /* Device driver attribute (returned) */
PUSHORT FlagWord;      /* Device driver attribute (returned) */


USHORT           rc;            /* return code */
USHORT rc;            /* return code */
</PRE>
</PRE>


===MASM Binding===
===MASM===
<PRE>
<PRE>
EXTRN  DosQHandType:FAR
EXTRN  DosQHandType:FAR
Line 72: Line 53:
</PRE>
</PRE>


==Related Functions==
[[Category:Dos16]]
*
 
[[Category:The OS/2 API Project]]

Latest revision as of 06:16, 26 January 2020

This call determines whether a handle references a file or a device.

Syntax

DosQHandType (FileHandle, HandType, FlagWord)

Parameters

FileHandle (HFILE) - input
File handle.
HandType (PUSHORT) - output
Address of the value indicating the handle type. HandType is composed of two bytes:
15 - Network bit:
0 = The handle refers to a local file, device, or pipe.
1 = Means that the handle refers to a remote file, device, or pipe.
14-8 - Reserved.
7-0 - HandleClass describes the handle class. It may take on the following values in the low byte of HandleType:
0 - Handle is for a disk file
1 - Handle is for a character device
2 - Handle is for a pipe.
Values greater than 2 are reserved.
FlagWord (PUSHORT) - output
Address of the device driver's attribute word if HandleType indicates a local character device.

Return Code

rc (USHORT) - return
Return code descriptions are:
  • 0 NO_ERROR
  • 6 ERROR_INVALID_HANDLE

Remarks

This function allows programs that are interactive or file-oriented to determine the source of their input. For example, CMD.EXE suppresses writing prompts if the input is from a disk file.

Bindings

C

#define INCL_DOSFILEMGR

USHORT  rc = DosQHandType(FileHandle, HandType, FlagWord);

HFILE   FileHandle;    /* File handle */
PUSHORT HandType;      /* Handle type (returned) */
PUSHORT FlagWord;      /* Device driver attribute (returned) */

USHORT  rc;            /* return code */

MASM

EXTRN  DosQHandType:FAR
INCL_DOSFILEMGR     EQU 1

PUSH   WORD    FileHandle    ;File handle
PUSH@  WORD    HandType      ;Handle type (returned)
PUSH@  WORD    FlagWord      ;Device driver attribute (returned)
CALL   DosQHandType

Returns WORD