FileAllInformation.cs 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /* Copyright (C) 2017 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
  2. *
  3. * You can redistribute this program and/or modify it under the terms of
  4. * the GNU Lesser Public License as published by the Free Software Foundation,
  5. * either version 3 of the License, or (at your option) any later version.
  6. */
  7. using System;
  8. using System.Collections.Generic;
  9. using Utilities;
  10. namespace SMBLibrary
  11. {
  12. /// <summary>
  13. /// [MS-FSCC] 2.4.2 - FileAllInformation
  14. /// </summary>
  15. public class FileAllInformation : FileInformation
  16. {
  17. public FileBasicInformation BasicInformation;
  18. public FileStandardInformation StandardInformation;
  19. public FileInternalInformation InternalInformation;
  20. public FileEaInformation EaInformation;
  21. public FileAccessInformation AccessInformation;
  22. public FilePositionInformation PositionInformation;
  23. public FileModeInformation ModeInformation;
  24. public FileAlignmentInformation AlignmentInformation;
  25. public FileNameInformation NameInformation;
  26. public FileAllInformation()
  27. {
  28. BasicInformation = new FileBasicInformation();
  29. StandardInformation = new FileStandardInformation();
  30. InternalInformation = new FileInternalInformation();
  31. EaInformation = new FileEaInformation();
  32. AccessInformation = new FileAccessInformation();
  33. PositionInformation = new FilePositionInformation();
  34. ModeInformation = new FileModeInformation();
  35. AlignmentInformation = new FileAlignmentInformation();
  36. NameInformation = new FileNameInformation();
  37. }
  38. public FileAllInformation(byte[] buffer, int offset)
  39. {
  40. BasicInformation = new FileBasicInformation(buffer, offset + 0);
  41. StandardInformation = new FileStandardInformation(buffer, offset + 40);
  42. InternalInformation = new FileInternalInformation(buffer, offset + 64);
  43. EaInformation = new FileEaInformation(buffer, offset + 72);
  44. AccessInformation = new FileAccessInformation(buffer, offset + 76);
  45. PositionInformation = new FilePositionInformation(buffer, offset + 80);
  46. ModeInformation = new FileModeInformation(buffer, offset + 88);
  47. AlignmentInformation = new FileAlignmentInformation(buffer, offset + 92);
  48. NameInformation = new FileNameInformation(buffer, offset + 96);
  49. }
  50. public override void WriteBytes(byte[] buffer, int offset)
  51. {
  52. BasicInformation.WriteBytes(buffer, offset + 0);
  53. StandardInformation.WriteBytes(buffer, offset + 40);
  54. InternalInformation.WriteBytes(buffer, offset + 64);
  55. EaInformation.WriteBytes(buffer, offset + 72);
  56. AccessInformation.WriteBytes(buffer, offset + 76);
  57. PositionInformation.WriteBytes(buffer, offset + 80);
  58. ModeInformation.WriteBytes(buffer, offset + 88);
  59. AlignmentInformation.WriteBytes(buffer, offset + 92);
  60. NameInformation.WriteBytes(buffer, offset + 96);
  61. }
  62. public override FileInformationClass FileInformationClass
  63. {
  64. get
  65. {
  66. return FileInformationClass.FileAllInformation;
  67. }
  68. }
  69. public override int Length
  70. {
  71. get
  72. {
  73. return 96 + NameInformation.Length;
  74. }
  75. }
  76. }
  77. }