Transaction2QueryPathInformationResponse.cs 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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 Utilities;
  10. namespace SMBLibrary.SMB1
  11. {
  12. /// <summary>
  13. /// TRANS2_QUERY_PATH_INFORMATION Response
  14. /// </summary>
  15. public class Transaction2QueryPathInformationResponse : Transaction2Subcommand
  16. {
  17. public const int ParametersLength = 2;
  18. // Parameters:
  19. public ushort EaErrorOffset; // Meaningful only when request's InformationLevel is SMB_INFO_QUERY_EAS_FROM_LIST
  20. // Data:
  21. public byte[] InformationBytes;
  22. public Transaction2QueryPathInformationResponse() : base()
  23. {
  24. }
  25. public Transaction2QueryPathInformationResponse(byte[] parameters, byte[] data, bool isUnicode) : base()
  26. {
  27. EaErrorOffset = LittleEndianConverter.ToUInt16(parameters, 0);
  28. InformationBytes = data;
  29. }
  30. public override byte[] GetParameters(bool isUnicode)
  31. {
  32. return LittleEndianConverter.GetBytes(EaErrorOffset);
  33. }
  34. public override byte[] GetData(bool isUnicode)
  35. {
  36. return InformationBytes;
  37. }
  38. public QueryInformation GetQueryInformation(QueryInformationLevel queryInformationLevel)
  39. {
  40. return QueryInformation.GetQueryInformation(InformationBytes, queryInformationLevel);
  41. }
  42. public void SetQueryInformation(QueryInformation queryInformation)
  43. {
  44. InformationBytes = queryInformation.GetBytes();
  45. }
  46. /// <remarks>
  47. /// Support for pass-through Information Levels must be enabled.
  48. /// </remarks>
  49. public FileInformation GetFileInformation(FileInformationClass informationClass)
  50. {
  51. return FileInformation.GetFileInformation(InformationBytes, 0, informationClass);
  52. }
  53. /// <remarks>
  54. /// Support for pass-through Information Levels must be enabled.
  55. /// </remarks>
  56. public void SetFileInformation(FileInformation information)
  57. {
  58. InformationBytes = information.GetBytes();
  59. }
  60. public override Transaction2SubcommandName SubcommandName
  61. {
  62. get
  63. {
  64. return Transaction2SubcommandName.TRANS2_QUERY_PATH_INFORMATION;
  65. }
  66. }
  67. }
  68. }