You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

94 lines
5.6 KiB

  1. /* Copyright (C) 2008-2016 Peter Palotas, Jeffrey Jangli, Alexandr Normuradov
  2. *
  3. * Permission is hereby granted, free of charge, to any person obtaining a copy
  4. * of this software and associated documentation files (the "Software"), to deal
  5. * in the Software without restriction, including without limitation the rights
  6. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7. * copies of the Software, and to permit persons to whom the Software is
  8. * furnished to do so, subject to the following conditions:
  9. *
  10. * The above copyright notice and this permission notice shall be included in
  11. * all copies or substantial portions of the Software.
  12. *
  13. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19. * THE SOFTWARE.
  20. */
  21. using System;
  22. using System.IO;
  23. using System.Runtime.InteropServices;
  24. namespace Alphaleonis.Win32.Filesystem
  25. {
  26. internal static partial class NativeMethods
  27. {
  28. /// <summary>Contains information about the file that is found by the FindFirstFile, FindFirstFileEx, or FindNextFile function.</summary>
  29. /// <remarks>
  30. /// 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
  31. /// in the cAlternateFileName member. Otherwise, cAlternateFileName is empty. If the FindFirstFileEx function was called with a value of FindExInfoBasic
  32. /// in the fInfoLevelId parameter, the cAlternateFileName member will always contain a <see langword="null"/> string value. This remains true for all subsequent calls to the
  33. /// FindNextFile function. As an alternative method of retrieving the 8.3 format version of a file name, you can use the GetShortPathName function.
  34. /// For more information about file names, see File Names, Paths, and Namespaces.
  35. /// </remarks>
  36. /// <remarks>
  37. /// Not all file systems can record creation and last access times, and not all file systems record them in the same manner.
  38. /// For example, on the FAT file system, create time has a resolution of 10 milliseconds, write time has a resolution of 2 seconds,
  39. /// and access time has a resolution of 1 day. The NTFS file system delays updates to the last access time for a file by up to 1 hour
  40. /// after the last access. For more information, see File Times.
  41. /// </remarks>
  42. [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
  43. [SerializableAttribute]
  44. internal struct WIN32_FIND_DATA
  45. {
  46. /// <summary>The file attributes of a file.</summary>
  47. public FileAttributes dwFileAttributes;
  48. /// <summary>A <see cref="FILETIME"/> structure that specifies when a file or directory was created.
  49. /// If the underlying file system does not support creation time, this member is zero.</summary>
  50. public FILETIME ftCreationTime;
  51. /// <summary>A <see cref="FILETIME"/> structure.
  52. /// For a file, the structure specifies when the file was last read from, written to, or for executable files, run.
  53. /// 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.
  54. /// 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.
  55. /// </summary>
  56. public FILETIME ftLastAccessTime;
  57. /// <summary>A <see cref="FILETIME"/> structure.
  58. /// For a file, the structure specifies when the file was last written to, truncated, or overwritten, for example, when WriteFile or SetEndOfFile are used.
  59. /// The date and time are not updated when file attributes or security descriptors are changed.
  60. /// 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.
  61. /// </summary>
  62. public FILETIME ftLastWriteTime;
  63. /// <summary>The high-order DWORD of the file size. This member does not have a meaning for directories.
  64. /// This value is zero unless the file size is greater than MAXDWORD.
  65. /// The size of the file is equal to (nFileSizeHigh * (MAXDWORD+1)) + nFileSizeLow.
  66. /// </summary>
  67. public uint nFileSizeHigh;
  68. /// <summary>The low-order DWORD of the file size. This member does not have a meaning for directories.</summary>
  69. public uint nFileSizeLow;
  70. /// <summary>If the dwFileAttributes member includes the FILE_ATTRIBUTE_REPARSE_POINT attribute, this member specifies the reparse point tag.
  71. /// Otherwise, this value is undefined and should not be used.
  72. /// </summary>
  73. public readonly ReparsePointTag dwReserved0;
  74. /// <summary>Reserved for future use.</summary>
  75. private readonly uint dwReserved1;
  76. /// <summary>The name of the file.</summary>
  77. [MarshalAs(UnmanagedType.ByValTStr, SizeConst = MaxPath)] public string cFileName;
  78. /// <summary>An alternative name for the file. This name is in the classic 8.3 file name format.</summary>
  79. [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 14)] public string cAlternateFileName;
  80. }
  81. }
  82. }