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.

FILE_ID_BOTH_DIR_INFO.cs 4.7 KiB

7 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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 files in the specified directory. Used for directory handles. Use only when calling GetFileInformationByHandleEx.</summary>
  29. /// <remarks>
  30. /// The number of files that are returned for each call to GetFileInformationByHandleEx depends on the size of the buffer that is passed to the function.
  31. /// Any subsequent calls to GetFileInformationByHandleEx on the same handle will resume the enumeration operation after the last file is returned.
  32. /// </remarks>
  33. [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
  34. internal struct FILE_ID_BOTH_DIR_INFO
  35. {
  36. /// <summary>The offset for the next FILE_ID_BOTH_DIR_INFO structure that is returned. Contains zero (0) if no other entries follow this one.</summary>
  37. [MarshalAs(UnmanagedType.U4)]
  38. public readonly int NextEntryOffset;
  39. /// <summary>The byte offset of the file within the parent directory. This member is undefined for file systems, such as NTFS,
  40. /// in which the position of a file within the parent directory is not fixed and can be changed at any time to maintain sort order.
  41. /// </summary>
  42. [MarshalAs(UnmanagedType.U4)]
  43. public readonly uint FileIndex;
  44. /// <summary>The time that the file was created.</summary>
  45. public FILETIME CreationTime;
  46. /// <summary>The time that the file was last accessed.</summary>
  47. public FILETIME LastAccessTime;
  48. /// <summary>The time that the file was last written to.</summary>
  49. public FILETIME LastWriteTime;
  50. /// <summary>The time that the file was last changed.</summary>
  51. public FILETIME ChangeTime;
  52. /// <summary>The absolute new end-of-file position as a byte offset from the start of the file to the end of the file.
  53. /// Because this value is zero-based, it actually refers to the first free byte in the file.
  54. /// In other words, EndOfFile is the offset to the byte that immediately follows the last valid byte in the file.
  55. /// </summary>
  56. public readonly long EndOfFile;
  57. /// <summary>The number of bytes that are allocated for the file. This value is usually a multiple of the sector or cluster size of the underlying physical device.</summary>
  58. public readonly long AllocationSize;
  59. /// <summary>The file attributes.</summary>
  60. public readonly FileAttributes FileAttributes;
  61. /// <summary>The length of the file name.</summary>
  62. [MarshalAs(UnmanagedType.U4)]
  63. public readonly uint FileNameLength;
  64. /// <summary>The size of the extended attributes for the file.</summary>
  65. [MarshalAs(UnmanagedType.U4)]
  66. public readonly int EaSize;
  67. /// <summary>The length of ShortName.</summary>
  68. [MarshalAs(UnmanagedType.U1)]
  69. public readonly byte ShortNameLength;
  70. /// <summary>The short 8.3 file naming convention (for example, "FILENAME.TXT") name of the file.</summary>
  71. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12, ArraySubType = UnmanagedType.U2)]
  72. public readonly char[] ShortName;
  73. /// <summary>The file ID.</summary>
  74. public readonly long FileId;
  75. /// <summary>The first character of the file name string. This is followed in memory by the remainder of the string.</summary>
  76. public IntPtr FileName;
  77. }
  78. }
  79. }