WriteResponse.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using Utilities;
  5. namespace SMBLibrary.SMB1
  6. {
  7. /// <summary>
  8. /// SMB_COM_WRITE Response.
  9. /// This command is obsolete.
  10. /// Windows NT4 SP6 will send this command with empty data for some reason.
  11. /// </summary>
  12. public class WriteResponse : SMB1Command
  13. {
  14. public const int ParametersLength = 2;
  15. // Parameters:
  16. public ushort CountOfBytesWritten;
  17. public WriteResponse() : base()
  18. {
  19. }
  20. public WriteResponse(byte[] buffer, int offset) : base(buffer, offset, false)
  21. {
  22. CountOfBytesWritten = LittleEndianConverter.ToUInt16(this.SMBParameters, 0);
  23. }
  24. public override byte[] GetBytes(bool isUnicode)
  25. {
  26. this.SMBParameters = new byte[ParametersLength];
  27. LittleEndianWriter.WriteUInt16(this.SMBParameters, 0, CountOfBytesWritten);
  28. return base.GetBytes(isUnicode);
  29. }
  30. public override CommandName CommandName
  31. {
  32. get
  33. {
  34. return CommandName.SMB_COM_WRITE;
  35. }
  36. }
  37. }
  38. }