QueryFSInformation.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. public abstract class QueryFSInformation
  14. {
  15. public abstract byte[] GetBytes(bool isUnicode);
  16. public static QueryFSInformation GetQueryFSInformation(byte[] buffer, QueryFSInformationLevel informationLevel, bool isUnicode)
  17. {
  18. switch (informationLevel)
  19. {
  20. case QueryFSInformationLevel.SMB_INFO_ALLOCATION:
  21. return new QueryFSInfoAllocation(buffer, 0);
  22. case QueryFSInformationLevel.SMB_INFO_VOLUME:
  23. return new QueryFSInfoVolume(isUnicode, buffer, 0);
  24. case QueryFSInformationLevel.SMB_QUERY_FS_VOLUME_INFO:
  25. return new QueryFSVolumeInfo(buffer, 0);
  26. case QueryFSInformationLevel.SMB_QUERY_FS_SIZE_INFO:
  27. return new QueryFSSizeInfo(buffer, 0);
  28. case QueryFSInformationLevel.SMB_QUERY_FS_DEVICE_INFO:
  29. return new QueryFSDeviceInfo(buffer, 0);
  30. case QueryFSInformationLevel.SMB_QUERY_FS_ATTRIBUTE_INFO:
  31. return new QueryFSAttibuteInfo(buffer, 0);
  32. default:
  33. throw new InvalidRequestException();
  34. }
  35. }
  36. }
  37. }