QueryFSInformation.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435
  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_QUERY_FS_VOLUME_INFO:
  21. return new QueryFSVolumeInfo(buffer, 0);
  22. case QueryFSInformationLevel.SMB_QUERY_FS_SIZE_INFO:
  23. return new QueryFSSizeInfo(buffer, 0);
  24. case QueryFSInformationLevel.SMB_QUERY_FS_DEVICE_INFO:
  25. return new QueryFSDeviceInfo(buffer, 0);
  26. case QueryFSInformationLevel.SMB_QUERY_FS_ATTRIBUTE_INFO:
  27. return new QueryFSAttibuteInfo(buffer, 0);
  28. default:
  29. throw new InvalidRequestException();
  30. }
  31. }
  32. }
  33. }