NTTransactIOCTLResponse.cs 1.5 KB

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