Reading and Writing File Attributes

Windows CE provides a variety of functions to identify and modify the status of a file. You can set the parameters of a file when you first create the file with CreateFile. After you create the file, you can view the file attributes with the GetFileAttributes function and you can modify the file attributes with the SetFileAttributes function. The following table describes what file attributes you can interact with by using the GetFileAttributes, SetFileAttributes, and CreateFile functions.


Flag

CreateFile
GetFile
attributes
SetFile
attributes
FILE_ATTRIBUTE_ARCHIVE X X X
FILE_ATTRIBUTE_COMPRESSED   X  
FILE_ATTRIBUTE_DIRECTORY X
FILE_ATTRIBUTE_ENCRYPTED X
FILE_ATTRIBUTE_HIDDEN X X X
FILE_ATTRIBUTE_INROM   X  
FILE_ATTRIBUTE_NORMAL X X X
FILE_ATTRIBUTE_OFFLINE   X X
FILE_ATTRIBUTE_READONLY X X X
FILE_ATTRIBUTE_REPARSE_POINT   X  
FILE_ATTRIBUTE_ROMMODULE X
FILE_ATTRIBUTE_SPARSE_FILE X
FILE_ATTRIBUTE_SYSTEM X X X
FILE_ATTRIBUTE_TEMPORARY X X X
FILE_FLAG_WRITE_THROUGH X    
FILE_FLAG_RANDOM_ACCESS X
FILE_FLAG_SEQUENTIAL_SCAN X
FILE_ATTRIBUTE_ROMSTATICREF   X

You can also use the GetFileSize function to return the size of a file.