Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
2.1 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1998.
  5. //
  6. // File: driveinf.hxx
  7. //
  8. // Contents: Retrieves information about a specific volume.
  9. //
  10. // Classes: CDriveInfo
  11. //
  12. // History: 17-Nov-98 KLam Created
  13. //
  14. //----------------------------------------------------------------------------
  15. #pragma once
  16. #include <winioctl.h>
  17. //+---------------------------------------------------------------------------
  18. //
  19. // Class: CDriveInfo
  20. //
  21. // Purpose: An object that provides volume specific information.
  22. //
  23. // History: 17-Nov-98 KLam Created
  24. //
  25. // Notes: Caches some information about the volume after first call to methods.
  26. //
  27. //----------------------------------------------------------------------------
  28. class CDriveInfo
  29. {
  30. public:
  31. CDriveInfo ( WCHAR const * wcsPath, ULONG cMegToLeaveOnDisk );
  32. enum eFileSystem { VOLINFO_UNKNOWN, VOLINFO_NTFS, VOLINFO_FAT, VOLINFO_OTHER };
  33. BOOL IsSameDrive ( WCHAR const * wcsPath );
  34. BOOL IsWriteProtected ();
  35. WCHAR const * GetDrive () const { return _wcsDrive; }
  36. ULONG GetSectorSize ();
  37. void GetDiskSpace ( __int64 & cbTotal, __int64 & cbRemaining );
  38. ULONG GetDriveType ( BOOL fRefresh = FALSE );
  39. WCHAR const * GetVolumeName ( BOOL fRefresh = FALSE );
  40. eFileSystem GetFileSystem ( BOOL fRefresh = FALSE );
  41. static void GetDrive ( WCHAR const * wcsPath, WCHAR *wcsDrive );
  42. static BOOL ContainsDrive ( WCHAR const * wcsPath );
  43. private:
  44. __int64 _cbDiskSpaceToLeave; // bytes not to use
  45. ULONG _cbSectorSize; // bytes in a sector
  46. WCHAR _wcsDrive[_MAX_DRIVE ]; // Form is <drive letter>:
  47. WCHAR _wcsRoot[_MAX_DRIVE + 1]; // Root of the drive
  48. BOOL _fWriteProtected;
  49. BOOL _fCheckedProtection; // _fWriteProtected Cached?
  50. eFileSystem _efsType;
  51. ULONG _ulDriveType;
  52. WCHAR _awcVolumeName[MAX_VOLUME_ID_SIZE+1];
  53. };