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.

87 lines
3.2 KiB

  1. /******************************************************************
  2. DskCommonRoutines.CPP --
  3. Description: Common Headers and Smart pointers
  4. Copyright (c) 2000-2001 Microsoft Corporation, All Rights Reserved
  5. ******************************************************************/
  6. #ifndef _CDSKQUOTACOMMON_H_
  7. #define _CDSKQUOTACOMMON_H_
  8. #include "precomp.h"
  9. _COM_SMARTPTR_TYPEDEF(IEnumDiskQuotaUsers, IID_IEnumDiskQuotaUsers);
  10. _COM_SMARTPTR_TYPEDEF(IDiskQuotaUser, IID_IDiskQuotaUser );
  11. _COM_SMARTPTR_TYPEDEF(IDiskQuotaControl, IID_IDiskQuotaControl );
  12. // Provider Namespace
  13. #define NameSpace L"root\\cimv2"
  14. // Provider Classes
  15. #define IDS_DiskVolumeClass L"Win32_QuotaSetting"
  16. #define IDS_LogicalDiskClass L"Win32_LogicalDisk"
  17. #define IDS_DiskQuotaClass L"Win32_DiskQuota"
  18. #define IDS_AccountClass L"Win32_Account"
  19. #define IDS_LogicalDiskClass L"Win32_LogicalDisk"
  20. #define IDS_VolumeQuotaSetting L"Win32_VolumeQuotaSetting"
  21. // #defines required for setting the properties in Instances.
  22. #define IDS_VolumePath L"VolumePath"
  23. #define IDS_Caption L"Caption"
  24. #define IDS_DeviceID L"DeviceID"
  25. #define IDS_LogicalDiskObjectPath L"QuotaVolume"
  26. #define IDS_UserObjectPath L"User"
  27. #define IDS_QuotaStatus L"Status"
  28. #define IDS_QuotaWarningLimit L"WarningLimit"
  29. #define IDS_QuotaLimit L"Limit"
  30. #define IDS_DiskSpaceUsed L"DiskSpaceUsed"
  31. #define IDS_QuotasDefaultLimit L"DefaultLimit"
  32. #define IDS_QuotasDefaultWarningLimit L"DefaultWarningLimit"
  33. #define IDS_QuotasWarningExceededNotification L"WarningExceededNotification"
  34. #define IDS_QuotaExceededNotification L"ExceededNotification"
  35. #define IDS_QuotaState L"State"
  36. #define IDS_Domain L"Domain"
  37. #define IDS_Name L"Name"
  38. #define IDS_Setting L"Setting"
  39. #define IDS_LogicalDisk L"Element"
  40. // Smart pointer for closing volume handles
  41. class SmartCloseVolumeHandle
  42. {
  43. private:
  44. HANDLE m_h;
  45. public:
  46. SmartCloseVolumeHandle():m_h(INVALID_HANDLE_VALUE){}
  47. SmartCloseVolumeHandle(HANDLE h):m_h(h){}
  48. ~SmartCloseVolumeHandle(){if (m_h!=INVALID_HANDLE_VALUE) FindVolumeClose(m_h);}
  49. HANDLE operator =(HANDLE h) {if (m_h!=INVALID_HANDLE_VALUE) FindVolumeClose(m_h); m_h=h; return h;}
  50. operator HANDLE() const {return m_h;}
  51. HANDLE* operator &() {if (m_h!=INVALID_HANDLE_VALUE) FindVolumeClose(m_h); m_h = INVALID_HANDLE_VALUE; return &m_h;}
  52. };
  53. // Common routines required for Disk Quota Provider
  54. struct DskCommonRoutines
  55. {
  56. public:
  57. HRESULT InitializeInterfacePointer ( IDiskQuotaControl* pIQuotaControl, LPCWSTR a_VolumeName );
  58. HRESULT VolumeSupportsDiskQuota ( LPCWSTR a_VolumeName, CHString &a_QuotaVolumeName );
  59. void GetVolumeDrive ( LPCWSTR a_VolumePath, LPCWSTR a_DriveStrings, CHString &a_DriveName );
  60. HRESULT GetVolume ( LPCWSTR t_Key1, WCHAR &w_Drive1 );
  61. HRESULT SearchLogicalDisk ( WCHAR a_Drive, LPCWSTR lpDriveStrings );
  62. void MakeObjectPath ( LPWSTR& lpObjPath, LPWSTR lpClassName, LPCWSTR lpAttributeName, LPCWSTR lpAttributeVal );
  63. void AddToObjectPath ( LPWSTR &a_ObjPathString, LPCWSTR a_AttributeName, LPCWSTR a_AttributeVal );
  64. };
  65. #endif