SetFileAllocationInfo.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /* Copyright (C) 2014-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 System.Text;
  10. using Utilities;
  11. namespace SMBLibrary.SMB1
  12. {
  13. /// <summary>
  14. /// SMB_SET_FILE_ALLOCATION_INFO
  15. /// </summary>
  16. public class SetFileAllocationInfo : SetInformation
  17. {
  18. public const int Length = 8;
  19. public long AllocationSize;
  20. public SetFileAllocationInfo()
  21. {
  22. }
  23. public SetFileAllocationInfo(byte[] buffer) : this(buffer, 0)
  24. {
  25. }
  26. public SetFileAllocationInfo(byte[] buffer, int offset)
  27. {
  28. AllocationSize = LittleEndianConverter.ToInt64(buffer, offset);
  29. }
  30. public override byte[] GetBytes()
  31. {
  32. byte[] buffer = new byte[Length];
  33. LittleEndianWriter.WriteInt64(buffer, 0, AllocationSize);
  34. return buffer;
  35. }
  36. public override SetInformationLevel InformationLevel
  37. {
  38. get
  39. {
  40. return SetInformationLevel.SMB_SET_FILE_ALLOCATION_INFO;
  41. }
  42. }
  43. }
  44. }