no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
Next revision | |||
— | en:docs:fapi:dosqfileinfo [2018/08/28 10:21] – created prokushev | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | This call returns information for a specific file. | ||
+ | |||
+ | ==Syntax== | ||
+ | | ||
+ | |||
+ | ==Parameters== | ||
+ | ;FileHandle (HFILE) - input : File handle. | ||
+ | ; | ||
+ | ; | ||
+ | |||
+ | ''' | ||
+ | |||
+ | FileInfoBuf contains the following structure, to which file information is returned: | ||
+ | |||
+ | filedate (FDATE) : Structure containing the date of file creation. | ||
+ | ''' | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | filetime (FTIME) : Structure containing the time 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. | ||
+ | |||
+ | ''' | ||
+ | |||
+ | 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. | ||
+ | |||
+ | ''' | ||
+ | |||
+ | 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' | ||
+ | | ||
+ | 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. | ||
+ | |||
+ | ''' | ||
+ | | ||
+ | | ||
+ | If bit 7 is set to 1, this indicates a critical EA. If bit 7 is 0, this means the EA is noncritical; | ||
+ | |||
+ | 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. | ||
+ | |||
+ | ''' | ||
+ | |||
+ | | ||
+ | ; FileInfoBufSize (USHORT) - output : Length of FileInfoBuf. | ||
+ | |||
+ | ==Return Code== | ||
+ | rc (USHORT) - return | ||
+ | |||
+ | Return code descriptions are: | ||
+ | |||
+ | * 0 | ||
+ | * 5 | ||
+ | * 6 | ||
+ | * 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) | ||
+ | |||
+ | ==Example Code== | ||
+ | === C Binding=== | ||
+ | <PRE> | ||
+ | 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; | ||
+ | FTIME ftimeCreation; | ||
+ | FDATE fdateLastAccess; | ||
+ | FTIME ftimeLastAccess; | ||
+ | FDATE fdateLastWrite; | ||
+ | FTIME ftimeLastWrite; | ||
+ | ULONG cbFile; | ||
+ | ULONG cbFileAlloc; | ||
+ | USHORT attrFile; | ||
+ | |||
+ | } FILESTATUS; | ||
+ | |||
+ | typedef struct _GEA { /* gea */ | ||
+ | |||
+ | BYTE cbName; | ||
+ | CHAR szName[1]; | ||
+ | |||
+ | } GEA; | ||
+ | |||
+ | typedef struct _GEALIST { /* geal */ | ||
+ | |||
+ | ULONG cbList; | ||
+ | GEA list[1]; | ||
+ | |||
+ | } GEALIST; | ||
+ | |||
+ | typedef struct _FEA { /* fea */ | ||
+ | |||
+ | BYTE fEA; /* flags */ | ||
+ | BYTE cbName; | ||
+ | USHORT cbValue; | ||
+ | |||
+ | } FEA; | ||
+ | |||
+ | typedef struct _FEALIST { /* feal */ | ||
+ | |||
+ | ULONG cbList; | ||
+ | FEA list[1]; | ||
+ | |||
+ | } FEALIST; | ||
+ | |||
+ | typedef struct _EAOP { /* eaop */ | ||
+ | |||
+ | PGEALIST fpGEAList; | ||
+ | PFEALIST fpFEAList; | ||
+ | ULONG oError; | ||
+ | |||
+ | } EAOP; | ||
+ | |||
+ | #define INCL_DOSFILEMGR | ||
+ | |||
+ | USHORT | ||
+ | | ||
+ | |||
+ | HFILE FileHandle; | ||
+ | USHORT | ||
+ | PBYTE FileInfoBuf; | ||
+ | USHORT | ||
+ | |||
+ | USHORT | ||
+ | |||
+ | </ | ||
+ | |||
+ | ===MASM Binding=== | ||
+ | <PRE> | ||
+ | FDATE struc | ||
+ | |||
+ | fdate_fs | ||
+ | |||
+ | FDATE ends | ||
+ | |||
+ | FTIME struc | ||
+ | |||
+ | ftime_fs | ||
+ | |||
+ | FTIME ends | ||
+ | |||
+ | FILESTATUS struc | ||
+ | |||
+ | fsts_fdateCreation | ||
+ | fsts_ftimeCreation | ||
+ | fsts_fdateLastAccess dw (size FDATE)/2 dup (?) ;date of last access | ||
+ | fsts_ftimeLastAccess dw (size FTIME)/2 dup (?) ;time of last access | ||
+ | fsts_fdateLastWrite | ||
+ | fsts_ftimeLastWrite | ||
+ | fsts_cbFile | ||
+ | fsts_cbFileAlloc | ||
+ | fsts_attrFile | ||
+ | |||
+ | FILESTATUS ends | ||
+ | |||
+ | GEA struc | ||
+ | |||
+ | gea_cbName | ||
+ | gea_szName | ||
+ | |||
+ | GEA ends | ||
+ | |||
+ | GEALIST | ||
+ | |||
+ | geal_cbList | ||
+ | geal_list | ||
+ | |||
+ | GEALIST | ||
+ | |||
+ | FEA struc | ||
+ | |||
+ | fea_fEA | ||
+ | fea_cbName | ||
+ | fea_cbValue | ||
+ | |||
+ | FEA ends | ||
+ | |||
+ | FEALIST struc | ||
+ | |||
+ | feal_cbList | ||
+ | feal_list | ||
+ | |||
+ | FEALIST ends | ||
+ | |||
+ | EAOP struc | ||
+ | |||
+ | eaop_fpGEAList | ||
+ | eaop_fpFEAList | ||
+ | eaop_oError | ||
+ | |||
+ | EAOP ends | ||
+ | |||
+ | EXTRN DosQFileInfo: | ||
+ | INCL_DOSFILEMGR | ||
+ | |||
+ | PUSH | ||
+ | PUSH | ||
+ | PUSH@ OTHER | ||
+ | PUSH | ||
+ | CALL | ||
+ | |||
+ | Returns WORD | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | ====== Note ====== | ||
+ | |||
+ | Text based on http:// | ||
+ | |||
+ | {{page> | ||