QueryFSDeviceInfo.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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_QUERY_FS_DEVICE_INFO
  15. /// </summary>
  16. public class QueryFSDeviceInfo : QueryFSInformation
  17. {
  18. public const int FixedLength = 8;
  19. public DeviceType DeviceType;
  20. public DeviceCharacteristics DeviceCharacteristics;
  21. public QueryFSDeviceInfo()
  22. {
  23. }
  24. public QueryFSDeviceInfo(byte[] buffer, int offset)
  25. {
  26. DeviceType = (DeviceType)LittleEndianConverter.ToUInt32(buffer, offset + 0);
  27. DeviceCharacteristics = (DeviceCharacteristics)LittleEndianConverter.ToUInt32(buffer, offset + 4);
  28. }
  29. public override byte[] GetBytes(bool isUnicode)
  30. {
  31. byte[] buffer = new byte[Length];
  32. LittleEndianWriter.WriteUInt32(buffer, 0, (uint)DeviceType);
  33. LittleEndianWriter.WriteUInt32(buffer, 4, (uint)DeviceCharacteristics);
  34. return buffer;
  35. }
  36. public override int Length
  37. {
  38. get
  39. {
  40. return FixedLength;
  41. }
  42. }
  43. public override QueryFSInformationLevel InformationLevel
  44. {
  45. get
  46. {
  47. return QueryFSInformationLevel.SMB_QUERY_FS_DEVICE_INFO;
  48. }
  49. }
  50. }
  51. }