CloseRequest.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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_COM_CLOSE Request
  15. /// </summary>
  16. public class CloseRequest : SMB1Command
  17. {
  18. public const int ParametersLength = 6;
  19. // Parameters:
  20. public ushort FID;
  21. /// <summary>
  22. /// A value of 0x00000000 or 0xFFFFFFFF results in the server not updating the last modification time
  23. /// </summary>
  24. public DateTime? LastTimeModified;
  25. public CloseRequest() : base()
  26. {
  27. }
  28. public CloseRequest(byte[] buffer, int offset) : base(buffer, offset, false)
  29. {
  30. FID = LittleEndianConverter.ToUInt16(this.SMBParameters, 0);
  31. LastTimeModified = UTimeHelper.ReadNullableUTime(this.SMBParameters, 2);
  32. }
  33. public override byte[] GetBytes(bool isUnicode)
  34. {
  35. this.SMBParameters = new byte[ParametersLength];
  36. LittleEndianWriter.WriteUInt16(this.SMBParameters, 0, FID);
  37. UTimeHelper.WriteUTime(this.SMBParameters, 2, LastTimeModified);
  38. return base.GetBytes(isUnicode);
  39. }
  40. public override CommandName CommandName
  41. {
  42. get
  43. {
  44. return CommandName.SMB_COM_CLOSE;
  45. }
  46. }
  47. }
  48. }