dos12.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
DosQFileInfo (1.2)
Function Group  Overview  Changes               Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
#define INCL_DOSFILEMGR
 
USHORT DosQFileInfo(hf, usInfoLevel, pvInfo, cbInfoBuf)
HFILE hf;              /* handle of file about which data is sought */
USHORT usInfoLevel;    /* level of file data required               */
PVOID pvInfo;          /* pointer to file-data buffer               */
USHORT cbInfoBuf;      /* length of file-data buffer                */
 
The DosQFileInfo function retrieves information about a specific file. The
file information consists of the date and time the file was created, the
date and time it was last accessed, the date and time it was last written
to, the size of the file, and its attributes. It can also be used to return
information about the extended attributes used for a file.
 
The file information is based on the most recent call to the DosClose or the
DosBufReset function.
 
The DosQFileInfo function is a family API function.
 
Parameter    Description
────────────────────────────────────────────────────────────────────────────
 
hf           Identifies the file about which information is to be retrieved.
             This handle must have been created by using the DosOpen
             function.
 
usInfoLevel  Specifies the level of file information required. It may be one
             of the following values:
 
             Value                 Meaning
             ───────────────────────────────────────────────────────────────
             FIL_STANDARD          This will return a FILESTATUS structure.
                                   Any time and data fields in the structure
                                   that the file-system device does not
                                   support are set to zero.
 
             FIL_QUERYEASIZE       This will return a FILESTATUS2 structure,
                                   which contains the same information as
                                   FILESTATUS plus the size of the structure
                                   used by the FIL_QUERYEASFROMLIST value
                                   (for MS OS/2 version 1.2, this size
                                   cannot exceed 65,535 bytes).
 
             FIL_QUERYEASFROMLIST  This will return an EAOP structure that
                                   contains a subset of the file's
                                   extended-attribute information.
 
pvInfo       Points to the structure that receives the file information.
             This structure will be FILESTATUS for FIL_STANDARD information,
             FILESTATUS2 for FIL_QUERYEASIZE information, and EAOP for
             FIL_QUERYEASFROMLIST information.
 
cbInfoBuf    Specifies the length (in bytes) of the buffer that receives the
             file information.
 
Return Value
 
The return value is zero if the function is successful. Otherwise, it is an
error value, which may be one of the following:
 
     ERROR_INVALID_EA_NAME
     ERROR_EA_LIST_INCONSISTENT
     ERROR_BUFFER_OVERFLOW
     ERROR_DIRECT_ACCESS_HANDLE
     ERROR_INVALID_HANDLE
     ERROR_INVALID_LEVEL
 
Comments
 
Prior to the function being called, the fpFEAlist field in the EAOP
structure should be initialized so that it points to the FEALIST structure
that contains the relevant FEA structure. The cbList field in the FEALIST
structure is valid, giving the size of the FEA structure.
 
If the FEALIST structure is not large enough to hold the returned
information (indicated by ERROR_BUFFER_OVERFLOW), cbList will still be
valid, assuming there is at least enough space for it. Its value will be the
size of the entire set of extended attributes for the file, even if only a
subset of attributes was requested.
 
Example
 
This example opens the file abc, calls the DosQFileInfo function to retrieve
the current allocated size, and then calls the DosNewSize function to
increase the file's size by 1K:
 
HFILE hf;
USHORT usAction;
FILESTATUS fstsFile;
DosOpen("abc", &hf, &usAction, 0L, FILE_NORMAL,
    FILE_OPEN | FILE_CREATE,
    OPEN_ACCESS_WRITEONLY | OPEN_SHARE_DENYNONE, 0L);
DosQFileInfo(hf,                 /* file handle                 */
    FIL_STANDARD,                /* level of information        */
    &fstsFile,                   /* address of file-data buffer */
    sizeof(fstsFile));           /* size of data buffer         */
DosNewSize(hf, fstsFile.cbFileAlloc + 1024L);
 
See Also
 
DosBufReset, DosClose, DosNewSize, DosOpen, DosQFileMode, DosQPathInfo,
DosSetFileInfo, EAOP, FILESTATUS, FILESTATUS2