Platform SDK: Files and I/O

GetFileAttributesEx

The GetFileAttributesEx function retrieves attributes for a specified file or directory.

BOOL GetFileAttributesEx(
  LPCTSTR lpFileName,                   // file or directory name
  GET_FILEEX_INFO_LEVELS fInfoLevelId,  // attribute 
  LPVOID lpFileInformation              // attribute information 
);

Parameters

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

Windows NT/2000: In the ANSI version of this function, the name is limited to MAX_PATH characters. To extend this limit to nearly 32,000 wide characters, call the Unicode version of the function and prepend "\\?\" to the path. For more information, see File Name Conventions.

Windows 98: This string must not exceed MAX_PATH characters.

fInfoLevelId
[in] Specifies a GET_FILEEX_INFO_LEVELS enumeration type that gives the set of attribute information to obtain.
lpFileInformation
[out] Pointer to a buffer that receives the attribute information. The type of attribute information stored into this buffer is determined by the value of fInfoLevelId.

Return Values

If the function succeeds, the return value is a nonzero value.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

The GetFileAttributes function retrieves a set of FAT-style attribute information. GetFileAttributesEx can obtain other sets of file or directory attribute information. Currently, GetFileAttributeEx retrieves a set of standard attributes that is a superset of the FAT-style attribute information.

Requirements

  Windows NT/2000: Requires Windows NT 4.0 or later.
  Windows 95/98: Requires Windows 98.
  Header: Declared in Winbase.h; include Windows.h.
  Library: Use Kernel32.lib.
  Unicode: Implemented as Unicode and ANSI versions on Windows NT/2000.

See Also

File I/O Overview, File I/O Functions, GetFileAttributes, GET_FILEEX_INFO_LEVELS, SetFileAttributes