en:docs:fapi:dossetfileinfo

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
en:docs:fapi:dossetfileinfo [2018/08/30 14:34] – created prokusheven:docs:fapi:dossetfileinfo [2021/09/17 08:32] (current) prokushev
Line 1: Line 1:
 +{{page>en:templates:fapiint}}
 +
 +====== DosSetFileInfo ======
  
 This call sets attribute and extended attribute information for a file.  This call sets attribute and extended attribute information for a file. 
  
-==Syntax== +===== Syntax ===== 
- DosSetFileInfo (FileHandle, FileInfoLevel, FileInfoBuf, FileInfoBufSize)+<code c> 
 +DosSetFileInfo (FileHandle, FileInfoLevel, FileInfoBuf, FileInfoBufSize) 
 +</code>
  
-==Parameters== +===== Parameters ===== 
-;FileHandle (HFILE) - input : File handle. + 
-;FileInfoLevel (USHORT) - input : Level of file information being set. A value of 1 or 2 can be specified. The structures described in FileInfoBuf indicate the information being set for each of these levels. +  FileHandle ([[HFILE]]) - input : File handle. 
-;FileInfoBuf (PBYTE) - input : Address of the storage area containing the structures for file information levels.+  FileInfoLevel ([[USHORT]]) - input : Level of file information being set. A value of 1 or 2 can be specified. The structures described in FileInfoBuf indicate the information being set for each of these levels. 
 +  FileInfoBuf ([[PBYTE]]) - input : Address of the storage area containing the structures for file information levels. 
 +  * FileInfoBufSize ([[USHORT]]) - input : Length of FileInfoBuf. 
 + 
 +==== Level 1 Information ====
  
-'''Level 1 Information''' 
 FileInfoBuf contains the following structure, to which information is specified in the following format: FileInfoBuf contains the following structure, to which information is specified in the following format:
  
-filedate (FDATE) : Structure containing the date of file creation. +filedate ([[FDATE]]) : Structure containing the date of file creation. 
- '''Bit    Description'''  +Bit Description ^ 
- 15-9    Year, in binary, of file creation  +15-9 Year, in binary, of file creation | 
- 8-5     Month, in binary, of file creation  +8-5 Month, in binary, of file creation | 
- 4-0     Day, in binary, of file creation. +4-0 Day, in binary, of file creation 
-filetime (FTIME) : Structure containing the time of file creation. + 
- '''Bit    Description'''  +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  +Bit Description ^ 
- 4-0     Seconds, in binary number of two-second increments, of file creation +15-11 Hours, in binary, of file creation | 
-fileaccessdate (FDATE) : Structure containing the date of last access. See FDATE in filedate. +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. +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. +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. +writeaccesstime ([[FTIME]]) : Structure containing the time of last write. See [[FTIME]] in filetime. 
  
-filesize (ULONG) : File size. +filesize ([[ULONG]]) : File size. 
  
-filealloc (ULONG) : Allocated file size. +filealloc ([[ULONG]]) : Allocated file size. 
  
-fileattrib (USHORT) : Attributes of the file, defined in DosSetFileMode. +fileattrib ([[USHORT]]) : Attributes of the file, defined in DosSetFileMode. 
  
-'''Level 2 Information'''+==== Level 2 Information ====
  
-FileInfoBuf contains an EAOP structure, which has the following format:+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. +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. +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. +oError ([[ULONG]]) : Offset into structure where error has occurred. 
  
 Level 2 sets a series of EA name/value pairs. On input, FileInfoBuf is an EAOP structure above. fpGEAList is ignored. fpFEAList points to a data area where the relevant FEA list is to be found. oError is ignored. Following is the format of the FEAList structure: Level 2 sets a series of EA name/value pairs. On input, FileInfoBuf is an EAOP structure above. fpGEAList is ignored. fpFEAList points to a data area where the relevant FEA list is to be found. oError is ignored. Following is the format of the FEAList structure:
  
-cbList (ULONG) : Length of the FEA list, including the length itself. +cbList ([[ULONG]]) : Length of the FEA list, including the length itself. 
  
-list (FEA) : List of FEA structures. An FEA structure has the following format:+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.+Flags ([[BYTE]]) : Bit indicator describing the characteristics of the EA being defined.
  
- '''Bit                               Description''' +Bit Description ^ 
-                                    Critical EA +Critical EA | 
- 6-0                                  Reserved and must be set to zero+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.  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.  +cbName ([[BYTE]]) : Length of EA ASCIIZ name, which does not include the null character.  
  
-cbValue (USHORT) : Length of EA value, which cannot exceed 64KB.  +cbValue ([[USHORT]]) : Length of EA value, which cannot exceed 64KB.  
  
-szName (PSZ) : Address of the ASCIIZ name of EA.  +szName ([[PSZ]]) : Address of the ASCIIZ name of EA.  
  
-aValue (PSZ) : Address of the free-format value 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.  '''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. 
Line 73: Line 84:
 On output, fpGEAList is unchanged. fpFEAList is unchanged as is the area pointed to by fpFEAList. If an error occurred during the set, oError is the offset of the FEA where the error occurred. The API return code is the error code corresponding to the condition generating the error. If no error occurred, oError is undefined.  On output, fpGEAList is unchanged. fpFEAList is unchanged as is the area pointed to by fpFEAList. If an error occurred during the set, oError is the offset of the FEA where the error occurred. The API return code is the error code corresponding to the condition generating the error. If no error occurred, oError is undefined. 
  
-; FileInfoBufSize (USHORT) - input : Length of FileInfoBuf.+===== Return Code =====
  
-==Return Code== +  * 0         NO_ERROR  
-* 0         NO_ERROR  +  * 1    ERROR_INVALID_FUNCTION  
-* 1    ERROR_INVALID_FUNCTION  +  * 5    ERROR_ACCESS_DENIED  
-* 5    ERROR_ACCESS_DENIED  +  * 6    ERROR_INVALID_HANDLE  
-* 6    ERROR_INVALID_HANDLE  +  * 87    ERROR_INVALID_PARAMETER  
-* 87    ERROR_INVALID_PARAMETER  +  * 122    ERROR_INSUFFICIENT_BUFFER  
-* 122    ERROR_INSUFFICIENT_BUFFER  +  * 124    ERROR_INVALID_LEVEL  
-* 124    ERROR_INVALID_LEVEL  +  * 130    ERROR_DIRECT_ ACCESS _ HANDLE  
-* 130    ERROR_DIRECT_ ACCESS _ HANDLE  +  * 254    ERROR _ INVALID _ EA _ NAME  
-* 254    ERROR _ INVALID _ EA _ NAME  +  * 255    ERROR _ EA _ LIST _ INCONSISTENT
-* 255    ERROR _ EA _ LIST _ INCONSISTENT+
  
-==Remarks== +===== Remarks ===== 
-DosSetFileInfo is successful only when the file is opened for write access, with a deny-both sharing mode specified for access to the file by other processes. If the file is already opened with conflicting sharing rights, the call to DosOpen or DosOpen2 will fail.+ 
 +DosSetFileInfo is successful only when the file is opened for write access, with a deny-both sharing mode specified for access to the file by other processes. If the file is already opened with conflicting sharing rights, the call to [[DosOpen]] or [[DosOpen2]] will fail.
  
 A 0 value in the date and time components of a field does not change the field. For example, if both "last write date" and "last write time" are specified as 0 in the Level 1 information structure, then both attributes of the file are left unchanged. If either "last write date" or "last write time" are specified as non-zero, both attributes of the file are set to the new values. A 0 value in the date and time components of a field does not change the field. For example, if both "last write date" and "last write time" are specified as 0 in the Level 1 information structure, then both attributes of the file are left unchanged. If either "last write date" or "last write time" are specified as non-zero, both attributes of the file are set to the new values.
Line 96: Line 107:
 The last modification date and time will get changed if the extended attributes are modified. The last modification date and time will get changed if the extended attributes are modified.
  
-===Family API Considerations===+==== Family API Considerations ===
 It is not possible to create a label with leading blank characters in DOS mode, because of restrictions on the previous Interrupt 21h function call (create an FCB type file), which must be used by FAPI.  It is not possible to create a label with leading blank characters in DOS mode, because of restrictions on the previous Interrupt 21h function call (create an FCB type file), which must be used by FAPI. 
  
-==Example Code== +===== Example Code ===== 
-===C Binding=== + 
-<PRE>+==== C Binding ===
 + 
 +<code c>
 typedef struct _FDATE {   /* fdate */ typedef struct _FDATE {   /* fdate */
    
Line 181: Line 195:
 USHORT           rc;              /* return code */ USHORT           rc;              /* return code */
  
-</PRE>+</code>
  
-===MASM Binding=== +==== MASM Binding ===
-<PRE>+ 
 +<code c>
 FDATE   struc FDATE   struc
    
Line 258: Line 273:
  
 Returns WORD Returns WORD
-</PRE> +</code>
- +
  
-====== Note ======+===== Note =====
  
 Text based on [[http://www.edm2.com/index.php/DosSetFileInfo_(FAPI)]] Text based on [[http://www.edm2.com/index.php/DosSetFileInfo_(FAPI)]]