Transaction2QueryFSInformationResponse.cs 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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_FS_INFORMATION Response
  14. /// </summary>
  15. public class Transaction2QueryFSInformationResponse : Transaction2Subcommand
  16. {
  17. public const int ParametersLength = 0;
  18. // Data:
  19. public byte[] InformationBytes;
  20. public Transaction2QueryFSInformationResponse() : base()
  21. {
  22. }
  23. public Transaction2QueryFSInformationResponse(byte[] parameters, byte[] data, bool isUnicode) : base()
  24. {
  25. InformationBytes = data;
  26. }
  27. public override byte[] GetData(bool isUnicode)
  28. {
  29. return InformationBytes;
  30. }
  31. public QueryFSInformation GetQueryFSInformation(QueryFSInformationLevel informationLevel, bool isUnicode)
  32. {
  33. return QueryFSInformation.GetQueryFSInformation(InformationBytes, informationLevel, isUnicode);
  34. }
  35. public void SetQueryFSInformation(QueryFSInformation queryFSInformation, bool isUnicode)
  36. {
  37. InformationBytes = queryFSInformation.GetBytes(isUnicode);
  38. }
  39. /// <remarks>
  40. /// Support for pass-through Information Levels must be enabled.
  41. /// </remarks>
  42. public FileSystemInformation GetFileSystemInformation(FileSystemInformationClass informationClass)
  43. {
  44. return FileSystemInformation.GetFileSystemInformation(InformationBytes, 0, informationClass);
  45. }
  46. /// <remarks>
  47. /// Support for pass-through Information Levels must be enabled.
  48. /// </remarks>
  49. public void SetFileSystemInformation(FileSystemInformation information)
  50. {
  51. InformationBytes = information.GetBytes();
  52. }
  53. public override Transaction2SubcommandName SubcommandName
  54. {
  55. get
  56. {
  57. return Transaction2SubcommandName.TRANS2_QUERY_FS_INFORMATION;
  58. }
  59. }
  60. }
  61. }