网站首页  词典首页

请输入您要查询的函数:

 

术语 getfileattributes
释义 GetFileAttributes
语法:
C++
DWORD WINAPI GetFileAttributes(
__in LPCTSTR lpFileName
);
GetFileAttributes函数
检索文件指定的文件或目录系统属性。
要获得更多的属性信息,请使用GetFileAttributesEx功能。
作为一个要执行此操作的事务操作,请使用GetFileAttributesTransacted功能。
参数
lpFileName [in]
该文件或目录名称。
在此函数的ANSI版本,名称被限制为MAX_PATH字符。为了延长此限制,以32,767宽字符,调用的功能和前面加上“\\ Unicode版本\\?\\”的路径。有关更多信息,请参阅文件名,路径和命名空间。
返回值
如果函数成功,返回值包含指定的文件或目录的属性。如需属性值及其说明列表,请参阅文件属性。
如果函数失败,返回值是INVALID_FILE_ATTRIBUTES。为了获得更多错误信息,调用GetLastError。
备注
当GetFileAttributes是一个目录,是一个安装文件夹,调用,它返回文件系统属性的目录,而不是在该卷的根目录那些与安装文件夹目录联系。要获取相关的文件数量的属性,调用GetVolumeNameForVolumeMountPoint以获得相关的卷名。然后用在给GetFileAttributes电话所产生的名称。结果对相关卷的根目录的属性。
如果您要求网络共享GetFileAttributes,功能失败,GetLastError返回ERROR_BAD_NETPATH。您必须指定路径上的一个共享文件夹。
符号链接的行为,如果路径指向一个符号链接,该函数返回的符号链接属性。
交易业务
如果打开一个文件进行修改的交易,没有其他线程可以打开文件进行修改,直到提交事务。因此,如果一个事务处理线程打开文件的第一,任何试图修改前的事务被提交文件的后续线程收到共享冲突。如果非交易线程修改线程交易之前,该文件不,该文件仍处于打开状态时,交易试图打开它,交易收到错误ERROR_TRANSACTIONAL_CONFLICT。
实例
有关示例,请参见检索和更改文件属性。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinBase.h(头文件:winuser.h)
LibraryKernel32.lib
DLLKernel32.dll
Unicode和ANSI namesGetFileAttributesW(Unicode)和GetFileAttributesA(ANSI)的
参见
的DeviceIoControl
文件属性
文件管理函数
FindFirstFile
FindNextFile
GetFileAttributesEx
GetFileAttributesTransacted
SetFileAttributes
符号链接
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年9月3日
==英文原文==GetFileAttributes Function
Retrieves file system attributes for a specified file or directory.
To get more attribute information, use the GetFileAttributesEx function.
To perform this operation as a transacted operation, use the GetFileAttributesTransacted function.
Syntax
C++
DWORD WINAPI GetFileAttributes(
__in LPCTSTR lpFileName
);
Parameters
lpFileName [in]
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 File Names, Paths, and Namespaces .
Return Value
If the function succeeds, the return value contains the attributes of the specified file or directory. For a list of attribute values and their descriptions, see File Attributes .
If the function fails, the return value is INVALID_FILE_ATTRIBUTES. To get extended error information, call GetLastError .
Remarks
When GetFileAttributes is called on a directory that is a mounted folder, it returns the file system 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 GetFileAttributes. The results are the attributes of the root directory on the associated volume.
If you call GetFileAttributes for a network share, the function fails, and GetLastError returns ERROR_BAD_NETPATH. You must specify a path to a subfolder on that share.
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.
Examples
For an example, see Retrieving and Changing File Attributes .
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinBase.h (include Windows.h)
LibraryKernel32.lib
DLLKernel32.dll
Unicode and ANSI namesGetFileAttributesW (Unicode) and GetFileAttributesA (ANSI)
See Also
DeviceIoControl
File Attributes
File Management Functions
FindFirstFile
FindNextFile
GetFileAttributesEx
GetFileAttributesTransacted
SetFileAttributes
Symbolic Links
Send comments about this topic to Microsoft
Build date: 9/3/2009
==原始网址==http://msdn.microsoft.com/en-us/library/aa364944(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 11:26:37