WIN32_FIND_DATA Structure

WIN32_FIND_DATA Structure

Contains information about the file that is found by the FindFirstFile , FindFirstFileEx , or FindNextFile function.

Syntax

C++
typedef struct _WIN32_FIND_DATA {
DWORD dwFileAttributes;
FILETIME ftCreationTime;
FILETIME ftLastAccessTime;
FILETIME ftLastWriteTime;
DWORD nFileSizeHigh;
DWORD nFileSizeLow;
DWORD dwReserved0;
DWORD dwReserved1;
TCHAR cFileName[MAX_PATH];
TCHAR cAlternateFileName[14];
}WIN32_FIND_DATA, *PWIN32_FIND_DATA, *LPWIN32_FIND_DATA;

Members

dwFileAttributes

The file attributes of a file.

This member can be one or more of the following values.

AttributeMeaning
FILE_ATTRIBUTE_ARCHIVE 32 (0x20)

The file or directory is an archive file or directory.

Applications use this attribute to mark files for backup or removal.

FILE_ATTRIBUTE_COMPRESSED 2048 (0x800)

The file or directory is compressed.

For a file, this means that all of the data in the file is compressed.

For a directory, this means that compression is the default for newly created files and subdirectories.

FILE_ATTRIBUTE_DEVICE 64 (0x40)

Reserved; do not use.

FILE_ATTRIBUTE_DIRECTORY 16 (0x10)

The handle identifies a directory.

FILE_ATTRIBUTE_ENCRYPTED 16384 (0x4000)

The file or directory is encrypted.

For a file, this means that all data in the file is encrypted.

For a directory, this means that encryption is the default for newly created files and subdirectories.

FILE_ATTRIBUTE_HIDDEN 2 (0x2)

The file or directory is hidden.

It is not included in an ordinary directory listing.

FILE_ATTRIBUTE_NORMAL 128 (0x80)

The file or directory does not have other attributes set.

This attribute is valid only when used alone.

FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 8192 (0x2000)

The file is not to be indexed by the content indexing service.

FILE_ATTRIBUTE_OFFLINE 4096 (0x1000)

The file data is not available immediately.

This attribute indicates that the file data is physically moved to offline storage.

This attribute is used by Remote Storage, which is the hierarchical storage management software.

Note   Applications should not arbitrarily change this attribute.

FILE_ATTRIBUTE_READONLY 1 (0x1)

The file or directory is read-only.

For a file, applications can read the file, but cannot write to it or delete it.

For a directory, applications cannot delete it.

FILE_ATTRIBUTE_REPARSE_POINT 1024 (0x400)

The file or directory has an associated reparse point.

FILE_ATTRIBUTE_SPARSE_FILE 512 (0x200)

The file is a sparse file.

FILE_ATTRIBUTE_SYSTEM 4 (0x4)

The file or directory is part of the operating system, or the operating system uses the file or directory exclusively.

FILE_ATTRIBUTE_TEMPORARY 256 (0x100)

The file is being used for temporary storage.

File systems attempt to keep all of the data in memory for quick access, rather than flushing it back to mass storage.

An application should delete a temporary file as soon as it is not needed.

FILE_ATTRIBUTE_VIRTUAL 65536 (0x10000)

The file is a virtual file.

ftCreationTime

A FILETIME structure that specifies when a file or directory was created.

If the underlying file system does not support creation time, this member is zero (0).

ftLastAccessTime

A FILETIME structure.

For a file, the structure specifies when the file was last read from, written to, or for executable files, run.

For a directory, the structure specifies when the directory is created. If the underlying file system does not support last access time, this member is zero (0).

On the FAT file system, the specified date for both files and directories is correct, but the time of day is always set to midnight.

ftLastWriteTime

A FILETIME structure.

For a file, the structure specifies when the file was last written to, truncated, or overwritten, for example, when WriteFile or SetEndOfFile are used. The date and time are not updated when file attributes or security descriptors are changed.

For a directory, the structure specifies when the directory is created. If the underlying file system does not support last write time, this member is zero (0).

nFileSizeHigh

The high-order DWORD value of the file size, in bytes.

This value is zero (0) unless the file size is greater than MAXDWORD.

The size of the file is equal to (nFileSizeHigh * (MAXDWORD+1)) + nFileSizeLow .

nFileSizeLow

The low-order DWORD value of the file size, in bytes.

dwReserved0

If the dwFileAttributes member includes the FILE_ATTRIBUTE_REPARSE_POINT attribute, this member specifies the reparse point tag.

Otherwise, this value is undefined and should not be used.

For more information see Reparse Point Tags .

NameValue

IO_REPARSE_TAG_DFS

0x8000000A

IO_REPARSE_TAG_DFSR

0x80000012

IO_REPARSE_TAG_HSM

0xC0000004

IO_REPARSE_TAG_HSM2

0x80000006

IO_REPARSE_TAG_MOUNT_POINT

0xA0000003

IO_REPARSE_TAG_SIS

0x80000007

IO_REPARSE_TAG_SYMLINK

0xA000000C

dwReserved1

Reserved for future use.

cFileName

The name of the file.

cAlternateFileName

An alternative name for the file.

This name is in the classic 8.3 (filename.ext) file name format.

Remarks

If a file has a long file name, the complete name appears in the cFileName member, and the 8.3 format truncated version of the name appears in the cAlternateFileName member. Otherwise, cAlternateFileName is empty. As an alternative, you can use the GetShortPathName function to find the 8.3 format version of a file name.

Not all file systems can record creation and last access times, and not all file systems record them in the same manner. For example, on the FAT file system, create time has a resolution of 10 milliseconds, write time has a resolution of 2 (two) seconds, and access time has a resolution of one (1) day (really, the access date). The NTFS file system delays updates to the last access time for a file by up to one hour after the last access. For more information, see File Times .

Requirements

Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinBase.h (include Windows.h)
Unicode and ANSI namesWIN32_FIND_DATAW (Unicode) and WIN32_FIND_DATAA (ANSI)
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值