Purpose
DosQueryPathInfo gets file information for a file or subdirectory.
Syntax
#define INCL DOSFILEMGR #include os2.h
APIRET DosQueryPathInfo
Parameters
pszPathName PSZ) input
Global file-name characters can be used in the name only for level 5 file information.
DosQuerySysInfo is called by an application during initialization to determine the maximum path length allowed by the operating system.
Specify a value
Level 1 file information
11
Level 11 file information
Level 2 file information
Level 12 file information
Level 3 file information
Level 5 file information
The structures described in pInfoBuf indicate the information returned for each of these levels.
Path information, where applicable, is based on the most recent DosClose, DosResetBuffer, DosSetFileInfo, or DosSetPathInfo.
Level 1 File Information (ulInfoLevel == FIL_STANDARD)
The cbList field is an unsigned LONG On output, this field contains the size, in bytes, of the file s entire extended attribute (EA) set on disk. You can use this value to calculate the size of the buffer required to hold the EA information returned when a value of 3 is specified for ulInfoLevel. The buffer size is less than or equal to twice the size of the file s entire EA set on disk.
The cbList field is an unsigned ULONG On output, this field contains the size, in bytes, of the file s entire extended attribute (EA) set on disk. You can use this value to calculate the size of the buffer required to hold the EA information returned when a value of 3 is specified for ulInfoLevel. The buffer size is less than or equal to twice the size of the file s entire EA set on disk.
Input
Returns
ulrc APIRET) returns
DosQueryPathInfo returns one of the following values
32
Remarks
In the FAT file system, only date and time information contained in Level 1 file information can be modified. Zero is returned for the creation and access dates and times.
For DosQueryPathInfo to return information contained in any of the file information levels, the file object must be opened for read access, with a deny-write sharing mode specified for access by other processes. Thus, if the file object is already accessed by another process that holds conflicting sharing and access rights, a call to DosQueryPathInfo fails.
Related Functions
Example Code
The first example obtains information about the file STARTUP.CMD. The second example obtains information about the directory SYSTEM.
#define INCL_DOSFILEMGR /* File Manager values */#define INCL_DOSERRORS /* DOS error values */ #include os2.h #include stdio.h int main(VOID) UCHAR uchFileName 80 = "C \\STARTUP.CMD"; /* File to manipulate */ FILESTATUS3L fsts3ConfigInfo = 0 ; /* Buffer for file information */ ULONG ulBufSize = sizeof(FILESTATUS3L); /* Size of above buffer */ APIRET rc = NO_ERROR; /* Return code */ rc = DosQueryPathInfo(uchFileName, /* Path and name of file */ FIL_STANDARDL, /* Request standard (Level 11) info */ fsts3ConfigInfo, /* Buffer for file information */ ulBufSize); /* Size of buffer */ if (rc != NO_ERROR) printf("DosQueryPathInfo error return code = %u\n", rc); return 1; printf("%s --- File size %lld bytes\n",uchFileName, fsts3ConfigInfo.cbFile); printf("Last updated %d/%d/%d; %d %2.2d\n", fsts3ConfigInfo.fdateLastWrite.month, /* Month */ fsts3ConfigInfo.fdateLastWrite.day, /* Day */ (fsts3ConfigInfo.fdateLastWrite.year+1980L), /* Years since 1980 */ fsts3ConfigInfo.ftimeLastWrite.hours, /* Hours */ fsts3ConfigInfo.ftimeLastWrite.minutes); /* Minutes */ return NO_ERROR; #define INCL_DOSFILEMGR /* File Manager values */ #define INCL_DOSERRORS /* DOS error values */ #include os2.h #include stdio.h int main(VOID) UCHAR uchPathName 255 = "C \\OS2\\SYSTEM"; /* Path of interest */ FILESTATUS3L fsts3ConfigInfo = 0 ; /* Buffer for path information */ ULONG ulBufSize = sizeof(FILESTATUS3L); /* Size of above buffer */ APIRET rc = NO_ERROR; /* Return code */ rc = DosQueryPathInfo(uchPathName, /* Name of path */ FIL_STANDARDL, /* Request standard (Level 11) info */ fsts3ConfigInfo, /* Buffer for information */ ulBufSize); /* Size of buffer */ if (rc != NO_ERROR) printf("DosQueryPathInfo error return code = %u\n", rc); return 1; printf("Information for subdirectory %s \n",uchPathName); printf("Last updated %d/%d/%d; %d %2.2d\n", fsts3ConfigInfo.fdateLastWrite.month, /* Month */ fsts3ConfigInfo.fdateLastWrite.day, /* Day */ (fsts3ConfigInfo.fdateLastWrite.year+1980L), /* Years since 1980 */ fsts3ConfigInfo.ftimeLastWrite.hours, /* Hours */ fsts3ConfigInfo.ftimeLastWrite.minutes); /* Minutes */ return NO_ERROR;