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.

87 lines
2.6 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1998 - 1999
  6. //
  7. // File: attribute.h
  8. //
  9. //--------------------------------------------------------------------------
  10. #ifndef _ATTRIBUTE_H
  11. #define _ATTRIBUTE_H
  12. #include "common.h"
  13. ///////////////////////////////////////////////////////////////////////
  14. class CAttrList;
  15. ////////////////////////////////////////////////////////////////////////
  16. // CADSIAttr
  17. class CADSIAttr
  18. {
  19. public:
  20. // Constructors
  21. //
  22. CADSIAttr(ADS_ATTR_INFO* pInfo, BOOL bMulti, PCWSTR pszSyntax, BOOL bReadOnly = TRUE);
  23. CADSIAttr(LPCWSTR lpszAttr);
  24. CADSIAttr(CADSIAttr* pAttr);
  25. // Destructor
  26. //
  27. ~CADSIAttr();
  28. // Data accessor functions
  29. //
  30. void GetProperty(CString& sProp) { sProp = m_pAttrInfo->pszAttrName; }
  31. DWORD GetNumValues() { return m_pAttrInfo->dwNumValues; }
  32. HRESULT SetValues(const CStringList& sValues);
  33. void GetValues(CStringList& psValues, DWORD dwMaxCharCount = 1024);
  34. BOOL GetMultivalued() { return m_bMulti; }
  35. void SetMultivalued(BOOL bMulti) { m_bMulti = bMulti; }
  36. void SetDirty(const BOOL bDirty) { m_bDirty = bDirty; }
  37. BOOL IsDirty() { return m_bDirty; }
  38. ADSTYPE GetADsType() { return m_pAttrInfo->dwADsType; }
  39. void SetADsType(ADSTYPE dwType) { m_pAttrInfo->dwADsType = dwType; }
  40. CString GetSyntax() { return m_szSyntax; }
  41. void SetSyntax(PCWSTR pszSyntax) { m_szSyntax = pszSyntax; }
  42. ADS_ATTR_INFO* GetAttrInfo();
  43. ADSVALUE* GetADsValues() { return m_pAttrInfo->pADsValues; }
  44. static HRESULT SetValuesInDS(CAttrList* ptouchAttr, IDirectoryObject* pDirObject);
  45. private:
  46. // Functions
  47. //
  48. ADSVALUE* GetADSVALUE(int idx);
  49. static BOOL _AllocOctetString(ADS_OCTET_STRING& rOldOctetString, ADS_OCTET_STRING& rNew);
  50. static void _FreeOctetString(BYTE* lpValue);
  51. static BOOL _AllocString(LPCWSTR lpsz, LPWSTR* lppszNew);
  52. static void _FreeString(LPWSTR* lppsz);
  53. static BOOL _CopyADsAttrInfo(ADS_ATTR_INFO* pAttrInfo, ADS_ATTR_INFO** ppNewAttrInfo);
  54. static BOOL _CopyADsAttrInfo(ADS_ATTR_INFO* pAttrInfo, ADS_ATTR_INFO* pNewAttrInfo);
  55. static void _FreeADsAttrInfo(ADS_ATTR_INFO** ppAttrInfo, BOOL bReadOnly);
  56. static void _FreeADsAttrInfo(ADS_ATTR_INFO* pAttrInfo);
  57. static BOOL _AllocValues(ADSVALUE** ppValues, DWORD dwLength);
  58. static BOOL _CopyADsValues(ADS_ATTR_INFO* pOldAttrInfo, ADS_ATTR_INFO* ppNewAttrInfo);
  59. static void _FreeADsValues(ADSVALUE** ppADsValues, DWORD dwLength);
  60. static HRESULT _SetADsFromString(LPCWSTR lpszValue, ADSTYPE adsType, ADSVALUE* pADsValue);
  61. // Member data
  62. //
  63. ADS_ATTR_INFO* m_pAttrInfo;
  64. BOOL m_bDirty;
  65. BOOL m_bMulti;
  66. BOOL m_bReadOnly;
  67. CString m_szSyntax;
  68. };
  69. #endif //_ATTRIBUTE_H