NTTransactIOCTLResponse.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /* Copyright (C) 2014 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. /// NT_TRANSACT_IOCTL Response
  15. /// </summary>
  16. public class NTTransactIOCTLResponse : NTTransactSubcommand
  17. {
  18. public const int ParametersLength = 0;
  19. public const int SetupLength = 2;
  20. // Setup:
  21. public ushort TransactionDataSize; // in bytes
  22. // Data:
  23. public byte[] Data;
  24. public NTTransactIOCTLResponse() : base()
  25. {
  26. }
  27. public NTTransactIOCTLResponse(byte[] setup, byte[] data) : base()
  28. {
  29. TransactionDataSize = LittleEndianConverter.ToUInt16(setup, 0);
  30. Data = data;
  31. }
  32. public override byte[] GetSetup()
  33. {
  34. byte[] setup = new byte[SetupLength];
  35. LittleEndianWriter.WriteUInt16(setup, 0, TransactionDataSize);
  36. return setup;
  37. }
  38. public override byte[] GetData()
  39. {
  40. return Data;
  41. }
  42. public override NTTransactSubcommandName SubcommandName
  43. {
  44. get
  45. {
  46. return NTTransactSubcommandName.NT_TRANSACT_IOCTL;
  47. }
  48. }
  49. }
  50. }