You are on page 1of 4

17/10/22, 15:48 GetFileAttributesTransactedA function (winbase.

h) - Win32 apps | Microsoft Learn

GetFileAttributesTransactedA function
(winbase.h)
Article • 07/28/20223 minutes to read

[Microsoft strongly recommends developers utilize alternative means to achieve your


application’s needs. Many scenarios that TxF was developed for can be achieved
through simpler and more readily available techniques. Furthermore, TxF may not be
available in future versions of Microsoft Windows. For more information, and
alternatives to TxF, please see Alternatives to using Transactional NTFS.]

Retrieves file system attributes for a specified file or directory as a transacted


operation.

Syntax
C++

BOOL GetFileAttributesTransactedA(

[in] LPCSTR lpFileName,

[in] GET_FILEEX_INFO_LEVELS fInfoLevelId,

[out] LPVOID lpFileInformation,

[in] HANDLE hTransaction

);

Parameters
[in] lpFileName

The name of the file or directory.

In the ANSI version of this function, the name is limited to MAX_PATH characters.
To
extend this limit to 32,767 wide characters, call the Unicode version of the function and
prepend
"\?" to the path. For more information, see
Naming a File.

The file or directory must reside on the local computer; otherwise, the function fails and
the last error code is set to ERROR_TRANSACTIONS_UNSUPPORTED_REMOTE.

[in] fInfoLevelId

The level of attribute information to retrieve.

https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-getfileattributestransacteda 1/4
17/10/22, 15:48 GetFileAttributesTransactedA function (winbase.h) - Win32 apps | Microsoft Learn

This parameter can be the following value from the


GET_FILEEX_INFO_LEVELS
enumeration.

Value Meaning

GetFileExInfoStandard The lpFileInformation parameter is a


WIN32_FILE_ATTRIBUTE_DATA structure.

[out] lpFileInformation

A pointer to a buffer that receives the attribute information.

The type of attribute information that is stored into this buffer is determined by the
value of
fInfoLevelId. If the fInfoLevelId parameter is
GetFileExInfoStandard then this
parameter points to a
WIN32_FILE_ATTRIBUTE_DATA
structure

[in] hTransaction

A handle to the transaction. This handle is returned by the CreateTransaction function.

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

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

Remarks
When GetFileAttributesTransacted is
called on a directory that is a mounted folder, it
returns the attributes of the directory, not those of the root directory in the volume that
the mounted folder associates with the directory. To obtain the
file attributes of the
associated volume, call
GetVolumeNameForVolumeMountPoint to
obtain the name of
the associated volume. Then use the resulting name in a call to
GetFileAttributesTransacted. The results are
the attributes of the root directory on the
associated volume.

In Windows 8 and Windows Server 2012, this function is supported by the following


technologies.

Technology Supported

Server Message Block (SMB) 3.0 protocol No

https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-getfileattributestransacteda 2/4
17/10/22, 15:48 GetFileAttributesTransactedA function (winbase.h) - Win32 apps | Microsoft Learn

SMB 3.0 Transparent Failover (TFO) No

SMB 3.0 with Scale-out File Shares (SO) No

Cluster Shared Volume File System (CsvFS) No

Resilient File System (ReFS) No

SMB 3.0 does not support TxF.

Symbolic links:  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. Conversely, if a file is open for
modification outside of a transaction, no transacted thread can open the file for
modification until the non-transacted handle is closed. If a non-transacted thread has a
handle opened to modify a file, a call to GetFileAttributesTransacted for that file will fail
with an ERROR_TRANSACTIONAL_CONFLICT error.

7 Note

The winbase.h header defines GetFileAttributesTransacted as an alias which


automatically selects the ANSI or Unicode version of this function based on the
definition of the UNICODE preprocessor constant. Mixing usage of the encoding-
neutral alias with code that not encoding-neutral can lead to mismatches that
result in compilation or runtime errors. For more information, see Conventions for
Function Prototypes.

Requirements
   

Minimum supported client Windows Vista [desktop apps only]

Minimum supported server Windows Server 2008 [desktop apps only]

Target Platform Windows

Header winbase.h (include Windows.h)

https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-getfileattributestransacteda 3/4
17/10/22, 15:48 GetFileAttributesTransactedA function (winbase.h) - Win32 apps | Microsoft Learn

   

Library Kernel32.lib

DLL Kernel32.dll

See also
DeviceIoControl

File Attribute Constants

File Management Functions

FindFirstFileTransacted

FindNextFile

GET_FILEEX_INFO_LEVELS

SetFileAttributesTransacted

Symbolic Links

Transactional NTFS

https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-getfileattributestransacteda 4/4

You might also like