Compartir a través de


GetFileAttributes

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This function obtains attributes for a specified file or directory. A RAPI version of this function exists called CeGetFileAttributes (RAPI).

Syntax

DWORD GetFileAttributes(
  LPCTSTR lpFileName 
); 

Parameters

  • lpFileName
    [in] Pointer to a null-terminated string that specifies the name of a file or directory.

    The default string size limit for paths is MAX_PATH characters. This limit is related to how this function parses paths.

Return Value

The attributes of the specified file or directory, returned in a DWORD, indicate success. 0xFFFFFFFF indicates failure. To get extended error information, call GetLastError.

The following table shows possible values.

Value Description

FILE_ATTRIBUTE_ARCHIVE

The file or directory is an archive file or directory. Applications use this attribute to mark files for backup or removal.

FILE_ATTRIBUTE_COMPRESSED

The file or directory is compressed. For a file, this means that all data in the file is compressed. For a directory, this means that compression is the default for newly created files and subdirectories.

FILE_ATTRIBUTE_DIRECTORY

The object is a directory.

FILE_ATTRIBUTE_ENCRYPTED

The file or directory is encrypted. For a file, this means that all data streams are encrypted. For a directory, this means that encryption is the default for newly created files and subdirectories.

FILE_ATTRIBUTE_HIDDEN

The file or directory is hidden. Hidden files and directories are not included in a typical directory listing.

FILE_ATTRIBUTE_INROM

This file is an OS file stored in ROM. These files are read-only and cannot be modified.

FILE_ATTRIBUTE_NORMAL

The file has no other attributes set. This attribute is valid only if used alone.

FILE_ATTRIBUTE_READONLY

The file or directory is read-only. Applications can read the file, but cannot write to it or delete it. If it is a directory, applications cannot delete or move it.

FILE_ATTRIBUTE_ROMMODULE

This file is an OS file stored in ROM and run directly from ROM, rather than being first copied to RAM. The CreateFile function cannot be used to access this file. Instead, use the LoadLibrary and the CreateProcess functions.

FILE_ATTRIBUTE_ROMSTATICREF

The file is a DLL module that has an implicit reference from at least one other file that is in the modules section of the image. A file with this attribute cannot replace the functionality of the DLL with a RAM copy of the same DLL. A file with this attribute must also have the FILE_ATTRIBUTE_INROM and the FILE_ATTRIBUTE_ROMMODULE attributes.

FILE_ATTRIBUTE_SYSTEM

The file or directory is part of, or is used exclusively by, the OS.

FILE_ATTRIBUTE_TEMPORARY

The file is being used for temporary storage. File systems attempt to keep the data in memory for quicker access, rather than flushing the data back to mass storage. A temporary file should be deleted by the application as soon as it is no longer needed.

Requirements

Header winbase.h
Library coredll.lib
Windows Embedded CE Windows CE 1.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

File I/O Functions
CreateFile
FindFirstFile
SetFileAttributes
GetFileAttributesEx
GetFileInformationByHandle

Other Resources

CreateProcess
LoadLibrary