Transaction2QueryPathInformationResponse.cs 2.6 KB

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