SMB1FileStoreHelper.QueryFileSystem.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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 System.Text;
  10. using SMBLibrary.SMB1;
  11. using Utilities;
  12. namespace SMBLibrary.Server.SMB1
  13. {
  14. internal partial class SMB1FileStoreHelper
  15. {
  16. public static NTStatus GetFileSystemInformation(out QueryFSInformation result, INTFileStore fileStore, QueryFSInformationLevel informationLevel)
  17. {
  18. result = null;
  19. FileSystemInformationClass informationClass;
  20. try
  21. {
  22. informationClass = QueryFSInformationHelper.ToFileSystemInformationClass(informationLevel);
  23. }
  24. catch (UnsupportedInformationLevelException)
  25. {
  26. return NTStatus.STATUS_OS2_INVALID_LEVEL;
  27. }
  28. FileSystemInformation fsInfo;
  29. NTStatus status = fileStore.GetFileSystemInformation(out fsInfo, informationClass);
  30. if (status != NTStatus.STATUS_SUCCESS)
  31. {
  32. return status;
  33. }
  34. result = QueryFSInformationHelper.FromFileSystemInformation(fsInfo);
  35. return NTStatus.STATUS_SUCCESS;
  36. }
  37. }
  38. }