DeleteRequest.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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.IO;
  10. using Utilities;
  11. namespace SMBLibrary.SMB1
  12. {
  13. /// <summary>
  14. /// SMB_COM_DELETE Request
  15. /// </summary>
  16. public class DeleteRequest : SMB1Command
  17. {
  18. public const int SupportedBufferFormat = 0x04;
  19. public const int ParametersLength = 2;
  20. // Parameters;
  21. public SMBFileAttributes SearchAttributes;
  22. // Data:
  23. public byte BufferFormat;
  24. public string FileName; // SMB_STRING
  25. public DeleteRequest() : base()
  26. {
  27. BufferFormat = SupportedBufferFormat;
  28. }
  29. public DeleteRequest(byte[] buffer, int offset, bool isUnicode) : base(buffer, offset, isUnicode)
  30. {
  31. SearchAttributes = (SMBFileAttributes)LittleEndianConverter.ToUInt16(this.SMBParameters, 0);
  32. BufferFormat = ByteReader.ReadByte(this.SMBData, 0);
  33. if (BufferFormat != SupportedBufferFormat)
  34. {
  35. throw new InvalidDataException("Unsupported Buffer Format");
  36. }
  37. FileName = SMB1Helper.ReadSMBString(this.SMBData, 1, isUnicode);
  38. }
  39. public override byte[] GetBytes(bool isUnicode)
  40. {
  41. throw new NotImplementedException();
  42. }
  43. public override CommandName CommandName
  44. {
  45. get
  46. {
  47. return CommandName.SMB_COM_DELETE;
  48. }
  49. }
  50. }
  51. }