FileAllInformation.cs 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. }
  29. public FileAllInformation(byte[] buffer, int offset)
  30. {
  31. BasicInformation = new FileBasicInformation(buffer, offset + 0);
  32. StandardInformation = new FileStandardInformation(buffer, offset + 40);
  33. InternalInformation = new FileInternalInformation(buffer, offset + 64);
  34. EaInformation = new FileEaInformation(buffer, offset + 72);
  35. AccessInformation = new FileAccessInformation(buffer, offset + 76);
  36. PositionInformation = new FilePositionInformation(buffer, offset + 80);
  37. ModeInformation = new FileModeInformation(buffer, offset + 88);
  38. AlignmentInformation = new FileAlignmentInformation(buffer, offset + 92);
  39. NameInformation = new FileNameInformation(buffer, offset + 96);
  40. }
  41. public override void WriteBytes(byte[] buffer, int offset)
  42. {
  43. BasicInformation.WriteBytes(buffer, offset + 0);
  44. StandardInformation.WriteBytes(buffer, offset + 40);
  45. InternalInformation.WriteBytes(buffer, offset + 64);
  46. EaInformation.WriteBytes(buffer, offset + 72);
  47. AccessInformation.WriteBytes(buffer, offset + 76);
  48. PositionInformation.WriteBytes(buffer, offset + 80);
  49. ModeInformation.WriteBytes(buffer, offset + 88);
  50. AlignmentInformation.WriteBytes(buffer, offset + 92);
  51. NameInformation.WriteBytes(buffer, offset + 96);
  52. }
  53. public override FileInformationClass FileInformationClass
  54. {
  55. get
  56. {
  57. return FileInformationClass.FileAllInformation;
  58. }
  59. }
  60. public override int Length
  61. {
  62. get
  63. {
  64. return 96 + NameInformation.Length;
  65. }
  66. }
  67. }
  68. }