windows_programming_notes.nbk: Home | Index | Next Page: GetFileTime | Previous Page: GetFileAttributes


 GetFileAttributesEx

Retrieves attributes for a specified file or directory.

To perform this operation as a transacted operation, use the [GetFileAttributesTransacted] function.

    BOOL WINAPI GetFileAttributesEx(
      __in   LPCTSTR lpFileName,   
      __in   GET_FILEEX_INFO_LEVELS fInfoLevelId,
      __out  LPVOID lpFileInformation
    );

Parameters

Return Value

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

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

Remarks

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

Symbolic link behavior—If the path points to a symbolic link, the function returns attributes for the symbolic link.

Transacted Operations

If a file is open for modification in a transaction, no other thread can open the file for modification until the transaction is committed. So if a transacted thread opens the file first, any subsequent threads that try modifying the file before the transaction is committed receives a sharing violation. If a non-transacted thread modifies the file before the transacted thread does, and the file is still open when the transaction attempts to open it, the transaction receives the error ERROR_TRANSACTIONAL_CONFLICT.

Requirements

Library Use Kernel32.lib.

DLL Requires Kernel32.dll.

Unicode Implemented as GetFileAttributesExW (Unicode) and GetFileAttributesExA (ANSI).


windows_programming_notes.nbk: Home | Index | Next Page: GetFileTime | Previous Page: GetFileAttributes


Notebook exported on Monday, 7 July 2008, 18:56:50 PM Eastern Daylight Time