FileFsDeviceInformation.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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.5.10 - FileFsDeviceInformation
  14. /// </summary>
  15. public class FileFsDeviceInformation : FileSystemInformation
  16. {
  17. public const int FixedLength = 8;
  18. public DeviceType DeviceType;
  19. public DeviceCharacteristics Characteristics;
  20. public FileFsDeviceInformation()
  21. {
  22. }
  23. public FileFsDeviceInformation(byte[] buffer, int offset)
  24. {
  25. DeviceType = (DeviceType)LittleEndianConverter.ToUInt32(buffer, offset + 0);
  26. Characteristics = (DeviceCharacteristics)LittleEndianConverter.ToUInt32(buffer, offset + 4);
  27. }
  28. public override void WriteBytes(byte[] buffer, int offset)
  29. {
  30. LittleEndianWriter.WriteUInt32(buffer, offset + 0, (uint)DeviceType);
  31. LittleEndianWriter.WriteUInt32(buffer, offset + 4, (uint)Characteristics);
  32. }
  33. public override FileSystemInformationClass FileSystemInformationClass
  34. {
  35. get
  36. {
  37. return FileSystemInformationClass.FileFsDeviceInformation;
  38. }
  39. }
  40. public override int Length
  41. {
  42. get
  43. {
  44. return FixedLength;
  45. }
  46. }
  47. }
  48. }