using System; using System.IO; using System.Runtime.InteropServices; using FILETIME = System.Runtime.InteropServices.ComTypes.FILETIME; namespace Vanara.PInvoke { /// Contains information about the file that is found by the FindFirstFile, FindFirstFileEx, or FindNextFile function. [PInvokeData("winbase.h")] [Serializable, StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct WIN32_FIND_DATA { /// /// The file attributes of a file. /// /// For possible values and their descriptions, see File Attribute Constants. /// /// The FILE_ATTRIBUTE_SPARSE_FILE attribute on the file is set if any of the streams of the file have ever been sparse. /// public FileAttributes dwFileAttributes; /// /// 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. /// public FILETIME ftCreationTime; /// /// 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. /// /// /// 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. /// /// public FILETIME ftLastAccessTime; /// /// 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. /// /// public FILETIME ftLastWriteTime; /// /// The high-order DWORD value of the file size, in bytes. /// This value is zero unless the file size is greater than MAXDWORD. /// The size of the file is equal to (nFileSizeHigh * (MAXDWORD+1)) + nFileSizeLow. /// public uint nFileSizeHigh; /// The low-order DWORD value of the file size, in bytes. public uint nFileSizeLow; /// /// 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. /// public int dwReserved0; /// Reserved for future use. public int dwReserved1; /// The name of the file. [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] public string cFileName; /// /// An alternative name for the file. /// This name is in the classic 8.3 file name format. /// [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 14)] public string cAlternateFileName; /// Gets the size of the file, combining and . /// The size of the file. public ulong FileSize => Macros.MAKELONG64(nFileSizeLow, nFileSizeHigh); } }