Source code of Windows XP (NT5)
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.

65 lines
2.1 KiB

  1. ///////////////////////////////////////////////////////////////////////////////
  2. /* File: volume.cpp
  3. Description: The CVolume class maintains information about a particular
  4. disk volume. During initialization, the object determines if the
  5. associated volume supports quotas. The object's client can then query
  6. it for volume-specific quota information. Objects of this class are used
  7. in the CStatistics class to store information about a user/volume
  8. pair.
  9. CVolume
  10. Revision History:
  11. Date Description Programmer
  12. -------- --------------------------------------------------- ----------
  13. 07/01/97 Initial creation. BrianAu
  14. */
  15. ///////////////////////////////////////////////////////////////////////////////
  16. #include <precomp.hxx>
  17. #pragma hdrstop
  18. #include "volume.h"
  19. CVolume::CVolume(
  20. TCHAR chLetter,
  21. LPCTSTR pszDisplayName
  22. ) : m_chLetter(chLetter),
  23. m_dwSerialNo(0),
  24. m_strDisplayName(pszDisplayName),
  25. m_bSupportsQuotas(FALSE)
  26. {
  27. TCHAR szVolume[] = TEXT("X:\\");
  28. DWORD dwFsFlags = 0;
  29. szVolume[0] = m_chLetter;
  30. if (::GetVolumeInformation(szVolume, // i.e. "X:"
  31. NULL, // Vol name, don't need it.
  32. 0, // Vol name buf len.
  33. &m_dwSerialNo, // Serial number var ptr.
  34. NULL, // Max component len var ptr.
  35. &dwFsFlags, // File system flags var ptr.
  36. NULL, // File sys name, don't need it.
  37. 0)) // File sys name buf len.
  38. {
  39. m_bSupportsQuotas = (0 != (dwFsFlags & FILE_VOLUME_QUOTAS));
  40. }
  41. else
  42. {
  43. DebugMsg(DM_ERROR,
  44. TEXT("CVolume - GetVolumeInformation for \"%s\" failed with error %d"),
  45. pszDisplayName, GetLastError());
  46. }
  47. }
  48. CVolume::~CVolume(
  49. VOID
  50. )
  51. {
  52. }