SetInfoResponse.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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.SMB2
  11. {
  12. /// <summary>
  13. /// SMB2 SET_INFO Response
  14. /// </summary>
  15. public class SetInfoResponse : SMB2Command
  16. {
  17. public const int DeclaredSize = 2;
  18. private ushort StructureSize;
  19. public SetInfoResponse() : base(SMB2CommandName.SetInfo)
  20. {
  21. Header.IsResponse = true;
  22. StructureSize = DeclaredSize;
  23. }
  24. public SetInfoResponse(byte[] buffer, int offset) : base(buffer, offset)
  25. {
  26. StructureSize = LittleEndianConverter.ToUInt16(buffer, offset + SMB2Header.Length + 0);
  27. }
  28. public override void WriteCommandBytes(byte[] buffer, int offset)
  29. {
  30. LittleEndianWriter.WriteUInt16(buffer, offset + 0, StructureSize);
  31. }
  32. public override int CommandLength
  33. {
  34. get
  35. {
  36. return DeclaredSize;
  37. }
  38. }
  39. }
  40. }