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.

BY_HANDLE_FILE_INFORMATION.cs 3.6 KiB

7 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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.IO;
  22. using System.Runtime.InteropServices;
  23. namespace Alphaleonis.Win32.Filesystem
  24. {
  25. internal static partial class NativeMethods
  26. {
  27. /// <summary>Contains information that the GetFileInformationByHandle function retrieves.</summary>
  28. [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
  29. internal struct BY_HANDLE_FILE_INFORMATION
  30. {
  31. /// <summary>The file attributes.</summary>
  32. public readonly FileAttributes dwFileAttributes;
  33. /// <summary>A <see cref="FILETIME"/> structure that specifies when a file or directory is created.</summary>
  34. public readonly FILETIME ftCreationTime;
  35. /// <summary>A <see cref="FILETIME"/> structure. For a file, the structure specifies the last time that a file is read from or written to.
  36. /// For a directory, the structure specifies when the directory is created.
  37. /// For both files and directories, the specified date is correct, but the time of day is always set to midnight.
  38. /// </summary>
  39. public readonly FILETIME ftLastAccessTime;
  40. /// <summary>A <see cref="FILETIME"/> structure. For a file, the structure specifies the last time that a file is written to.
  41. /// For a directory, the structure specifies when the directory is created.</summary>
  42. public readonly FILETIME ftLastWriteTime;
  43. /// <summary>The serial number of the volume that contains a file.</summary>
  44. [MarshalAs(UnmanagedType.U4)]
  45. public readonly int dwVolumeSerialNumber;
  46. /// <summary>The high-order part of the file size.</summary>
  47. [MarshalAs(UnmanagedType.U4)]
  48. public readonly uint nFileSizeHigh;
  49. /// <summary>The low-order part of the file size.</summary>
  50. [MarshalAs(UnmanagedType.U4)]
  51. public readonly uint nFileSizeLow;
  52. /// <summary>The number of links to this file. For the FAT file system this member is always 1. For the NTFS file system, it can be more than 1.</summary>
  53. [MarshalAs(UnmanagedType.U4)]
  54. public readonly int nNumberOfLinks;
  55. /// <summary>The high-order part of a unique identifier that is associated with a file.</summary>
  56. [MarshalAs(UnmanagedType.U4)]
  57. public readonly uint nFileIndexHigh;
  58. /// <summary>The low-order part of a unique identifier that is associated with a file.</summary>
  59. [MarshalAs(UnmanagedType.U4)]
  60. public readonly uint nFileIndexLow;
  61. }
  62. }
  63. }