Jump to content

DosQFileInfo: 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 function has been renamed to "[[OS2_API:CPI:DosQueryFileInfo|DosQueryFileInfo]]". [https://books.google.com.ec/books?id=u7WbsmbttwYC&pg=PT372&lpg=PT372&dq#v=onepage&q&f=false]
==Description==
This call returns information for a specific file.
This call returns information for a specific file.


==Syntax==
==Syntax==
<PRE>
  DosQFileInfo (FileHandle, FileInfoLevel, FileInfoBuf, FileInfoBufSize)
  DosQFileInfo
 
    (FileHandle, FileInfoLevel, FileInfoBuf, FileInfoBufSize)
</PRE>


==Parameters==
==Parameters==
; FileHandle (HFILE) - input : File handle.  
;FileHandle (HFILE) - input : File handle.
 
;FileInfoLevel (USHORT) - input : Level of file information required. A value of 1, 2, or 3 can be specified. Level 4 is reserved. The structures described in FileInfoBuf indicate the information returned for each of these levels.
; FileInfoLevel (USHORT) - input : Level of file information required. A value of 1, 2, or 3 can be specified. Level 4 is reserved. The structures described in FileInfoBuf indicate the information returned for each of these levels.  
;FileInfoBuf (PBYTE) - output : Address of the storage area where the system returns the requested level of file information. File information, where applicable, is at least as accurate as the most recent DosClose, DosBufReset, [[DosSetFileInfo (FAPI)|DosSetFileInfo]], or DosSetPathInfo.
 
:'''Level 1 Information'''
; FileInfoBuf (PBYTE) - output : Address of the storage area where the system returns the requested level of file information. File information, where applicable, is at least as accurate as the most recent DosClose, DosBufReset, DosSetFileInfo, or DosSetPathInfo.
::FileInfoBuf contains the following structure, to which file information is returned:
 
::filedate (FDATE) : Structure containing the date of file creation.
'''Level 1 Information'''
:::15-9 Year, in binary, of file creation
 
:::8-5 Month, in binary, of file creation
FileInfoBuf contains the following structure, to which file information is returned:
:::4-0 Day, in binary, of file creation.
 
::filetime (FTIME) : Structure containing the time of file creation.
 
:::15-11 - Hours, in binary, of file creation
filedate (FDATE) : Structure containing the date of file creation.
:::10-5 - Minutes, in binary, of file creation
 
:::4-0 - Seconds, in binary number of two-second increments, of file creation.  
'''Bit                Description'''
::fileaccessdate (FDATE) : Structure containing the date of last access. See FDATE in filedate.
15-9               Year, in binary, of file creation
::fileaccesstime (FTIME) : Structure containing the time of last access. See FTIME in filetime.
8-5               Month, in binary, of file creation
::writeaccessdate (FDATE) : Structure containing the date of last write. See FDATE in filedate.
4-0               Day, in binary, of file creation.  
::writeaccesstime (FTIME) : Structure containing the time of last write. See FTIME in filetime.
 
::filesize (ULONG) : File size.
filetime (FTIME) : Structure containing the time of file creation.
::filealloc (ULONG) : Allocated file size.
 
::fileattrib (USHORT) : Attributes of the file, defined in DosSetFileMode.
'''Bit                    Description'''
:'''Level 2 Information'''
15-11                 Hours, in binary, of file creation
::FileInfoBuf contains a structure similar to the Level 1 structure, with the addition of the cbList field after the fileattrib field.
10-5                   Minutes, in binary, of file creation
::cbList (ULONG) : On output, this field contains the length of the entire EA set for the file object. This value can be used to calculate the size of the buffer required to hold EA information returned when FileInfoLevel = 3 is specified.
4-0                   Seconds, in binary number of two-second increments, of file creation.  
:'''Level 3 Information'''
 
::FileInfoBuf contains an EAOP structure, which has the following format:
fileaccessdate (FDATE) : Structure containing the date of last access. See FDATE in filedate.  
::fpGEAList (PGEALIST) : Address of GEAList. GEAList is a packed array of variable length "get EA" structures, each containing an EA name and the length of the name.
 
::fpFEAList (PFEALIST) : Address of FEAList. FEAList is a packed array of variable length "full EA" structures, each containing an EA name and its corresponding value, as well as the lengths of the name and the value.
fileaccesstime (FTIME) : Structure containing the time of last access. See FTIME in filetime.  
::oError (ULONG) : Offset into structure where error has occurred.
 
::On input, FileInfoBuf is an EAOP structure. fpGEAList points to a GEA list defining the attribute names whose values are returned. fpFEAList points to a data area where the relevant FEA list is returned. The length field of this FEA list is valid, giving the size of the FEA list buffer. oError points to the offending GEA entry in case of error. Following is the format of the GEAList structure:  
writeaccessdate (FDATE) : Structure containing the date of last write. See FDATE in filedate.  
:::cbList (ULONG) : Length of the GEA list, including the length itself.  
 
:::list (GEA) : List of GEA structures. A GEA structure has the following format:
writeaccesstime (FTIME) : Structure containing the time of last write. See FTIME in filetime.  
::::cbName (BYTE) : Length of EA ASCIIZ name, which does not include the null character.
 
::::szName (CHAR) : ASCIIZ name of EA.
filesize (ULONG) : File size.  
::On output, FileInfoBuf is unchanged. The buffer pointed to by fpFEAList is filled in with the returned information. If the buffer fpFEAList points to isn't large enough to hold the returned information (ERROR_BUFFER_OVERFLOW) cbList is still valid, assuming there's at least enough space for it. Its value is the size of the entire EA set for the file, even though only a subset of attributes was requested. Following is the format of the FEAList structure:  
 
:::cbList (ULONG) : Length of the FEA list, including the length itself.  
filealloc (ULONG) : Allocated file size.  
:::list (FEA) : List of FEA structures. An FEA structure has the following format:
 
::::Flags (BYTE) : Bit indicator describing the characteristics of the EA being defined.
fileattrib (USHORT) : Attributes of the file, defined in DosSetFileMode.  
::::7 - Critical EA.
 
::::6-0 - Reserved and must be set to zero.
'''Level 2 Information'''
::::If bit 7 is set to 1, this indicates a critical EA. If bit 7 is 0, this means the EA is noncritical; that is, the EA is not essential to the intended use by an application of the file with which it is associated.
 
:::cbName (BYTE) : Length of EA ASCIIZ name, which does not include the null character.
FileInfoBuf contains a structure similar to the Level 1 structure, with the addition of the cbList field after the fileattrib field.
:::cbValue (USHORT) : Length of EA value, which cannot exceed 64KB.
 
:::szName (PSZ) : Address of the ASCIIZ name of EA.
                   
:::aValue (PSZ) : Address of the free-format value of EA.
cbList (ULONG) : On output, this field contains the length of the entire EA set for the file object. This value can be used to calculate the size of the buffer required to hold EA information returned when FileInfoLevel = 3 is specified.  
:::'''Note:''' The szName and aValue fields are not included as part of header or include files. Because of their variable lengths, these entries must be built manually.
 
;FileInfoBufSize (USHORT) - output : Length of FileInfoBuf.
'''Level 3 Information'''
 
FileInfoBuf contains an EAOP structure, which has the following format:
 
 
fpGEAList (PGEALIST) : Address of GEAList. GEAList is a packed array of variable length "get EA" structures, each containing an EA name and the length of the name.  
 
fpFEAList (PFEALIST) : Address of FEAList. FEAList is a packed array of variable length "full EA" structures, each containing an EA name and its corresponding value, as well as the lengths of the name and the value.  
 
oError (ULONG) : Offset into structure where error has occurred.
 
On input, FileInfoBuf is an EAOP structure. fpGEAList points to a GEA list defining the attribute names whose values are returned. fpFEAList points to a data area where the relevant FEA list is returned. The length field of this FEA list is valid, giving the size of the FEA list buffer. oError points to the offending GEA entry in case of error. Following is the format of the GEAList structure:  
                       
cbList (ULONG) : Length of the GEA list, including the length itself.  
 
list (GEA) : List of GEA structures. A GEA structure has the following format:
 
                           
cbName (BYTE) : Length of EA ASCIIZ name, which does not include the null character.  
 
szName (CHAR) : ASCIIZ name of EA.
 
On output, FileInfoBuf is unchanged. The buffer pointed to by fpFEAList is filled in with the returned information. If the buffer fpFEAList points to isn't large enough to hold the returned information (ERROR_BUFFER_OVERFLOW) cbList is still valid, assuming there's at least enough space for it. Its value is the size of the entire EA set for the file, even though only a subset of attributes was requested. Following is the format of the FEAList structure:  
                           
cbList (ULONG) : Length of the FEA list, including the length itself.  
 
list (FEA) : List of FEA structures. An FEA structure has the following format:
 
                               
Flags (BYTE) : Bit indicator describing the characteristics of the EA being defined.
 
'''Bit            Description'''
7               Critical EA.
6-0             Reserved and must be set to zero.  
If bit 7 is set to 1, this indicates a critical EA. If bit 7 is 0, this means the EA is noncritical; that is, the EA is not essential to the intended use by an application of the file with which it is associated.  
 
cbName (BYTE) : Length of EA ASCIIZ name, which does not include the null character.  
 
cbValue (USHORT) : Length of EA value, which cannot exceed 64KB.  
 
szName (PSZ) : Address of the ASCIIZ name of EA.  
 
aValue (PSZ) : Address of the free-format value of EA.
 
'''Note:''' The szName and aValue fields are not included as part of header or include files. Because of their variable lengths, these entries must be built manually.  
 
                                   
; FileInfoBufSize (USHORT) - output : Length of FileInfoBuf.


==Return Code==
==Return Code==
rc (USHORT) - return
;rc (USHORT) - return:Return code descriptions are:
 
*0 NO_ERROR
Return code descriptions are:
*5 ERROR_ACCESS_DENIED
 
*6 ERROR_INVALID_HANDLE
* 0         NO_ERROR  
*111 ERROR_BUFFER_OVERFLOW
* 5         ERROR_ACCESS_DENIED  
*124 ERROR_INVALID_LEVEL
* 6         ERROR_INVALID_HANDLE  
*130 ERROR_DIRECT_ACCESS_HANDLE
* 111       ERROR_BUFFER_OVERFLOW  
*254 ERROR_INVALID_EA_NAME
* 124       ERROR_INVALID_LEVEL  
*255 ERROR_EA_LIST_INCONSISTENT
* 130       ERROR_DIRECT_ACCESS_HANDLE  
* 254       ERROR_INVALID_EA_NAME  
* 255       ERROR_EA_LIST_INCONSISTENT


==Remarks==
==Remarks==
Line 129: Line 69:


DosEnumAttribute returns the lengths of EAs. This information can be used to calculate the size of FileInfoBuf needed to hold full extended attribute (FEA) information returned by DosQFileInfo when Level 3 is specified. The size of the buffer is calculated as follows:
DosEnumAttribute returns the lengths of EAs. This information can be used to calculate the size of FileInfoBuf needed to hold full extended attribute (FEA) information returned by DosQFileInfo when Level 3 is specified. The size of the buffer is calculated as follows:
* One byte (for fea_usFlags) +
* One byte (for fea_usFlags) +
* One byte (for fea_cbName) +
* One byte (for fea_cbName) +
Line 137: Line 76:
* Value of cbValue (for the value of the EA)
* Value of cbValue (for the value of the EA)


==Example Code==
==Bindings==
=== C Binding===
===C===
<PRE>
<PRE>
typedef struct _FDATE {  /* fdate */
typedef struct _FDATE {  /* fdate */
   unsigned day  : 5;    /* binary day for directory entry */
   unsigned day  : 5;    /* binary day for directory entry */
   unsigned month : 4;    /* binary month for directory entry */
   unsigned month : 4;    /* binary month for directory entry */
   unsigned year  : 7;    /* binary year for directory entry */
   unsigned year  : 7;    /* binary year for directory entry */
} FDATE;
} FDATE;


typedef struct _FTIME {      /* ftime */
typedef struct _FTIME {      /* ftime */
   unsigned twosecs : 5;      /* binary number of two-second increments */
   unsigned twosecs : 5;      /* binary number of two-second increments */
   unsigned minutes : 6;      /* binary number of minutes */
   unsigned minutes : 6;      /* binary number of minutes */
   unsigned hours  : 5;      /* binary number of hours */
   unsigned hours  : 5;      /* binary number of hours */
} FTIME;
} FTIME;


typedef struct _FILESTATUS {  /* fsts */
typedef struct _FILESTATUS {  /* fsts */
   FDATE  fdateCreation;        /* date of file creation */
   FDATE  fdateCreation;        /* date of file creation */
   FTIME  ftimeCreation;        /* time of file creation */
   FTIME  ftimeCreation;        /* time of file creation */
Line 167: Line 101:
   ULONG  cbFileAlloc;          /* file allocated size */
   ULONG  cbFileAlloc;          /* file allocated size */
   USHORT attrFile;            /* attributes of the file */
   USHORT attrFile;            /* attributes of the file */
} FILESTATUS;
} FILESTATUS;


typedef struct _GEA {      /* gea */
typedef struct _GEA {      /* gea */
   BYTE cbName;            /* name length not including NULL */
   BYTE cbName;            /* name length not including NULL */
   CHAR szName[1];        /* attribute name */
   CHAR szName[1];        /* attribute name */
} GEA;
} GEA;


typedef struct _GEALIST {  /* geal */
typedef struct _GEALIST {  /* geal */
   ULONG  cbList;          /* total bytes of structure including full list */
   ULONG  cbList;          /* total bytes of structure including full list */
   GEA list[1];            /* variable length GEA structures */
   GEA list[1];            /* variable length GEA structures */
} GEALIST;
} GEALIST;


typedef struct _FEA {      /* fea */
typedef struct _FEA {      /* fea */
   BYTE fEA;              /* flags */
   BYTE fEA;              /* flags */
   BYTE cbName;            /* name length not including NULL */
   BYTE cbName;            /* name length not including NULL */
   USHORT cbValue;        /* value length */
   USHORT cbValue;        /* value length */
} FEA;
} FEA;


typedef struct _FEALIST {  /* feal */
typedef struct _FEALIST {  /* feal */
   ULONG  cbList;          /* total bytes of structure including full list */
   ULONG  cbList;          /* total bytes of structure including full list */
   FEA list[1];            /* variable length FEA structures */
   FEA list[1];            /* variable length FEA structures */
} FEALIST;
} FEALIST;


typedef struct _EAOP {      /* eaop */
typedef struct _EAOP {      /* eaop */
   PGEALIST fpGEAList;    /* general EA list */
   PGEALIST fpGEAList;    /* general EA list */
   PFEALIST fpFEAList;    /* full EA list */
   PFEALIST fpFEAList;    /* full EA list */
   ULONG  oError;
   ULONG  oError;
} EAOP;
} EAOP;


Line 212: Line 135:
                             FileInfoBufSize);
                             FileInfoBufSize);


HFILE           FileHandle;      /* File handle */
HFILE   FileHandle;      /* File handle */
USHORT           FileInfoLevel;  /* File data required */
USHORT FileInfoLevel;  /* File data required */
PBYTE           FileInfoBuf;    /* File data buffer (returned) */
PBYTE   FileInfoBuf;    /* File data buffer (returned) */
USHORT           FileInfoBufSize; /* File data buffer size */
USHORT FileInfoBufSize; /* File data buffer size */
 
USHORT          rc;              /* return code */


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


===MASM Binding===
===MASM===
<PRE>
<PRE>
FDATE  struc
FDATE  struc  
   fdate_fs  dw  ?
   fdate_fs  dw  ?
FDATE  ends
FDATE  ends


FTIME  struc
FTIME  struc
   ftime_fs  dw  ?
   ftime_fs  dw  ?
FTIME  ends
FTIME  ends


FILESTATUS struc
FILESTATUS struc
   fsts_fdateCreation  dw (size FDATE)/2 dup (?) ;date of file creation
   fsts_fdateCreation  dw (size FDATE)/2 dup (?) ;date of file creation
   fsts_ftimeCreation  dw (size FTIME)/2 dup (?) ;time of file creation
   fsts_ftimeCreation  dw (size FTIME)/2 dup (?) ;time of file creation
Line 246: Line 163:
   fsts_cbFileAlloc    dd  ? ;file allocated size
   fsts_cbFileAlloc    dd  ? ;file allocated size
   fsts_attrFile        dw  ? ;attributes of the file
   fsts_attrFile        dw  ? ;attributes of the file
FILESTATUS ends
FILESTATUS ends


GEA    struc
GEA    struc
   gea_cbName      db  ?          ;name length not including NULL
   gea_cbName      db  ?          ;name length not including NULL
   gea_szName      db  1 dup (?)  ;attribute name
   gea_szName      db  1 dup (?)  ;attribute name
GEA    ends
GEA    ends


GEALIST    struc
GEALIST    struc
   geal_cbList    dd  ?      ;total bytes of structure including full list
   geal_cbList    dd  ?      ;total bytes of structure including full list
   geal_list      db  size GEA * 1 dup (?) ;variable length GEA structures
   geal_list      db  size GEA * 1 dup (?) ;variable length GEA structures
GEALIST    ends
GEALIST    ends


FEA  struc
FEA  struc
   fea_fEA        db  ? ;flags
   fea_fEA        db  ? ;flags
   fea_cbName      db  ? ;name length not including NULL
   fea_cbName      db  ? ;name length not including NULL
   fea_cbValue    dw  ? ;value length
   fea_cbValue    dw  ? ;value length
FEA  ends
FEA  ends


FEALIST struc
FEALIST struc
   feal_cbList    dd  ?      ;total bytes of structure including full list
   feal_cbList    dd  ?      ;total bytes of structure including full list
   feal_list      db  size FEA * 1 dup (?) ;variable length FEA structures
   feal_list      db  size FEA * 1 dup (?) ;variable length FEA structures
FEALIST ends
FEALIST ends


EAOP    struc
EAOP    struc
   eaop_fpGEAList  dd  ? ;general EA list
   eaop_fpGEAList  dd  ? ;general EA list
   eaop_fpFEAList  dd  ? ;full EA list
   eaop_fpFEAList  dd  ? ;full EA list
   eaop_oError    dd  ? ;
   eaop_oError    dd  ? ;
EAOP    ends
EAOP    ends


Line 296: Line 202:


Returns WORD
Returns WORD
</PRE>
</PRE>


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

Latest revision as of 14:48, 12 December 2022

This call returns information for a specific file.

Syntax

DosQFileInfo (FileHandle, FileInfoLevel, FileInfoBuf, FileInfoBufSize)

Parameters

FileHandle (HFILE) - input
File handle.
FileInfoLevel (USHORT) - input
Level of file information required. A value of 1, 2, or 3 can be specified. Level 4 is reserved. The structures described in FileInfoBuf indicate the information returned for each of these levels.
FileInfoBuf (PBYTE) - output
Address of the storage area where the system returns the requested level of file information. File information, where applicable, is at least as accurate as the most recent DosClose, DosBufReset, DosSetFileInfo, or DosSetPathInfo.
Level 1 Information
FileInfoBuf contains the following structure, to which file information is returned:
filedate (FDATE) : Structure containing the date of file creation.
15-9 Year, in binary, of file creation
8-5 Month, in binary, of file creation
4-0 Day, in binary, of file creation.
filetime (FTIME) : Structure containing the time of file creation.
15-11 - Hours, in binary, of file creation
10-5 - Minutes, in binary, of file creation
4-0 - Seconds, in binary number of two-second increments, of file creation.
fileaccessdate (FDATE) : Structure containing the date of last access. See FDATE in filedate.
fileaccesstime (FTIME) : Structure containing the time of last access. See FTIME in filetime.
writeaccessdate (FDATE) : Structure containing the date of last write. See FDATE in filedate.
writeaccesstime (FTIME) : Structure containing the time of last write. See FTIME in filetime.
filesize (ULONG) : File size.
filealloc (ULONG) : Allocated file size.
fileattrib (USHORT) : Attributes of the file, defined in DosSetFileMode.
Level 2 Information
FileInfoBuf contains a structure similar to the Level 1 structure, with the addition of the cbList field after the fileattrib field.
cbList (ULONG) : On output, this field contains the length of the entire EA set for the file object. This value can be used to calculate the size of the buffer required to hold EA information returned when FileInfoLevel = 3 is specified.
Level 3 Information
FileInfoBuf contains an EAOP structure, which has the following format:
fpGEAList (PGEALIST) : Address of GEAList. GEAList is a packed array of variable length "get EA" structures, each containing an EA name and the length of the name.
fpFEAList (PFEALIST) : Address of FEAList. FEAList is a packed array of variable length "full EA" structures, each containing an EA name and its corresponding value, as well as the lengths of the name and the value.
oError (ULONG) : Offset into structure where error has occurred.
On input, FileInfoBuf is an EAOP structure. fpGEAList points to a GEA list defining the attribute names whose values are returned. fpFEAList points to a data area where the relevant FEA list is returned. The length field of this FEA list is valid, giving the size of the FEA list buffer. oError points to the offending GEA entry in case of error. Following is the format of the GEAList structure:
cbList (ULONG) : Length of the GEA list, including the length itself.
list (GEA) : List of GEA structures. A GEA structure has the following format:
cbName (BYTE) : Length of EA ASCIIZ name, which does not include the null character.
szName (CHAR) : ASCIIZ name of EA.
On output, FileInfoBuf is unchanged. The buffer pointed to by fpFEAList is filled in with the returned information. If the buffer fpFEAList points to isn't large enough to hold the returned information (ERROR_BUFFER_OVERFLOW) cbList is still valid, assuming there's at least enough space for it. Its value is the size of the entire EA set for the file, even though only a subset of attributes was requested. Following is the format of the FEAList structure:
cbList (ULONG) : Length of the FEA list, including the length itself.
list (FEA) : List of FEA structures. An FEA structure has the following format:
Flags (BYTE) : Bit indicator describing the characteristics of the EA being defined.
7 - Critical EA.
6-0 - Reserved and must be set to zero.
If bit 7 is set to 1, this indicates a critical EA. If bit 7 is 0, this means the EA is noncritical; that is, the EA is not essential to the intended use by an application of the file with which it is associated.
cbName (BYTE) : Length of EA ASCIIZ name, which does not include the null character.
cbValue (USHORT) : Length of EA value, which cannot exceed 64KB.
szName (PSZ) : Address of the ASCIIZ name of EA.
aValue (PSZ) : Address of the free-format value of EA.
Note: The szName and aValue fields are not included as part of header or include files. Because of their variable lengths, these entries must be built manually.
FileInfoBufSize (USHORT) - output
Length of FileInfoBuf.

Return Code

rc (USHORT) - return
Return code descriptions are:
  • 0 NO_ERROR
  • 5 ERROR_ACCESS_DENIED
  • 6 ERROR_INVALID_HANDLE
  • 111 ERROR_BUFFER_OVERFLOW
  • 124 ERROR_INVALID_LEVEL
  • 130 ERROR_DIRECT_ACCESS_HANDLE
  • 254 ERROR_INVALID_EA_NAME
  • 255 ERROR_EA_LIST_INCONSISTENT

Remarks

The FAT file system supports modification of only date and time information contained in file information level 1. Zero is returned for the creation and access dates and times.

To return information contained in any of the file information levels, DosQFileInfo has to be able to read the open file. DosQFileInfo works only when the file is opened for read access, with a deny-write sharing mode specified for access by other processes. If the file is already opened by another process that has specified conflicting sharing and access modes, a call to DosOpen or DosOpen2 fails.

DosEnumAttribute returns the lengths of EAs. This information can be used to calculate the size of FileInfoBuf needed to hold full extended attribute (FEA) information returned by DosQFileInfo when Level 3 is specified. The size of the buffer is calculated as follows:

  • One byte (for fea_usFlags) +
  • One byte (for fea_cbName) +
  • Two bytes (for fea_cbValue) +
  • Value of cbName (for the name of the EA) +
  • One byte (for terminating NULL in fea_cbName) +
  • Value of cbValue (for the value of the EA)

Bindings

C

typedef struct _FDATE {   /* fdate */
  unsigned day   : 5;     /* binary day for directory entry */
  unsigned month : 4;     /* binary month for directory entry */
  unsigned year  : 7;     /* binary year for directory entry */
} FDATE;

typedef struct _FTIME {       /* ftime */
  unsigned twosecs : 5;       /* binary number of two-second increments */
  unsigned minutes : 6;       /* binary number of minutes */
  unsigned hours   : 5;       /* binary number of hours */
} FTIME;

typedef struct _FILESTATUS {   /* fsts */
  FDATE  fdateCreation;        /* date of file creation */
  FTIME  ftimeCreation;        /* time of file creation */
  FDATE  fdateLastAccess;      /* date of last access */
  FTIME  ftimeLastAccess;      /* time of last access */
  FDATE  fdateLastWrite;       /* date of last write */
  FTIME  ftimeLastWrite;       /* time of last write */
  ULONG  cbFile;               /* file size (end of data) */
  ULONG  cbFileAlloc;          /* file allocated size */
  USHORT attrFile;             /* attributes of the file */
} FILESTATUS;

typedef struct _GEA {       /* gea */
  BYTE cbName;            /* name length not including NULL */
  CHAR szName[1];         /* attribute name */
} GEA;

typedef struct _GEALIST {   /* geal */
  ULONG  cbList;          /* total bytes of structure including full list */
  GEA list[1];            /* variable length GEA structures */
} GEALIST;

typedef struct _FEA {       /* fea */
  BYTE fEA;               /* flags */
  BYTE cbName;            /* name length not including NULL */
  USHORT cbValue;         /* value length */
} FEA;

typedef struct _FEALIST {   /* feal */
  ULONG  cbList;          /* total bytes of structure including full list */
  FEA list[1];            /* variable length FEA structures */
} FEALIST;

typedef struct _EAOP {      /* eaop */
  PGEALIST fpGEAList;     /* general EA list */
  PFEALIST fpFEAList;     /* full EA list */
  ULONG  oError;
} EAOP;

#define INCL_DOSFILEMGR

USHORT  rc = DosQFileInfo(FileHandle, FileInfoLevel, FileInfoBuf,
                             FileInfoBufSize);

HFILE   FileHandle;      /* File handle */
USHORT  FileInfoLevel;   /* File data required */
PBYTE   FileInfoBuf;     /* File data buffer (returned) */
USHORT  FileInfoBufSize; /* File data buffer size */

USHORT  rc;              /* return code */

MASM

FDATE   struc 
  fdate_fs  dw  ?
FDATE   ends

FTIME   struc
  ftime_fs  dw  ?
FTIME   ends

FILESTATUS struc
  fsts_fdateCreation   dw (size FDATE)/2 dup (?) ;date of file creation
  fsts_ftimeCreation   dw (size FTIME)/2 dup (?) ;time of file creation
  fsts_fdateLastAccess dw (size FDATE)/2 dup (?) ;date of last access
  fsts_ftimeLastAccess dw (size FTIME)/2 dup (?) ;time of last access
  fsts_fdateLastWrite  dw (size FDATE)/2 dup (?) ;date of last write
  fsts_ftimeLastWrite  dw (size FTIME)/2 dup (?) ;time of last write
  fsts_cbFile          dd  ? ;file size (end of data)
  fsts_cbFileAlloc     dd  ? ;file allocated size
  fsts_attrFile        dw  ? ;attributes of the file
FILESTATUS ends

GEA    struc
  gea_cbName      db  ?          ;name length not including NULL
  gea_szName      db  1 dup (?)  ;attribute name
GEA    ends

GEALIST    struc
  geal_cbList     dd  ?      ;total bytes of structure including full list
  geal_list       db  size GEA * 1 dup (?) ;variable length GEA structures
GEALIST    ends

FEA   struc
  fea_fEA         db  ? ;flags
  fea_cbName      db  ? ;name length not including NULL
  fea_cbValue     dw  ? ;value length
FEA   ends

FEALIST struc
  feal_cbList     dd  ?      ;total bytes of structure including full list
  feal_list       db  size FEA * 1 dup (?) ;variable length FEA structures
FEALIST ends

EAOP    struc
  eaop_fpGEAList  dd  ? ;general EA list
  eaop_fpFEAList  dd  ? ;full EA list
  eaop_oError     dd  ? ;
EAOP    ends

EXTRN  DosQFileInfo:FAR
INCL_DOSFILEMGR     EQU 1

PUSH   WORD    FileHandle      ;File handle
PUSH   WORD    FileInfoLevel   ;File data required
PUSH@  OTHER   FileInfoBuf     ;File data buffer (returned)
PUSH   WORD    FileInfoBufSize ;File data buffer size
CALL   DosQFileInfo

Returns WORD